Trisurf Monte Carlo simulator
Samo Penic
2019-03-08 85898e259e6e2075a7f755583690024a63e9bb2b
commit | author | age
36dba8 1 #include <stdlib.h>
SP 2 #include "general.h"
3 #include "vertex.h"
4 #include "cell.h"
5 char plugin_name[] = "Pressure";
6 char plugin_description[]= "Defines extra energy term for relative pressure difference between the inner vesicle and outer vesicle";
7 char plugin_author[] = "SAMO PENIC";
8
9 ts_plugin_details *init (){
10     ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details));
11     details->name = plugin_name;
12     details->data = (void *)calloc(1,sizeof(ts_double));
13     return details;    
14 }
15
16 void vm_energy_before_prepare(ts_vesicle *vesicle, ts_vertex *vtx){
17     if(vesicle->pswitch == 1){
6dab1a 18         ts_double *dvol=(ts_double *)vesicle->plist->pointer->plugin->details->data;
SP 19         ts_uint i;
20         *dvol=0;
21         for(i=0;i<vtx->tristar_no;i++) *dvol-=vtx->tristar[i]->volume;
36dba8 22     }
SP 23 }
24
85898e 25 ts_double vm_energy_after_execute(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *backup_vertices){
36dba8 26     ts_double delta_energy=0;
SP 27     if(vesicle->pswitch == 1){
28         ts_double *dvol=(ts_double *)vesicle->plist->pointer->plugin->details->data;
29         ts_uint i;
30         for(i=0;i<vtx->tristar_no;i++) *dvol+=vtx->tristar[i]->volume;
31         delta_energy=-vesicle->pressure*(*dvol);
32     }
33     return delta_energy;
34 }