Trisurf Monte Carlo simulator
Samo Penic
2016-05-18 f4d6ca0fa0915bd12f42fd79c57f3d0aabff50f0
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){
37     vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
38     vesicle_volume(vesicle);
39     preparationSh(vesicle,getR0(vesicle));
40     calculateUlmComplex(vesicle);
41     ts_int i,j;
42     for(i=0;i<vesicle->sphHarmonics->l;i++){
43             for(j=0;j<2*i+1;j++){
44             printf("%e ", gsl_complex_abs2(vesicle->sphHarmonics->ulmComplex[i][j]));
45             }
46     }
47         printf("\n");
48
49 }
50
51 int main(){
52     ts_vesicle *vesicle;
53     ts_char *i,*j;
54     ts_uint tstep;
55         ts_char *number;
56     ts_fprintf(stdout,"TRISURF-NG v. %s, compiled on: %s %s.\n", TS_VERSION, __DATE__, __TIME__);
57     ts_fprintf(stdout,"Programming done by: Samo Penic and Miha Fosnaric\n");
58     ts_fprintf(stdout,"Released under terms of GPLv3\n");
59     ts_fprintf(stdout,"Starting program...\n\n");
60     DIR *dir = opendir(".");
61     if(dir){
62         struct dirent *ent;
63             tstep=0;
64         while((ent = readdir(dir)) != NULL)
65         {
66                 i=rindex(ent->d_name,'.');
67                 if(i==NULL) continue;
68                 if(strcmp(i+1,"vtu")==0){
69                     j=rindex(ent->d_name,'_');
70                     if(j==NULL) continue;
71                     number=strndup(j+1,j-i); 
72             quiet=1;
73                     ts_fprintf(stdout,"timestep: %u filename: %s\n",atoi(number),ent->d_name);
74             vesicle=restoreVesicle(ent->d_name);
75             vesicle_calculate_ulm2(vesicle);
76                         tstep++;
77             //vesicle_free(vesicle);
78                     free(number);
79                 }  
80         }
81     }
82     free(dir);
83
84
85
86
87 return 0;
88 }
89