Trisurf Monte Carlo simulator
Samo Penic
2019-02-28 b5cd8cc72380e9ca576ec942753391df85a2a436
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "plugins.h"
#include <stdlib.h>
#include "general.h"
#include "vertex.h"
#include "cell.h"
char plugin_name[] = "Nucleus";
char plugin_description[]= "This plugin adds nucleus to the center of the vesicle. For now only vertexmove constraint is implemented.";
char plugin_author[] = "SAMO PENIC";
 
ts_plugin_details *init (){
    ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details));
    details->name = plugin_name;
    return details;    
}
 
ts_bool vm_hard_constraint(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *ovtx){
// TODO: Maybe faster if checks only nucleus-neighboring cells
// Nucleus penetration check:
//#define SQ(x) x*x
if(vesicle->R_nucleus>0.0){
    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){
        return TS_FAIL;
    }
} else if(vesicle->R_nucleusX>0.0){
    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){
        return TS_FAIL;
    }
 
}
 
    return TS_SUCCESS;
}