Trisurf Monte Carlo simulator
Samo Penic
2018-05-15 7ec6fb63c690080d0624c7bf138d0fd84fe7664e
commit | author | age
f4d6ca 1 /* vim: set ts=4 sts=4 sw=4 noet : */
SP 2 #include<stdio.h>
3 #include<math.h>
4 #include<stdlib.h>
5 #include "general.h"
6 //#include "vertex.h"
7 //#include "bond.h"
8 //#include "triangle.h"
9 //#include "cell.h"
10 #include "vesicle.h"
11 #include "io.h"
12 //#include "initial_distribution.h"
13 //#include "frame.h"
14 //#include "timestep.h"
15 //#include "poly.h"
16 #include "sh.h"
17 #include "shcomplex.h"
18 #include "dumpstate.h"
19 #include "restore.h"
20 #include <string.h>
21 #include <getopt.h>
22 #include <sys/stat.h>
23 #include <sys/types.h>
24 #include <dirent.h>
25 #include <errno.h>
26 #include <snapshot.h>
27 #include<gsl/gsl_complex.h>
28 #include<gsl/gsl_complex_math.h>
29
30
31 ts_vesicle *restoreVesicle(char *filename){
32     ts_vesicle *vesicle = parseDump(filename);
33     return vesicle;
34 }
35
36 void vesicle_calculate_ulm2(ts_vesicle *vesicle){
701026 37     //complex_sph_free(vesicle->sphHarmonics);
002b70 38
701026 39     //vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
f4d6ca 40     vesicle_volume(vesicle);
SP 41     preparationSh(vesicle,getR0(vesicle));
42     calculateUlmComplex(vesicle);
43     ts_int i,j;
44     for(i=0;i<vesicle->sphHarmonics->l;i++){
aad500 45             for(j=i;j<2*i+1;j++){
f4d6ca 46             printf("%e ", gsl_complex_abs2(vesicle->sphHarmonics->ulmComplex[i][j]));
SP 47             }
48     }
49         printf("\n");
50
51 }
52
53 int main(){
54     ts_vesicle *vesicle;
55     ts_char *i,*j;
aad500 56     ts_uint tstep,n;
f4d6ca 57         ts_char *number;
aad500 58     struct dirent **list;
SP 59     int count;
f4d6ca 60     ts_fprintf(stdout,"TRISURF-NG v. %s, compiled on: %s %s.\n", TS_VERSION, __DATE__, __TIME__);
aad500 61     count=scandir(".",&list,0,alphasort);
SP 62     if(count<0){
63         fatal("Error, cannot open directory.",1);
64     }
65         tstep=0;
66     for(n=0;n<count;n++){
f4d6ca 67         struct dirent *ent;
aad500 68         ent=list[n];    
f4d6ca 69                 i=rindex(ent->d_name,'.');
002b70 70                 if(i==NULL) {
701026 71                 continue;
002b70 72         }
f4d6ca 73                 if(strcmp(i+1,"vtu")==0){
SP 74                     j=rindex(ent->d_name,'_');
75                     if(j==NULL) continue;
76                     number=strndup(j+1,j-i); 
77             quiet=1;
78                     ts_fprintf(stdout,"timestep: %u filename: %s\n",atoi(number),ent->d_name);
aad500 79             printf("%u ",atoi(number));
f4d6ca 80             vesicle=restoreVesicle(ent->d_name);
fcfb89 81             vesicle_calculate_ulm2(vesicle);
f4d6ca 82                         tstep++;
SP 83                     free(number);
701026 84             tape_free(vesicle->tape);
002b70 85             vesicle_free(vesicle);
aad500 86                 }
f4d6ca 87         }
701026 88     for (n = 0; n < count; n++)
SP 89       {
90           free(list[n]);
91       }
92     
aad500 93     free(list);
SP 94     return 0;
f4d6ca 95 }
SP 96