commit | author | age
|
b5cd8c
|
1 |
#include <stdlib.h> |
SP |
2 |
#include "general.h" |
|
3 |
#include "vertex.h" |
|
4 |
#include "cell.h" |
85898e
|
5 |
#include <math.h> |
b5cd8c
|
6 |
char plugin_name[] = "Plane confimenent"; |
SP |
7 |
char plugin_description[]= "Confines vesicle between two planes d/2 above z=0 and d/2 below z=0. The plates squeeze vesicle with some predefined force."; |
|
8 |
char plugin_author[] = "SAMO PENIC"; |
|
9 |
|
|
10 |
ts_plugin_details *init (){ |
|
11 |
ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details)); |
|
12 |
details->name = plugin_name; |
85898e
|
13 |
// details->data = (void *)calloc(1,sizeof(ts_double)); |
b5cd8c
|
14 |
return details; |
SP |
15 |
} |
|
16 |
|
|
17 |
ts_bool vm_hard_constraint(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *ovtx){ |
|
18 |
|
|
19 |
// plane confinement check whether the new position of vertex will be out of bounds |
|
20 |
if(vesicle->tape->plane_confinement_switch){ |
|
21 |
if(vtx->z>vesicle->confinement_plane.z_max || vtx->z<vesicle->confinement_plane.z_min){ |
|
22 |
return TS_FAIL; |
|
23 |
} |
|
24 |
} |
|
25 |
return TS_SUCCESS; |
|
26 |
} |
|
27 |
|
85898e
|
28 |
|
SP |
29 |
ts_double vm_energy_after_execute(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *backupvtx){ |
|
30 |
// plane confinement energy due to compressing force |
|
31 |
ts_double delta_energy=0; |
|
32 |
if(vesicle->tape->plane_confinement_switch){ |
|
33 |
if(vesicle->confinement_plane.force_switch){ |
|
34 |
//substract old energy |
|
35 |
if(abs(vesicle->tape->plane_d/2.0-vesicle->confinement_plane.z_max)>1e-10) { |
|
36 |
delta_energy-=vesicle->tape->plane_F / pow(vesicle->confinement_plane.z_max-backupvtx[0].z,2); |
|
37 |
delta_energy+=vesicle->tape->plane_F / pow(vesicle->confinement_plane.z_max-vtx->z,2); |
|
38 |
} |
|
39 |
if(abs(-vesicle->tape->plane_d/2.0-vesicle->confinement_plane.z_min)>1e-10) { |
|
40 |
delta_energy-=vesicle->tape->plane_F / pow(vesicle->confinement_plane.z_min-backupvtx[0].z,2); |
|
41 |
delta_energy+=vesicle->tape->plane_F / pow(vesicle->confinement_plane.z_min-vtx->z,2); |
|
42 |
} |
|
43 |
} |
|
44 |
} |
|
45 |
return delta_energy; |
|
46 |
|
|
47 |
} |