From 8a72f3f1dbe2bb440de3d788f33ecfb46f1f604c Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Fri, 13 Jun 2014 20:39:35 +0000
Subject: [PATCH] Fix: the 2d contour of cross-section is calculated only if shperical harmonics are calculated

---
 src/stats.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/stats.c b/src/stats.c
index 4648d29..077781e 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -15,20 +15,26 @@
 	ts_uint i,j,k;
 	ts_double mat[3][3];
 	ts_double vec[3];
+
 	for(i = 0; i < 3; i++)
         	for(j = 0; j < 3; j++)
             		mat[i][j]=0;
  
-
 	for(k=0;k<vesicle->vlist->n;k++){
 		vec[0]=vesicle->vlist->vtx[k]->x;
 		vec[1]=vesicle->vlist->vtx[k]->y;
 		vec[2]=vesicle->vlist->vtx[k]->z;
 		for(i = 0; i < 3; i++)
         		for(j = 0; j <= i; j++)
-				mat[i][j]+=vec[i]*vec[j];	
+				mat[i][j]+=vec[i]*vec[j];
 	}
 
+// Normalize gyration tensor:
+	for(i = 0; i < 3; i++)
+        	for(j = 0; j <= i; j++)
+			mat[i][j]=mat[i][j]/(ts_double)vesicle->vlist->n;
+
+
 // diagonal elements are copied twice!	
 	for(i = 0; i < 3; i++)
         	for(j = 0; j <= i; j++){

--
Gitblit v1.9.3