From 3cd5f4a96d445b55da8a7e6da8509bbd7d5d41b8 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Thu, 15 Sep 2016 06:29:31 +0000
Subject: [PATCH] Fixes #19.

---
 src/poly.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/poly.c b/src/poly.c
index 6af59e9..7c7450b 100644
--- a/src/poly.c
+++ b/src/poly.c
@@ -1,3 +1,4 @@
+/* vim: set ts=4 sts=4 sw=4 noet : */
 #include"general.h"
 #include"poly.h"
 #include<stdlib.h>
@@ -82,6 +83,7 @@
 
 	if (vlist!=NULL){
 	/* Make straight grafted poylmers normal to membrane (polymer brush). Dist. between poly vertices put to 1*/
+		ts_int intpoly=vesicle->tape->internal_poly;
 		for (i=0;i<poly_list->n;i++){
 	
 			xnorm=0.0;
@@ -93,6 +95,9 @@
 				znorm-=poly_list->poly[i]->grafted_vtx->tristar[j]->znorm;	
 			}
 			normlength=sqrt(xnorm*xnorm+ynorm*ynorm+znorm*znorm);
+			if(intpoly && i%2){
+				normlength=-normlength;
+			}
 			xnorm=xnorm/normlength;
 			ynorm=ynorm/normlength;
 			znorm=znorm/normlength;
@@ -151,9 +156,9 @@
 
 ts_bool poly_free(ts_poly *poly){
 
-	if (poly->grafted_vtx!=NULL){
-		poly->grafted_vtx->grafted_poly=NULL;
-	}
+//	if (poly->grafted_vtx!=NULL){
+//		poly->grafted_vtx->grafted_poly=NULL;
+//	}
 	vtx_list_free(poly->vlist);
 	bond_list_free(poly->blist);
 	free(poly);
@@ -163,8 +168,9 @@
 
 ts_bool poly_list_free(ts_poly_list *poly_list){
 	ts_uint i;
-
+	//fprintf(stderr,"no. of polys=%d\n", poly_list->n);
 	for(i=0;i<poly_list->n;i++){
+	//	fprintf(stderr,"%d poly address in mem=%ld\n",i+1,(long)&(poly_list->poly[i]));
 		poly_free(poly_list->poly[i]);
 	}
 	free(poly_list->poly);

--
Gitblit v1.9.3