Trisurf Monte Carlo simulator
Samo Penic
2019-03-08 6dab1ac322cfbad8390861456c674922073911b3
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
33
34
#include <stdlib.h>
#include "general.h"
#include "vertex.h"
#include "cell.h"
char plugin_name[] = "Pressure";
char plugin_description[]= "Defines extra energy term for relative pressure difference between the inner vesicle and outer vesicle";
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;
    details->data = (void *)calloc(1,sizeof(ts_double));
    return details;    
}
 
void vm_energy_before_prepare(ts_vesicle *vesicle, ts_vertex *vtx){
    if(vesicle->pswitch == 1){
        ts_double *dvol=(ts_double *)vesicle->plist->pointer->plugin->details->data;
        ts_uint i;
        *dvol=0;
        for(i=0;i<vtx->tristar_no;i++) *dvol-=vtx->tristar[i]->volume;
    }
}
 
ts_double vm_energy_after_execute(ts_vesicle *vesicle, ts_vertex *vtx){
    ts_double delta_energy=0;
    if(vesicle->pswitch == 1){
        ts_double *dvol=(ts_double *)vesicle->plist->pointer->plugin->details->data;
        ts_uint i;
        for(i=0;i<vtx->tristar_no;i++) *dvol+=vtx->tristar[i]->volume;
        delta_energy=-vesicle->pressure*(*dvol);
    }
    return delta_energy;
}