From ca9f26089df29fec5995ed4f19a06c29f7f4b12e Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Thu, 28 Feb 2019 18:55:40 +0000
Subject: [PATCH] Plugin chains to speed up running of plugins, part 1.

---
 src/bondflip.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/bondflip.c b/src/bondflip.c
index 66c40f7..13ec263 100644
--- a/src/bondflip.c
+++ b/src/bondflip.c
@@ -176,7 +176,6 @@
 /*    vesicle_volume(vesicle);
     fprintf(stderr,"Volume in the beginning=%1.16e\n", vesicle->volume);
 */
-
 /* fix data structure for flipped bond */
     ts_flip_bond(k,it,km,kp, bond,lm, lp, lm2, lp1, vesicle->tape->w);
 
@@ -189,6 +188,12 @@
   delta_energy+=it->xk* it->energy;
   delta_energy+=bond->energy; /* attraction with neighboring vertices, that have spontaneous curvature */
   //Neigbours of k, it, km, kp don't change its energy.
+	if(vesicle->tape->stretchswitch==1){
+		oldenergy+=lm->energy+lp->energy;
+		stretchenergy(vesicle,lm);
+		stretchenergy(vesicle,lp);
+		delta_energy+=lm->energy+lp->energy;
+	}
 
     delta_energy-=oldenergy;
 	if(vesicle->pswitch == 1 || vesicle->tape->constvolswitch>0){
@@ -334,6 +339,10 @@
 //		fprintf(stderr,"Restoration complete!!!\n");
 //    vesicle_volume(vesicle);
 //    fprintf(stderr,"Volume after fail=%1.16e\n", vesicle->volume);
+	if(vesicle->tape->stretchswitch==1){
+		stretchenergy(vesicle,lm);
+		stretchenergy(vesicle,lp);
+	}
 
 		return TS_FAIL;
         }

--
Gitblit v1.9.3