From ed31fe06aaefdb17052ad74cedd561c38d956621 Mon Sep 17 00:00:00 2001
From: Miha <mihaf@beti.(none)>
Date: Fri, 13 Jul 2012 13:04:40 +0000
Subject: [PATCH] Added vertex move in a sphere with radius stepsize (not cube as before).

---
 src/vertexmove.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/vertexmove.c b/src/vertexmove.c
index c62aeda..7edbf04 100644
--- a/src/vertexmove.c
+++ b/src/vertexmove.c
@@ -22,11 +22,20 @@
     ts_double delta_energy,oenergy;
     ts_vertex *ovtx;
     ts_vertex *tvtx=(ts_vertex *)calloc(1,sizeof(ts_vertex));
+    ts_double costheta,sintheta,phi,r;
 
     //randomly we move the temporary vertex
-	tvtx->x=vtx->x+vesicle->stepsize*(2.0*rn[0]-1.0);
-    tvtx->y=vtx->y+vesicle->stepsize*(2.0*rn[1]-1.0);
-    tvtx->z=vtx->z+vesicle->stepsize*(2.0*rn[2]-1.0);
+//    tvtx->x=vtx->x+vesicle->stepsize*(2.0*rn[0]-1.0);
+//    tvtx->y=vtx->y+vesicle->stepsize*(2.0*rn[1]-1.0);
+//    tvtx->z=vtx->z+vesicle->stepsize*(2.0*rn[2]-1.0);
+	//random move in a sphere with radius stepsize:
+	r=vesicle->stepsize*rn[0];
+	phi=rn[1]*2*M_PI;
+	costheta=2*rn[2]-1;
+	sintheta=sqrt(1-pow(costheta,2));
+	tvtx->x=vtx->x+r*sintheta*cos(phi);
+	tvtx->y=vtx->y+r*sintheta*sin(phi);
+	tvtx->z=vtx->z+r*costheta;
     //check we if some length to neighbours are too much
     for(i=0;i<vtx->neigh_no;i++){
         dist=vtx_distance_sq(tvtx,vtx->neigh[i]);

--
Gitblit v1.9.3