#include #include #include "general.h" #include "energy.h" char plugin_name[] = "Stretching energy"; char plugin_description[]= "Plugin adds stretching energy to Monte Carlo steps"; char plugin_author[] = "SAMO PENIC"; typedef struct { ts_double dstretchenergy; ts_double A0; ts_double epsarea; } plugin_data; ts_plugin_details *init (){ ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details)); details->name = plugin_name; details->data = (plugin_data *)calloc(1,sizeof(plugin_data)); //storing data return details; } /* ts_vesicle *after_vesicle_init(ts_vesicle *vesicle){ plugin_data *data=(plugin_data *)vesicle->plist->pointer->plugin->details->data; ts_fprintf(stdout,"area volume initialized\n"); centermass(vesicle); cell_occupation(vesicle); vesicle_area(vesicle); data->A0=vesicle->area; data->epsarea=data->A0/(ts_double)vesicle->tlist->n; return vesicle; } */ void vm_energy_before_prepare(ts_vesicle *vesicle, ts_vertex *vtx){ if(vesicle->tape->stretchswitch==1){ plugin_data *data=(plugin_data *)vesicle->plist->pointer->plugin->details->data; ts_uint i; data->dstretchenergy=0.0; for(i=0;itristar_no;i++) data->dstretchenergy-=vtx->tristar[i]->energy; } } ts_double vm_energy_after_execute(ts_vesicle *vesicle, ts_vertex *vtx){ //stretching energy 2 of 3 if(vesicle->tape->stretchswitch==1){ plugin_data *data=(plugin_data *)vesicle->plist->pointer->plugin->details->data; ts_uint i; for(i=0;itristar_no;i++){ stretchenergy(vesicle, vtx->tristar[i]); data->dstretchenergy+=vtx->tristar[i]->energy; } return data->dstretchenergy; } return 0.0; } void vm_new_state_rejected(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *old_vtx){ //stretching energy 3 of 3 if(vesicle->tape->stretchswitch==1){ ts_uint i; for(i=0;itristar_no;i++){ stretchenergy(vesicle,vtx->tristar[i]); } } }