commit | author | age
|
4df6ed
|
1 |
#include <stdlib.h> |
SP |
2 |
#include<math.h> |
|
3 |
|
|
4 |
#include "general.h" |
2c4278
|
5 |
#include "energy.h" |
SP |
6 |
|
4df6ed
|
7 |
char plugin_name[] = "Stretching energy"; |
SP |
8 |
char plugin_description[]= "Plugin adds stretching energy to Monte Carlo steps"; |
|
9 |
char plugin_author[] = "SAMO PENIC"; |
|
10 |
|
|
11 |
|
|
12 |
typedef struct { |
|
13 |
ts_double dstretchenergy; |
|
14 |
ts_double A0; |
|
15 |
ts_double epsarea; |
|
16 |
} plugin_data; |
|
17 |
|
|
18 |
|
|
19 |
ts_plugin_details *init (){ |
|
20 |
ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details)); |
|
21 |
details->name = plugin_name; |
|
22 |
details->data = (plugin_data *)calloc(1,sizeof(plugin_data)); //storing data |
|
23 |
return details; |
|
24 |
} |
|
25 |
|
|
26 |
|
|
27 |
/* |
|
28 |
ts_vesicle *after_vesicle_init(ts_vesicle *vesicle){ |
|
29 |
plugin_data *data=(plugin_data *)vesicle->plist->pointer->plugin->details->data; |
|
30 |
ts_fprintf(stdout,"area volume initialized\n"); |
|
31 |
centermass(vesicle); |
|
32 |
cell_occupation(vesicle); |
|
33 |
vesicle_area(vesicle); |
|
34 |
data->A0=vesicle->area; |
|
35 |
data->epsarea=data->A0/(ts_double)vesicle->tlist->n; |
|
36 |
return vesicle; |
|
37 |
} |
|
38 |
*/ |
|
39 |
|
|
40 |
void vm_energy_before_prepare(ts_vesicle *vesicle, ts_vertex *vtx){ |
|
41 |
if(vesicle->tape->stretchswitch==1){ |
|
42 |
plugin_data *data=(plugin_data *)vesicle->plist->pointer->plugin->details->data; |
|
43 |
ts_uint i; |
|
44 |
data->dstretchenergy=0.0; |
|
45 |
for(i=0;i<vtx->tristar_no;i++) data->dstretchenergy-=vtx->tristar[i]->energy; |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
ts_double vm_energy_after_execute(ts_vesicle *vesicle, ts_vertex *vtx){ |
|
51 |
//stretching energy 2 of 3 |
|
52 |
if(vesicle->tape->stretchswitch==1){ |
|
53 |
plugin_data *data=(plugin_data *)vesicle->plist->pointer->plugin->details->data; |
|
54 |
ts_uint i; |
|
55 |
for(i=0;i<vtx->tristar_no;i++){ |
|
56 |
stretchenergy(vesicle, vtx->tristar[i]); |
|
57 |
data->dstretchenergy+=vtx->tristar[i]->energy; |
|
58 |
} |
2c4278
|
59 |
return data->dstretchenergy; |
4df6ed
|
60 |
} |
2c4278
|
61 |
return 0.0; |
4df6ed
|
62 |
} |
SP |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
void vm_new_state_rejected(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *old_vtx){ |
|
67 |
//stretching energy 3 of 3 |
|
68 |
if(vesicle->tape->stretchswitch==1){ |
|
69 |
ts_uint i; |
|
70 |
for(i=0;i<vtx->tristar_no;i++){ |
|
71 |
stretchenergy(vesicle,vtx->tristar[i]); |
|
72 |
} |
|
73 |
} |
|
74 |
} |