Trisurf Monte Carlo simulator
Samo Penic
2016-07-09 9e5a9c0f110d3ed02751c9d44a3716caa6010a70
commit | author | age
7f6076 1 /* vim: set ts=4 sts=4 sw=4 noet : */
a0f0a3 2 #include<stdio.h>
S 3 #include<math.h>
4 #include "general.h"
5 #include "vertex.h"
6 #include "bond.h"
7 #include "triangle.h"
8 #include "cell.h"
9 #include "vesicle.h"
10 #include "io.h"
11 #include "initial_distribution.h"
12 #include "frame.h"
13 #include "timestep.h"
14 #include "sh.h"
15
16 /** Entrance function to the program
17   * @param argv is a number of parameters used in program call (including the program name
18   * @param argc is a pointer to strings (character arrays) which holds the arguments
19   * @returns returns 0 on success, any other number on fail.
20 */
21 ts_bool saveAvgUlm2(ts_vesicle *vesicle);
22 int main(int argv, char *argc[]){
23 ts_uint i,j;
24 ts_vesicle *vesicle;
25 ts_double r0;
26 vesicle=initial_distribution_dipyramid(17,60,60,60,0.15);
27 //parsetape(vesicle,&i);
28
29 //these four must come from parsetype!
30 vesicle->dmax=1.67*1.67;
31 vesicle->stepsize=0.15;
32 vesicle->clist->max_occupancy=8;
33 vesicle->bending_rigidity=30.0*30.0;
34 for(i=0;i<vesicle->vlist->n;i++){
35     vesicle->vlist->vtx[i]->xk=vesicle->bending_rigidity;
36 }
37 //fprintf(stderr,"xk=%f",vesicle->bending_rigidity);
38
39     centermass(vesicle);
40 vesicle->sphHarmonics=sph_init(vesicle->vlist, 21);
41
42 vesicle_volume(vesicle);
43 r0=getR0(vesicle);
44
45 preparationSh(vesicle,r0);
46 calculateYlmi(vesicle);
47 calculateUlm(vesicle);
37d14a 48 ts_double vmsr,bfsr;
a0f0a3 49 for(i=0;i<500;i++){
S 50     cell_occupation(vesicle);
51     for(j=0;j<1000;j++){
37d14a 52         single_timestep(vesicle,&vmsr,&bfsr);
a0f0a3 53     }    
S 54     centermass(vesicle);
55     fprintf(stderr, "Preloop %d completed.\n",i+1);
56 }
57
58 vesicle->bending_rigidity=25.0;
59 for(i=0;i<vesicle->vlist->n;i++){
60     vesicle->vlist->vtx[i]->xk=vesicle->bending_rigidity;
61 }
62
63
64 for(i=0;i<10000;i++){
65     cell_occupation(vesicle);
66     for(j=0;j<1000;j++){
37d14a 67         single_timestep(vesicle,&vmsr,&bfsr);
a0f0a3 68     }    
S 69     centermass(vesicle);
70     vesicle_volume(vesicle);
71     r0=getR0(vesicle);
72
73     preparationSh(vesicle,r0);
74     calculateYlmi(vesicle);
75     calculateUlm(vesicle);
76
77     storeUlm2(vesicle);
78     saveAvgUlm2(vesicle);
79
80     write_vertex_xml_file(vesicle,i);
81     fprintf(stderr, "Loop %d completed.\n",i+1);
82 }
83 write_master_xml_file("test.pvd");
84 write_dout_fcompat_file(vesicle,"dout");
85 vesicle_free(vesicle);
86
87 return 0; //program finished perfectly ok. We return 0.
88 }
89
90