From a37ba25eb9dc4b99ced8e8dcc3c36b9ed434a262 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Thu, 06 Mar 2014 07:58:36 +0000
Subject: [PATCH] Fixed a bug in vertex reinit. Still buggy.

---
 src/main.c |    1 -
 src/io.c   |    8 +++++---
 src/tape   |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/io.c b/src/io.c
index b4e879f..d022d89 100644
--- a/src/io.c
+++ b/src/io.c
@@ -172,11 +172,13 @@
     for(i=0;i<vesicle->tlist->n;i++){
         vesicle->tlist->tria[i]=(ts_triangle *)malloc(sizeof(ts_triangle));
 }
-
-  /*restore vertices*/
+/* prerequisity. Vertices must be malloced before vertexes are recreated */
     vesicle->vlist->vtx=(ts_vertex **)calloc(vesicle->vlist->n,sizeof(ts_vertex *));
-    for(i=0;i<vesicle->vlist->n;i++){
+ for(i=0;i<vesicle->vlist->n;i++){
         vesicle->vlist->vtx[i]=(ts_vertex *)malloc(sizeof(ts_vertex));
+ }
+  /*restore vertices*/
+    for(i=0;i<vesicle->vlist->n;i++){
         retval=fread(vesicle->vlist->vtx[i],sizeof(ts_vertex),1,fh);
         /*restore neigh, bond, tristar. Ignoring cell */
         vesicle->vlist->vtx[i]->neigh=(ts_vertex **)calloc(vesicle->vlist->vtx[i]->neigh_no, sizeof(ts_vertex *));
diff --git a/src/main.c b/src/main.c
index 2ebd7db..e758de5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -83,7 +83,6 @@
 vesicle_free(vesicle1);
 fprintf(stderr,"Starting simulation...");
 run_simulation(vesicle, mcsweeps, inititer, iterations);
-return 0;
 
 write_master_xml_file("test.pvd");
 write_dout_fcompat_file(vesicle,"dout");
diff --git a/src/tape b/src/tape
index f3c8bad..d30d1d6 100644
--- a/src/tape
+++ b/src/tape
@@ -28,7 +28,7 @@
 #how many initial mcsweeps*inititer MC sweeps before recording to disk?
 inititer=1
 #how many records do you want on the disk iteration are there in a run?
-iterations=10000
+iterations=10
 
 
 #shut up if we are using cluster!!!

--
Gitblit v1.9.3