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