commit | author | age
|
d7639a
|
1 |
#include<stdlib.h> |
SP |
2 |
#include<stdio.h> |
aec47d
|
3 |
#include<math.h> |
SP |
4 |
//#include "io.h" |
|
5 |
#include "general.h" |
|
6 |
#include "timestep.h" |
|
7 |
#include "vertexmove.h" |
30ee9c
|
8 |
#include "bondflip.h" |
d7a113
|
9 |
#include "frame.h" |
SP |
10 |
#include "io.h" |
|
11 |
ts_bool run_simulation(ts_vesicle *vesicle, ts_uint mcsweeps, ts_uint inititer, ts_uint iterations){ |
|
12 |
ts_uint i, j; |
|
13 |
|
|
14 |
centermass(vesicle); |
|
15 |
cell_occupation(vesicle); |
|
16 |
ts_fprintf(stdout, "Starting simulation (first %d x %d MC sweeps will not be recorded on disk)\n", inititer, mcsweeps); |
|
17 |
for(i=0;i<inititer+iterations;i++){ |
|
18 |
for(j=0;j<mcsweeps;j++){ |
|
19 |
single_timestep(vesicle); |
|
20 |
} |
|
21 |
centermass(vesicle); |
|
22 |
cell_occupation(vesicle); |
|
23 |
if(i>inititer){ |
|
24 |
write_vertex_xml_file(vesicle,i-inititer); |
|
25 |
} |
|
26 |
} |
|
27 |
return TS_SUCCESS; |
|
28 |
} |
d7639a
|
29 |
|
SP |
30 |
ts_bool single_timestep(ts_vesicle *vesicle){ |
|
31 |
ts_bool retval; |
|
32 |
ts_double rnvec[3]; |
dcf17d
|
33 |
ts_uint i, b; |
aec47d
|
34 |
for(i=0;i<vesicle->vlist->n;i++){ |
d7639a
|
35 |
rnvec[0]=drand48(); |
SP |
36 |
rnvec[1]=drand48(); |
|
37 |
rnvec[2]=drand48(); |
aec47d
|
38 |
retval=single_verticle_timestep(vesicle,vesicle->vlist->vtx[i],rnvec); |
d7639a
|
39 |
} |
SP |
40 |
|
b7c9b3
|
41 |
// ts_int cnt=0; |
142a67
|
42 |
for(i=0;i<vesicle->vlist->n;i++){ |
dcf17d
|
43 |
//why is rnvec needed in bondflip? |
SP |
44 |
/* rnvec[0]=drand48(); |
|
45 |
rnvec[1]=drand48(); |
|
46 |
rnvec[2]=drand48(); |
|
47 |
*/ |
142a67
|
48 |
b=rand() % vesicle->blist->n; |
d7639a
|
49 |
//find a bond and return a pointer to a bond... |
SP |
50 |
//call single_bondflip_timestep... |
142a67
|
51 |
retval=single_bondflip_timestep(vesicle,vesicle->blist->bond[b],rnvec); |
b7c9b3
|
52 |
// if(retval==TS_SUCCESS) cnt++; |
d7639a
|
53 |
} |
b7c9b3
|
54 |
// printf("Bondflip success rate in one sweep: %d/%d=%e\n", cnt,vesicle->blist->n,(double)cnt/(double)vesicle->blist->n); |
41a035
|
55 |
if(retval); |
d7639a
|
56 |
return TS_SUCCESS; |
SP |
57 |
} |
|
58 |
|
|
59 |
|
|
60 |
|