Trisurf Monte Carlo simulator
Samo Penic
2019-03-08 2afc2f4f1dd89518995f1b5a539aea932aecab65
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){
18     ts_double *dvol=(ts_double *)vesicle->plist->pointer->plugin->details->data;
19     ts_uint i;
20     //printf ("DVOL was %f\n", *dvol);
21     *dvol=0;
22     for(i=0;i<vtx->tristar_no;i++) *dvol-=vtx->tristar[i]->volume;
23     //printf ("DVOL is %f\n", *dvol);
24
25     }
26 }
27
28 ts_double vm_energy_after_execute(ts_vesicle *vesicle, ts_vertex *vtx){
29     ts_double delta_energy=0;
30     if(vesicle->pswitch == 1){
31         ts_double *dvol=(ts_double *)vesicle->plist->pointer->plugin->details->data;
32         ts_uint i;
33         for(i=0;i<vtx->tristar_no;i++) *dvol+=vtx->tristar[i]->volume;
34         delta_energy=-vesicle->pressure*(*dvol);
35     }
36     return delta_energy;
37 }