Trisurf Monte Carlo simulator
Samo Penic
2019-03-08 85898e259e6e2075a7f755583690024a63e9bb2b
commit | author | age
b5cd8c 1 #include "plugins.h"
SP 2 #include <stdlib.h>
3 #include "general.h"
4 #include "vertex.h"
5 #include "cell.h"
6 char plugin_name[] = "Nucleus";
7 char plugin_description[]= "This plugin adds nucleus to the center of the vesicle. For now only vertexmove constraint is implemented.";
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;
13     return details;    
14 }
15
16 ts_bool vm_hard_constraint(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *ovtx){
17 // TODO: Maybe faster if checks only nucleus-neighboring cells
18 // Nucleus penetration check:
19 //#define SQ(x) x*x
20 if(vesicle->R_nucleus>0.0){
21     if ((vtx->x-vesicle->nucleus_center[0])*(vtx->x-vesicle->nucleus_center[0])+ (vtx->y-vesicle->nucleus_center[1])*(vtx->y-vesicle->nucleus_center[1]) + (vtx->z-vesicle->nucleus_center[2])*(vtx->z-vesicle->nucleus_center[2]) < vesicle->R_nucleus){
22         return TS_FAIL;
23     }
24 } else if(vesicle->R_nucleusX>0.0){
25     if ((vtx->x-vesicle->nucleus_center[0])*(vtx->x-vesicle->nucleus_center[0])/vesicle->R_nucleusX + (vtx->y-vesicle->nucleus_center[1])*(vtx->y-vesicle->nucleus_center[1])/vesicle->R_nucleusY + (vtx->z-vesicle->nucleus_center[2])*(vtx->z-vesicle->nucleus_center[2])/vesicle->R_nucleusZ < 1.0){
26         return TS_FAIL;
27     }
28
29 }
30
31     return TS_SUCCESS;
32 }
33