commit | author | age
|
aec47d
|
1 |
#include<stdlib.h> |
SP |
2 |
#include<math.h> |
|
3 |
#include "general.h" |
|
4 |
#include "vertex.h" |
|
5 |
#include "bond.h" |
|
6 |
#include "triangle.h" |
|
7 |
#include "vesicle.h" |
|
8 |
#include "energy.h" |
|
9 |
#include "timestep.h" |
|
10 |
#include "cell.h" |
|
11 |
//#include "io.h" |
9166cb
|
12 |
#include "io.h" |
aec47d
|
13 |
#include<stdio.h> |
SP |
14 |
#include "vertexmove.h" |
1ad6d1
|
15 |
#include <string.h> |
43c042
|
16 |
#include "constvol.h" |
aec47d
|
17 |
|
fedf2b
|
18 |
ts_bool single_verticle_timestep(ts_vesicle *vesicle,ts_vertex *vtx,ts_double *rn){ |
aec47d
|
19 |
ts_uint i; |
SP |
20 |
ts_double dist; |
|
21 |
ts_bool retval; |
|
22 |
ts_uint cellidx; |
fbcbdf
|
23 |
ts_double delta_energy, delta_energy_cv,oenergy,dvol=0.0; |
ed31fe
|
24 |
ts_double costheta,sintheta,phi,r; |
1ad6d1
|
25 |
//This will hold all the information of vtx and its neighbours |
958e0e
|
26 |
ts_vertex backupvtx[20], *constvol_vtx_moved=NULL, *constvol_vtx_backup=NULL; |
dcd350
|
27 |
memcpy((void *)&backupvtx[0],(void *)vtx,sizeof(ts_vertex)); |
a63f17
|
28 |
|
SP |
29 |
//Some stupid tests for debugging cell occupation! |
|
30 |
/* cellidx=vertex_self_avoidance(vesicle, vtx); |
|
31 |
if(vesicle->clist->cell[cellidx]==vtx->cell){ |
|
32 |
fprintf(stderr,"Idx match!\n"); |
|
33 |
} else { |
|
34 |
fprintf(stderr,"***** Idx don't match!\n"); |
|
35 |
fatal("ENding.",1); |
|
36 |
} |
|
37 |
*/ |
|
38 |
|
352fad
|
39 |
//temporarly moving the vertex |
672ae4
|
40 |
// vtx->x=vtx->x+vesicle->stepsize*(2.0*rn[0]-1.0); |
SP |
41 |
// vtx->y=vtx->y+vesicle->stepsize*(2.0*rn[1]-1.0); |
|
42 |
// vtx->z=vtx->z+vesicle->stepsize*(2.0*rn[2]-1.0); |
|
43 |
|
ed31fe
|
44 |
//random move in a sphere with radius stepsize: |
M |
45 |
r=vesicle->stepsize*rn[0]; |
|
46 |
phi=rn[1]*2*M_PI; |
|
47 |
costheta=2*rn[2]-1; |
|
48 |
sintheta=sqrt(1-pow(costheta,2)); |
672ae4
|
49 |
vtx->x=vtx->x+r*sintheta*cos(phi); |
SP |
50 |
vtx->y=vtx->y+r*sintheta*sin(phi); |
|
51 |
vtx->z=vtx->z+r*costheta; |
|
52 |
|
|
53 |
|
a63f17
|
54 |
//distance with neighbours check |
8f6a69
|
55 |
for(i=0;i<vtx->neigh_no;i++){ |
352fad
|
56 |
dist=vtx_distance_sq(vtx,vtx->neigh[i]); |
8f6a69
|
57 |
if(dist<1.0 || dist>vesicle->dmax) { |
dcd350
|
58 |
vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex)); |
8f6a69
|
59 |
return TS_FAIL; |
SP |
60 |
} |
aec47d
|
61 |
} |
304510
|
62 |
|
M |
63 |
// Distance with grafted poly-vertex check: |
|
64 |
if(vtx->grafted_poly!=NULL){ |
|
65 |
dist=vtx_distance_sq(vtx,vtx->grafted_poly->vlist->vtx[0]); |
|
66 |
if(dist<1.0 || dist>vesicle->dmax) { |
|
67 |
vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex)); |
|
68 |
return TS_FAIL; |
|
69 |
} |
|
70 |
} |
|
71 |
|
fe24d2
|
72 |
// TODO: Maybe faster if checks only nucleus-neighboring cells |
M |
73 |
// Nucleus penetration check: |
|
74 |
if (vtx->x*vtx->x + vtx->y*vtx->y + vtx->z*vtx->z < vesicle->R_nucleus){ |
|
75 |
vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex)); |
|
76 |
return TS_FAIL; |
|
77 |
} |
|
78 |
|
|
79 |
//self avoidance check with distant vertices |
|
80 |
cellidx=vertex_self_avoidance(vesicle, vtx); |
|
81 |
//check occupation number |
|
82 |
retval=cell_occupation_number_and_internal_proximity(vesicle->clist,cellidx,vtx); |
|
83 |
|
aec47d
|
84 |
if(retval==TS_FAIL){ |
dcd350
|
85 |
vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex)); |
aec47d
|
86 |
return TS_FAIL; |
SP |
87 |
} |
1ad6d1
|
88 |
|
SP |
89 |
|
352fad
|
90 |
//if all the tests are successful, then energy for vtx and neighbours is calculated |
1ad6d1
|
91 |
for(i=0;i<vtx->neigh_no;i++){ |
dcd350
|
92 |
memcpy((void *)&backupvtx[i+1],(void *)vtx->neigh[i],sizeof(ts_vertex)); |
1ad6d1
|
93 |
} |
aec47d
|
94 |
|
fbcbdf
|
95 |
if(vesicle->pswitch == 1 || vesicle->tape->constvolswitch==1){ |
414b8a
|
96 |
for(i=0;i<vtx->tristar_no;i++) dvol-=vtx->tristar[i]->volume; |
M |
97 |
}; |
a63f17
|
98 |
|
aec47d
|
99 |
delta_energy=0; |
43c042
|
100 |
|
fbcbdf
|
101 |
|
SP |
102 |
// fprintf(stderr,"Success for now.\n"); |
43c042
|
103 |
|
aec47d
|
104 |
//update the normals of triangles that share bead i. |
8f6a69
|
105 |
for(i=0;i<vtx->tristar_no;i++) triangle_normal_vector(vtx->tristar[i]); |
a63f17
|
106 |
oenergy=vtx->energy; |
aec47d
|
107 |
energy_vertex(vtx); |
a63f17
|
108 |
delta_energy=vtx->xk*(vtx->energy - oenergy); |
aec47d
|
109 |
//the same is done for neighbouring vertices |
8f6a69
|
110 |
for(i=0;i<vtx->neigh_no;i++){ |
SP |
111 |
oenergy=vtx->neigh[i]->energy; |
|
112 |
energy_vertex(vtx->neigh[i]); |
|
113 |
delta_energy+=vtx->neigh[i]->xk*(vtx->neigh[i]->energy-oenergy); |
aec47d
|
114 |
} |
414b8a
|
115 |
|
fbcbdf
|
116 |
if(vesicle->pswitch == 1 || vesicle->tape->constvolswitch == 1){ |
414b8a
|
117 |
for(i=0;i<vtx->tristar_no;i++) dvol+=vtx->tristar[i]->volume; |
fbcbdf
|
118 |
if(vesicle->pswitch==1) delta_energy-=vesicle->pressure*dvol; |
414b8a
|
119 |
}; |
43c042
|
120 |
|
fbcbdf
|
121 |
if(vesicle->tape->constvolswitch == 1){ |
SP |
122 |
retval=constvolume(vesicle, vtx, -dvol, &delta_energy_cv, &constvol_vtx_moved,&constvol_vtx_backup); |
|
123 |
if(retval==TS_FAIL){ // if we couldn't move the vertex to assure constant volume |
|
124 |
vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex)); |
|
125 |
for(i=0;i<vtx->neigh_no;i++){ |
|
126 |
vtx->neigh[i]=memcpy((void *)vtx->neigh[i],(void *)&backupvtx[i+1],sizeof(ts_vertex)); |
|
127 |
} |
|
128 |
for(i=0;i<vtx->tristar_no;i++) triangle_normal_vector(vtx->tristar[i]); |
|
129 |
return TS_FAIL; |
|
130 |
} |
|
131 |
delta_energy+=delta_energy_cv; |
|
132 |
} |
304510
|
133 |
/* No poly-bond energy for now! |
fedf2b
|
134 |
if(vtx->grafted_poly!=NULL){ |
M |
135 |
delta_energy+= |
|
136 |
(pow(sqrt(vtx_distance_sq(vtx, vtx->grafted_poly->vlist->vtx[0])-1),2)- |
|
137 |
pow(sqrt(vtx_distance_sq(&backupvtx[0], vtx->grafted_poly->vlist->vtx[0])-1),2)) *vtx->grafted_poly->k; |
|
138 |
} |
304510
|
139 |
*/ |
314f2d
|
140 |
// fprintf(stderr, "DE=%f\n",delta_energy); |
aec47d
|
141 |
//MONTE CARLOOOOOOOO |
SP |
142 |
if(delta_energy>=0){ |
|
143 |
#ifdef TS_DOUBLE_DOUBLE |
|
144 |
if(exp(-delta_energy)< drand48() ) |
|
145 |
#endif |
|
146 |
#ifdef TS_DOUBLE_FLOAT |
|
147 |
if(expf(-delta_energy)< (ts_float)drand48()) |
|
148 |
#endif |
|
149 |
#ifdef TS_DOUBLE_LONGDOUBLE |
|
150 |
if(expl(-delta_energy)< (ts_ldouble)drand48()) |
|
151 |
#endif |
|
152 |
{ |
|
153 |
//not accepted, reverting changes |
fbcbdf
|
154 |
// fprintf(stderr,"MC failed\n"); |
dcd350
|
155 |
vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex)); |
1ad6d1
|
156 |
for(i=0;i<vtx->neigh_no;i++){ |
a63f17
|
157 |
vtx->neigh[i]=memcpy((void *)vtx->neigh[i],(void *)&backupvtx[i+1],sizeof(ts_vertex)); |
1ad6d1
|
158 |
} |
SP |
159 |
|
aec47d
|
160 |
//update the normals of triangles that share bead i. |
dcd350
|
161 |
for(i=0;i<vtx->tristar_no;i++) triangle_normal_vector(vtx->tristar[i]); |
1ad6d1
|
162 |
|
43c042
|
163 |
if(vesicle->tape->constvolswitch == 1){ |
958e0e
|
164 |
constvolumerestore(constvol_vtx_moved,constvol_vtx_backup); |
43c042
|
165 |
} |
aec47d
|
166 |
return TS_FAIL; |
SP |
167 |
} |
|
168 |
} |
2b14da
|
169 |
//accepted |
fbcbdf
|
170 |
// fprintf(stderr,"MC accepted\n"); |
a63f17
|
171 |
// oldcellidx=vertex_self_avoidance(vesicle, &backupvtx[0]); |
SP |
172 |
if(vtx->cell!=vesicle->clist->cell[cellidx]){ |
|
173 |
retval=cell_add_vertex(vesicle->clist->cell[cellidx],vtx); |
|
174 |
// if(retval==TS_SUCCESS) cell_remove_vertex(vesicle->clist->cell[oldcellidx],vtx); |
|
175 |
if(retval==TS_SUCCESS) cell_remove_vertex(backupvtx[0].cell,vtx); |
|
176 |
|
|
177 |
} |
2b14da
|
178 |
|
43c042
|
179 |
if(vesicle->tape->constvolswitch == 1){ |
fbcbdf
|
180 |
constvolumeaccept(vesicle,constvol_vtx_moved,constvol_vtx_backup); |
43c042
|
181 |
} |
a63f17
|
182 |
// if(oldcellidx); |
aec47d
|
183 |
//END MONTE CARLOOOOOOO |
SP |
184 |
return TS_SUCCESS; |
|
185 |
} |
|
186 |
|
fedf2b
|
187 |
|
M |
188 |
ts_bool single_poly_vertex_move(ts_vesicle *vesicle,ts_poly *poly,ts_vertex *vtx,ts_double *rn){ |
|
189 |
ts_uint i; |
|
190 |
ts_bool retval; |
|
191 |
ts_uint cellidx; |
304510
|
192 |
// ts_double delta_energy; |
fedf2b
|
193 |
ts_double costheta,sintheta,phi,r; |
304510
|
194 |
ts_double dist; |
fedf2b
|
195 |
//This will hold all the information of vtx and its neighbours |
M |
196 |
ts_vertex backupvtx; |
304510
|
197 |
// ts_bond backupbond[2]; |
fedf2b
|
198 |
memcpy((void *)&backupvtx,(void *)vtx,sizeof(ts_vertex)); |
M |
199 |
|
|
200 |
//random move in a sphere with radius stepsize: |
|
201 |
r=vesicle->stepsize*rn[0]; |
|
202 |
phi=rn[1]*2*M_PI; |
|
203 |
costheta=2*rn[2]-1; |
|
204 |
sintheta=sqrt(1-pow(costheta,2)); |
|
205 |
vtx->x=vtx->x+r*sintheta*cos(phi); |
|
206 |
vtx->y=vtx->y+r*sintheta*sin(phi); |
|
207 |
vtx->z=vtx->z+r*costheta; |
|
208 |
|
|
209 |
|
|
210 |
//distance with neighbours check |
304510
|
211 |
for(i=0;i<vtx->neigh_no;i++){ |
M |
212 |
dist=vtx_distance_sq(vtx,vtx->neigh[i]); |
|
213 |
if(dist<1.0 || dist>vesicle->dmax) { |
|
214 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
215 |
return TS_FAIL; |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
// Distance with grafted vesicle-vertex check: |
|
220 |
if(vtx==poly->vlist->vtx[0]){ |
|
221 |
dist=vtx_distance_sq(vtx,poly->grafted_vtx); |
|
222 |
if(dist<1.0 || dist>vesicle->dmax) { |
|
223 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
224 |
return TS_FAIL; |
|
225 |
} |
|
226 |
} |
|
227 |
|
fedf2b
|
228 |
|
M |
229 |
//self avoidance check with distant vertices |
|
230 |
cellidx=vertex_self_avoidance(vesicle, vtx); |
|
231 |
//check occupation number |
|
232 |
retval=cell_occupation_number_and_internal_proximity(vesicle->clist,cellidx,vtx); |
|
233 |
|
|
234 |
if(retval==TS_FAIL){ |
|
235 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
236 |
return TS_FAIL; |
|
237 |
} |
|
238 |
|
|
239 |
|
|
240 |
//if all the tests are successful, then energy for vtx and neighbours is calculated |
304510
|
241 |
/* Energy ignored for now! |
fedf2b
|
242 |
delta_energy=0; |
M |
243 |
for(i=0;i<vtx->bond_no;i++){ |
|
244 |
memcpy((void *)&backupbond[i],(void *)vtx->bond[i],sizeof(ts_bond)); |
|
245 |
|
|
246 |
vtx->bond[i]->bond_length=sqrt(vtx_distance_sq(vtx->bond[i]->vtx1,vtx->bond[i]->vtx2)); |
|
247 |
bond_energy(vtx->bond[i],poly); |
|
248 |
delta_energy+= vtx->bond[i]->energy - backupbond[i].energy; |
|
249 |
} |
|
250 |
|
|
251 |
if(vtx==poly->vlist->vtx[0]){ |
|
252 |
delta_energy+= |
|
253 |
(pow(sqrt(vtx_distance_sq(vtx, poly->grafted_vtx)-1),2)- |
|
254 |
pow(sqrt(vtx_distance_sq(&backupvtx, poly->grafted_vtx)-1),2)) *poly->k; |
|
255 |
|
|
256 |
} |
|
257 |
|
|
258 |
|
|
259 |
if(delta_energy>=0){ |
|
260 |
#ifdef TS_DOUBLE_DOUBLE |
|
261 |
if(exp(-delta_energy)< drand48() ) |
|
262 |
#endif |
|
263 |
#ifdef TS_DOUBLE_FLOAT |
|
264 |
if(expf(-delta_energy)< (ts_float)drand48()) |
|
265 |
#endif |
|
266 |
#ifdef TS_DOUBLE_LONGDOUBLE |
|
267 |
if(expl(-delta_energy)< (ts_ldouble)drand48()) |
|
268 |
#endif |
|
269 |
{ |
|
270 |
//not accepted, reverting changes |
|
271 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
272 |
for(i=0;i<vtx->bond_no;i++){ |
|
273 |
vtx->bond[i]=memcpy((void *)vtx->bond[i],(void *)&backupbond[i],sizeof(ts_bond)); |
|
274 |
} |
|
275 |
|
|
276 |
return TS_FAIL; |
|
277 |
} |
|
278 |
} |
304510
|
279 |
*/ |
fedf2b
|
280 |
|
M |
281 |
// oldcellidx=vertex_self_avoidance(vesicle, &backupvtx[0]); |
|
282 |
if(vtx->cell!=vesicle->clist->cell[cellidx]){ |
|
283 |
retval=cell_add_vertex(vesicle->clist->cell[cellidx],vtx); |
|
284 |
// if(retval==TS_SUCCESS) cell_remove_vertex(vesicle->clist->cell[oldcellidx],vtx); |
|
285 |
if(retval==TS_SUCCESS) cell_remove_vertex(backupvtx.cell,vtx); |
|
286 |
} |
|
287 |
// if(oldcellidx); |
|
288 |
//END MONTE CARLOOOOOOO |
|
289 |
return TS_SUCCESS; |
|
290 |
} |
58230a
|
291 |
|
M |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
ts_bool single_filament_vertex_move(ts_vesicle *vesicle,ts_poly *poly,ts_vertex *vtx,ts_double *rn){ |
|
296 |
ts_uint i; |
|
297 |
ts_bool retval; |
|
298 |
ts_uint cellidx; |
b30f45
|
299 |
ts_double delta_energy; |
58230a
|
300 |
ts_double costheta,sintheta,phi,r; |
M |
301 |
ts_double dist[2]; |
|
302 |
//This will hold all the information of vtx and its neighbours |
b30f45
|
303 |
ts_vertex backupvtx,backupneigh[2]; |
58230a
|
304 |
ts_bond backupbond[2]; |
b30f45
|
305 |
|
M |
306 |
//backup vertex: |
58230a
|
307 |
memcpy((void *)&backupvtx,(void *)vtx,sizeof(ts_vertex)); |
M |
308 |
|
|
309 |
//random move in a sphere with radius stepsize: |
|
310 |
r=vesicle->stepsize*rn[0]; |
|
311 |
phi=rn[1]*2*M_PI; |
|
312 |
costheta=2*rn[2]-1; |
|
313 |
sintheta=sqrt(1-pow(costheta,2)); |
|
314 |
vtx->x=vtx->x+r*sintheta*cos(phi); |
|
315 |
vtx->y=vtx->y+r*sintheta*sin(phi); |
|
316 |
vtx->z=vtx->z+r*costheta; |
|
317 |
|
|
318 |
|
|
319 |
//distance with neighbours check |
|
320 |
for(i=0;i<vtx->bond_no;i++){ |
|
321 |
dist[i]=vtx_distance_sq(vtx->bond[i]->vtx1,vtx->bond[i]->vtx2); |
|
322 |
if(dist[i]<1.0 || dist[i]>vesicle->dmax) { |
|
323 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
324 |
return TS_FAIL; |
|
325 |
} |
|
326 |
} |
|
327 |
|
fe24d2
|
328 |
// TODO: Maybe faster if checks only nucleus-neighboring cells |
M |
329 |
// Nucleus penetration check: |
|
330 |
if (vtx->x*vtx->x + vtx->y*vtx->y + vtx->z*vtx->z < vesicle->R_nucleus){ |
|
331 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
332 |
return TS_FAIL; |
|
333 |
} |
|
334 |
|
58230a
|
335 |
|
M |
336 |
//self avoidance check with distant vertices |
|
337 |
cellidx=vertex_self_avoidance(vesicle, vtx); |
|
338 |
//check occupation number |
|
339 |
retval=cell_occupation_number_and_internal_proximity(vesicle->clist,cellidx,vtx); |
|
340 |
if(retval==TS_FAIL){ |
|
341 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
|
342 |
return TS_FAIL; |
|
343 |
} |
|
344 |
|
|
345 |
//backup bonds |
|
346 |
for(i=0;i<vtx->bond_no;i++){ |
|
347 |
memcpy(&backupbond[i],vtx->bond[i], sizeof(ts_bond)); |
|
348 |
vtx->bond[i]->bond_length=sqrt(dist[i]); |
|
349 |
bond_vector(vtx->bond[i]); |
b30f45
|
350 |
} |
M |
351 |
|
|
352 |
//backup neighboring vertices: |
|
353 |
for(i=0;i<vtx->neigh_no;i++){ |
|
354 |
memcpy(&backupneigh[i],vtx->neigh[i], sizeof(ts_vertex)); |
58230a
|
355 |
} |
M |
356 |
|
|
357 |
//if all the tests are successful, then energy for vtx and neighbours is calculated |
b30f45
|
358 |
delta_energy=0; |
M |
359 |
|
|
360 |
if(vtx->bond_no == 2){ |
|
361 |
vtx->energy = -(vtx->bond[0]->x*vtx->bond[1]->x + vtx->bond[0]->y*vtx->bond[1]->y + vtx->bond[0]->z*vtx->bond[1]->z)/vtx->bond[0]->bond_length/vtx->bond[1]->bond_length; |
|
362 |
delta_energy += vtx->energy - backupvtx.energy; |
58230a
|
363 |
} |
M |
364 |
|
b30f45
|
365 |
for(i=0;i<vtx->neigh_no;i++){ |
M |
366 |
if(vtx->neigh[i]->bond_no == 2){ |
|
367 |
vtx->neigh[i]->energy = -(vtx->neigh[i]->bond[0]->x*vtx->neigh[i]->bond[1]->x + vtx->neigh[i]->bond[0]->y*vtx->neigh[i]->bond[1]->y + vtx->neigh[i]->bond[0]->z*vtx->neigh[i]->bond[1]->z)/vtx->neigh[i]->bond[0]->bond_length/vtx->neigh[i]->bond[1]->bond_length; |
|
368 |
delta_energy += vtx->neigh[i]->energy - backupneigh[i].energy; |
|
369 |
} |
58230a
|
370 |
} |
M |
371 |
|
b30f45
|
372 |
// poly->k is filament persistence length (in units l_min) |
M |
373 |
delta_energy *= poly->k; |
58230a
|
374 |
|
M |
375 |
if(delta_energy>=0){ |
|
376 |
#ifdef TS_DOUBLE_DOUBLE |
|
377 |
if(exp(-delta_energy)< drand48() ) |
|
378 |
#endif |
|
379 |
#ifdef TS_DOUBLE_FLOAT |
|
380 |
if(expf(-delta_energy)< (ts_float)drand48()) |
|
381 |
#endif |
|
382 |
#ifdef TS_DOUBLE_LONGDOUBLE |
|
383 |
if(expl(-delta_energy)< (ts_ldouble)drand48()) |
|
384 |
#endif |
|
385 |
{ |
|
386 |
//not accepted, reverting changes |
|
387 |
vtx=memcpy((void *)vtx,(void *)&backupvtx,sizeof(ts_vertex)); |
b30f45
|
388 |
for(i=0;i<vtx->neigh_no;i++){ |
M |
389 |
memcpy(vtx->neigh[i],&backupneigh[i],sizeof(ts_vertex)); |
|
390 |
} |
58230a
|
391 |
for(i=0;i<vtx->bond_no;i++){ |
b30f45
|
392 |
vtx->bond[i]=memcpy((void *)vtx->bond[i],(void *)&backupbond[i],sizeof(ts_bond)); |
58230a
|
393 |
} |
M |
394 |
|
|
395 |
return TS_FAIL; |
|
396 |
} |
|
397 |
} |
|
398 |
|
b30f45
|
399 |
|
58230a
|
400 |
// oldcellidx=vertex_self_avoidance(vesicle, &backupvtx[0]); |
M |
401 |
if(vtx->cell!=vesicle->clist->cell[cellidx]){ |
|
402 |
retval=cell_add_vertex(vesicle->clist->cell[cellidx],vtx); |
|
403 |
// if(retval==TS_SUCCESS) cell_remove_vertex(vesicle->clist->cell[oldcellidx],vtx); |
|
404 |
if(retval==TS_SUCCESS) cell_remove_vertex(backupvtx.cell,vtx); |
|
405 |
} |
|
406 |
// if(oldcellidx); |
|
407 |
//END MONTE CARLOOOOOOO |
|
408 |
return TS_SUCCESS; |
|
409 |
} |