From c2c6364dc7d23f21dabd2179e775e93ba4eeb252 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Tue, 06 Dec 2016 13:45:07 +0000
Subject: [PATCH] Merging again because I was merging in detached state

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

diff --git a/src/energy.c b/src/energy.c
index 7c29c0b..996fb16 100644
--- a/src/energy.c
+++ b/src/energy.c
@@ -216,11 +216,11 @@
 	ts_double norml,ddp=0.0;
 	ts_uint i;
 	ts_double xnorm=0.0,ynorm=0.0,znorm=0.0;
-	/*find normal of the vertex as average normal of all the triangles surrounding it. */
+	/*find normal of the vertex as sum of all the normals of the triangles surrounding it. */
 	for(i=0;i<vtx->tristar_no;i++){
-			xnorm=vtx->tristar[i]->xnorm;
-			ynorm=vtx->tristar[i]->ynorm;
-			znorm=vtx->tristar[i]->znorm;
+			xnorm+=vtx->tristar[i]->xnorm;
+			ynorm+=vtx->tristar[i]->ynorm;
+			znorm+=vtx->tristar[i]->znorm;
 	}
 	/*normalize*/
 	norml=sqrt(xnorm*xnorm+ynorm*ynorm+znorm*znorm);
@@ -228,7 +228,7 @@
 	ynorm/=norml;
 	znorm/=norml;
 	/*calculate ddp, perpendicular displacement*/
-	ddp=xnorm*(vtx->x-vtx_old->x)+xnorm*(vtx->y-vtx_old->y)+znorm*(vtx->z-vtx_old->z);
+	ddp=xnorm*(vtx->x-vtx_old->x)+ynorm*(vtx->y-vtx_old->y)+znorm*(vtx->z-vtx_old->z);
 	/*calculate dE*/
 //	printf("ddp=%e",ddp);
 	return vesicle->tape->F*ddp;		

--
Gitblit v1.9.3