Trisurf Monte Carlo simulator
Samo Penic
2019-03-09 4df6ed05246cf8bc9fe0cb0c8766ebc368d2f512
commit | author | age
51b4f0 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[] = "Default hard constraints for vertex move";
b5cd8c 7 char plugin_description[]= "Checks proximity with neighbors, vertices in neighboring cells and with foreign vertices that may be in vicinity";
51b4f0 8 char plugin_author[] = "SAMO PENIC";
SP 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     ts_uint i;
18     ts_uint cellidx;
19     ts_double dist;
20     ts_bool retval;
21 //distance with neighbours check
22     for(i=0;i<vtx->neigh_no;i++){
23         dist=vtx_distance_sq(vtx,vtx->neigh[i]);
24         if(dist<1.0 || dist>vesicle->dmax) {
25             return TS_FAIL;
26         }
27     }
28 // Distance with grafted poly-vertex check:    
29     if(vtx->grafted_poly!=NULL){
30         dist=vtx_distance_sq(vtx,vtx->grafted_poly->vlist->vtx[0]);
31         if(dist<1.0 || dist>vesicle->dmax) {
32         return TS_FAIL;
33         }
34     }
35
36 //self avoidance check with distant vertices
37     cellidx=vertex_self_avoidance(vesicle, vtx);
38     //check occupation number
39     retval=cell_occupation_number_and_internal_proximity(vesicle->clist,cellidx,vtx);
40         if(retval==TS_FAIL){
41            return TS_FAIL;
42         } 
43    
44     return TS_SUCCESS;
45 }
46