From 8108947140ecfc116f4e1c9090499c1b4ad4c3b7 Mon Sep 17 00:00:00 2001
From: Miha <miha.fosnaric@fe.uni-lj.si>
Date: Fri, 15 Jul 2016 10:18:21 +0000
Subject: [PATCH] Mean curvature averaged over vesicle area added.

---
 src/vesicle.h    |    1 +
 src/vesicle.c    |   12 ++++++++++++
 src/tspoststat.c |    7 ++++---
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/tspoststat.c b/src/tspoststat.c
index 6a4b8fb..f518000 100644
--- a/src/tspoststat.c
+++ b/src/tspoststat.c
@@ -105,11 +105,11 @@
 	ts_uint tstep,n;
     	ts_char *number;
 	struct dirent **list;
-	ts_double l1,l2,l3;
+	ts_double l1,l2,l3,hbar;
 	int count;
 	ts_fprintf(stderr,"TRISURF-NG v. %s, compiled on: %s %s.\n", TS_VERSION, __DATE__, __TIME__);
 
-	fprintf(stdout, "OuterLoop Volume Area lamdba1 lambda2 lambda3 Nbw/Nb\n");
+	fprintf(stdout, "OuterLoop Volume Area lamdba1 lambda2 lambda3 Nbw/Nb hbar\n");
 
 
 	count=scandir(".",&list,0,alphasort);
@@ -136,7 +136,8 @@
 			vesicle_volume(vesicle);
 			vesicle_area(vesicle);
 			gyration_eigen(vesicle,&l1,&l2,&l3);
-			fprintf(stdout,"%d %.17e %.17e %.17e %.17e %.17e %.17e\n",atoi(number),vesicle->volume, vesicle->area,l1,l2,l3, (ts_double)count_bonds_with_energy(vesicle->blist)/(ts_double)vesicle->blist->n),
+			hbar=vesicle_meancurvature(vesicle)/vesicle->area;			
+			fprintf(stdout,"%d %.17e %.17e %.17e %.17e %.17e %.17e %.17e\n",atoi(number),vesicle->volume, vesicle->area,l1,l2,l3, (ts_double)count_bonds_with_energy(vesicle->blist)/(ts_double)vesicle->blist->n,hbar);
                     	tstep++;
 			write_histogram_data(atoi(number), vesicle);
                     free(number);
diff --git a/src/vesicle.c b/src/vesicle.c
index bc69e62..fe4c4b1 100644
--- a/src/vesicle.c
+++ b/src/vesicle.c
@@ -79,3 +79,15 @@
     vesicle->area=area;
     return TS_SUCCESS;
 }
+
+ts_double vesicle_meancurvature(ts_vesicle *vesicle){
+// Integrates (H dA) over vesicle area A, where H=(C1+C2)/2.
+// (To be devided by A outside of function)
+	ts_double mc;
+	ts_uint i;
+	mc=0;
+	for(i=0;i<vesicle->vlist->n;i++){
+		mc=mc+vesicle->vlist->vtx[i]->curvature;
+	}
+	return mc/2.0;
+}
diff --git a/src/vesicle.h b/src/vesicle.h
index e8f09fb..953e0a2 100644
--- a/src/vesicle.h
+++ b/src/vesicle.h
@@ -7,4 +7,5 @@
 ts_bool vesicle_free(ts_vesicle *vesicle);
 ts_bool vesicle_volume(ts_vesicle *vesicle);
 ts_bool vesicle_area(ts_vesicle *vesicle);
+ts_double vesicle_meancurvature(ts_vesicle *vesicle);
 #endif

--
Gitblit v1.9.3