From 8ed8fdb663089e2bc53fd537611a6b45a09cc502 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sat, 30 Nov 2013 16:54:34 +0000
Subject: [PATCH] Seems to solve everything until bondflip

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

diff --git a/src/energy.c b/src/energy.c
index 4d93753..a11dce8 100644
--- a/src/energy.c
+++ b/src/energy.c
@@ -28,17 +28,17 @@
     ts_uint jjp,jjm;
     ts_vertex *j,*jp, *jm;
     ts_triangle *jt;
-    ts_double s=0,xh=0,yh=0,zh=0,txn=0,tyn=0,tzn=0;
+    ts_double s=0.0,xh=0.0,yh=0.0,zh=0.0,txn=0.0,tyn=0.0,tzn=0.0;
     ts_double x1,x2,x3,ctp,ctm,tot,xlen;
     ts_double h,ht;
-    for(jj=1; jj<=vtx->neigh_no;jj++){
+    for(jj=1; jj<=vtx->neigh->n;jj++){
         jjp=jj+1;
-        if(jjp>vtx->neigh_no) jjp=1;
+        if(jjp>vtx->neigh->n) jjp=1;
         jjm=jj-1;
-        if(jjm<1) jjm=vtx->neigh_no;
-        j=vtx->neigh[jj-1];
-        jp=vtx->neigh[jjp-1];
-        jm=vtx->neigh[jjm-1];
+        if(jjm<1) jjm=vtx->neigh->n;
+        j=vtx->neigh->vtx[jj-1];
+        jp=vtx->neigh->vtx[jjp-1];
+        jm=vtx->neigh->vtx[jjm-1];
 //        printf("tristar_no=%u, neigh_no=%u, jj=%u\n",data->tristar_no,data->neigh_no,jj);
         jt=vtx->tristar[jj-1];
         x1=vtx_distance_sq(vtx,jp); //shouldn't be zero!
@@ -72,7 +72,9 @@
 #endif
         tot=ctp+ctm;
         tot=0.5*tot;
+
         xlen=vtx_distance_sq(j,vtx);
+/*
 #ifdef  TS_DOUBLE_DOUBLE 
         vtx->bond[jj-1]->bond_length=sqrt(xlen); 
 #endif
@@ -84,7 +86,7 @@
 #endif
 
         vtx->bond[jj-1]->bond_length_dual=tot*vtx->bond[jj-1]->bond_length;
-
+*/
         s+=tot*xlen;
         xh+=tot*(j->x - vtx->x);
         yh+=tot*(j->y - vtx->y);

--
Gitblit v1.9.3