From 2afc2f4f1dd89518995f1b5a539aea932aecab65 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Fri, 08 Mar 2019 19:50:18 +0000
Subject: [PATCH] Full write of constant volume plugin

---
 src/vertexmove.c |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/vertexmove.c b/src/vertexmove.c
index d33207f..37508e9 100644
--- a/src/vertexmove.c
+++ b/src/vertexmove.c
@@ -23,7 +23,7 @@
     ts_double delta_energy, oenergy,dvol=0.0, darea=0.0, dstretchenergy=0.0;
     ts_double costheta,sintheta,phi,r;
 	//This will hold all the information of vtx and its neighbours
-    ts_vertex backupvtx[20], *constvol_vtx_moved=NULL, *constvol_vtx_backup=NULL;
+    ts_vertex backupvtx[20]; // *constvol_vtx_moved=NULL, *constvol_vtx_backup=NULL;
     memcpy((void *)&backupvtx[0],(void *)vtx,sizeof(ts_vertex));
 
     //random move in a sphere with radius stepsize:
@@ -202,9 +202,9 @@
 	}
 
 //    fprintf(stderr, "before vtx(x,y,z)=%e,%e,%e\n",constvol_vtx_moved->x, constvol_vtx_moved->y, constvol_vtx_moved->z);
-    if(vesicle->tape->constvolswitch == 1){
-        constvolumerestore(constvol_vtx_moved,constvol_vtx_backup);
-    }
+//    if(vesicle->tape->constvolswitch == 1){
+//        constvolumerestore(constvol_vtx_moved,constvol_vtx_backup);
+//    }
 //    fprintf(stderr, "after vtx(x,y,z)=%e,%e,%e\n",constvol_vtx_moved->x, constvol_vtx_moved->y, constvol_vtx_moved->z);
 //    vesicle_volume(vesicle);
 //    fprintf(stderr,"Volume after fail=%1.16e\n", vesicle->volume);
@@ -224,18 +224,27 @@
 
     if(vesicle->tape->constvolswitch == 2){
 	vesicle->volume+=dvol;
-    } else
-    if(vesicle->tape->constvolswitch == 1){
-        constvolumeaccept(vesicle,constvol_vtx_moved,constvol_vtx_backup);
-    }
+    } 
+
+
 
     if(vesicle->tape->constareaswitch==2){
         vesicle->area+=darea;
     }
-//	if(oldcellidx);
-    //END MONTE CARLOOOOOOO
-//    vesicle_volume(vesicle);
-//    fprintf(stderr,"Volume after success=%1.16e\n", vesicle->volume);
+
+
+/* Entry point for plugin vm_before_montecarlo_constraint() function */
+	vesicle->plist->pointer=vesicle->plist->chain->vm_new_state_accepted;
+	while(vesicle->plist->pointer!=NULL){
+		vesicle->plist->pointer->plugin->function->vm_new_state_accepted(vesicle,vtx, &backupvtx[0]);
+		vesicle->plist->pointer=vesicle->plist->pointer->next;
+	}
+/* End of vm_before_montecarlo_constraint() */
+
+
+
+
+
     return TS_SUCCESS;
 }
 

--
Gitblit v1.9.3