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" |
200815
|
10 |
#include "vertex.h" |
d7a113
|
11 |
#include "io.h" |
SP |
12 |
ts_bool run_simulation(ts_vesicle *vesicle, ts_uint mcsweeps, ts_uint inititer, ts_uint iterations){ |
|
13 |
ts_uint i, j; |
|
14 |
|
|
15 |
centermass(vesicle); |
|
16 |
cell_occupation(vesicle); |
|
17 |
ts_fprintf(stdout, "Starting simulation (first %d x %d MC sweeps will not be recorded on disk)\n", inititer, mcsweeps); |
|
18 |
for(i=0;i<inititer+iterations;i++){ |
|
19 |
for(j=0;j<mcsweeps;j++){ |
|
20 |
single_timestep(vesicle); |
|
21 |
} |
|
22 |
centermass(vesicle); |
|
23 |
cell_occupation(vesicle); |
|
24 |
if(i>inititer){ |
|
25 |
write_vertex_xml_file(vesicle,i-inititer); |
|
26 |
} |
|
27 |
} |
|
28 |
return TS_SUCCESS; |
|
29 |
} |
d7639a
|
30 |
|
SP |
31 |
ts_bool single_timestep(ts_vesicle *vesicle){ |
|
32 |
ts_bool retval; |
|
33 |
ts_double rnvec[3]; |
c58cd2
|
34 |
ts_uint i;// b; |
aec47d
|
35 |
for(i=0;i<vesicle->vlist->n;i++){ |
d7639a
|
36 |
rnvec[0]=drand48(); |
SP |
37 |
rnvec[1]=drand48(); |
|
38 |
rnvec[2]=drand48(); |
200815
|
39 |
vertex_taint(vesicle->vlist->vtx[i],1); |
SP |
40 |
// ts_fprintf(stdout, "Vertex %d should be tainted, level=%d.\n", i, vesicle->vlist->vtx[i]->locked); |
|
41 |
if(vertex_tainted(vesicle->vlist->vtx[i],1,1)){ |
|
42 |
ts_fprintf(stdout, "Vertex %d tainted, level=%d. Waiting....\n", i, vesicle->vlist->vtx[i]->locked); |
|
43 |
while(vertex_tainted(vesicle->vlist->vtx[i],1,1)); |
|
44 |
} |
aec47d
|
45 |
retval=single_verticle_timestep(vesicle,vesicle->vlist->vtx[i],rnvec); |
200815
|
46 |
vertex_untaint(vesicle->vlist->vtx[i],1); |
SP |
47 |
// ts_fprintf(stdout, "Vertex %d should be untainted, level=%d.\n", i, vesicle->vlist->vtx[i]->locked); |
d7639a
|
48 |
} |
SP |
49 |
|
b7c9b3
|
50 |
// ts_int cnt=0; |
c58cd2
|
51 |
/* |
142a67
|
52 |
for(i=0;i<vesicle->vlist->n;i++){ |
SP |
53 |
b=rand() % vesicle->blist->n; |
d7639a
|
54 |
//find a bond and return a pointer to a bond... |
SP |
55 |
//call single_bondflip_timestep... |
142a67
|
56 |
retval=single_bondflip_timestep(vesicle,vesicle->blist->bond[b],rnvec); |
b7c9b3
|
57 |
// if(retval==TS_SUCCESS) cnt++; |
d7639a
|
58 |
} |
b7c9b3
|
59 |
// printf("Bondflip success rate in one sweep: %d/%d=%e\n", cnt,vesicle->blist->n,(double)cnt/(double)vesicle->blist->n); |
c58cd2
|
60 |
*/ |
41a035
|
61 |
if(retval); |
d7639a
|
62 |
return TS_SUCCESS; |
SP |
63 |
} |
|
64 |
|
|
65 |
|
|
66 |
|