Trisurf Monte Carlo simulator
Samo Penic
2016-07-03 22a18c527943300122e3117d5d81877c9ab6fa04
commit | author | age
22a18c 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 "stats.h"
17 #include "sh.h"
18 #include "shcomplex.h"
19 #include "dumpstate.h"
20 #include "restore.h"
21 #include <string.h>
22 #include <getopt.h>
23 #include <sys/stat.h>
24 #include <sys/types.h>
25 #include <dirent.h>
26 #include <errno.h>
27 #include <snapshot.h>
28 #include<gsl/gsl_complex.h>
29 #include<gsl/gsl_complex_math.h>
30
31
32 ts_vesicle *restoreVesicle(char *filename){
33     ts_vesicle *vesicle = parseDump(filename);
34     return vesicle;
35 }
36
37 void vesicle_calculate_ulm2(ts_vesicle *vesicle){
38     //complex_sph_free(vesicle->sphHarmonics);
39
40     //vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
41     vesicle_volume(vesicle);
42     preparationSh(vesicle,getR0(vesicle));
43     calculateUlmComplex(vesicle);
44     ts_int i,j;
45     for(i=0;i<vesicle->sphHarmonics->l;i++){
46             for(j=i;j<2*i+1;j++){
47             printf("%e ", gsl_complex_abs2(vesicle->sphHarmonics->ulmComplex[i][j]));
48             }
49     }
50         printf("\n");
51
52 }
53
54 int main(){
55     ts_vesicle *vesicle;
56     ts_char *i,*j;
57     ts_uint tstep,n;
58         ts_char *number;
59     struct dirent **list;
60     ts_double l1,l2,l3;
61     int count;
62     ts_fprintf(stderr,"TRISURF-NG v. %s, compiled on: %s %s.\n", TS_VERSION, __DATE__, __TIME__);
63
64     fprintf(stdout, "OuterLoop Volume Area lamdba1 lambda2 lambda3 Nb/Ncb\n");
65
66
67     count=scandir(".",&list,0,alphasort);
68     if(count<0){
69         fatal("Error, cannot open directory.",1);
70     }
71         tstep=0;
72     for(n=0;n<count;n++){
73         struct dirent *ent;
74         ent=list[n];    
75                 i=rindex(ent->d_name,'.');
76                 if(i==NULL) {
77                 continue;
78         }
79                 if(strcmp(i+1,"vtu")==0){
80                     j=rindex(ent->d_name,'_');
81                     if(j==NULL) continue;
82                     number=strndup(j+1,j-i); 
83             quiet=1;
84                     ts_fprintf(stdout,"timestep: %u filename: %s\n",atoi(number),ent->d_name);
85 //            printf("%u ",atoi(number));
86             vesicle=restoreVesicle(ent->d_name);
87 //            vesicle_calculate_ulm2(vesicle);
88             vesicle_volume(vesicle);
89             vesicle_area(vesicle);
90             gyration_eigen(vesicle,&l1,&l2,&l3);
91             fprintf(stdout,"%d %.17e %.17e %.17e %.17e %.17e\n",atoi(number),vesicle->volume, vesicle->area,l1,l2,l3),
92                         tstep++;
93
94                     free(number);
95             tape_free(vesicle->tape);
96             vesicle_free(vesicle);
97                 }
98         }
99     for (n = 0; n < count; n++)
100       {
101           free(list[n]);
102       }
103     
104     free(list);
105     return 0;
106 }
107