From ea1cce4c80ddb68c0b46a6873ef3b64cc4a958a1 Mon Sep 17 00:00:00 2001
From: mihaf <miha.fosnaric@gmail.com>
Date: Mon, 24 Mar 2014 16:37:44 +0000
Subject: [PATCH] Added dmin_interspecies.

---
 src/cell.c                 |    6 ++----
 src/main.c                 |    1 +
 src/vertex.c               |    8 ++++++++
 src/io.c                   |    1 +
 src/tape                   |   10 ++++++----
 src/initial_distribution.c |    4 ++++
 src/general.h              |    3 +++
 src/frame.c                |    1 +
 src/io.h                   |    1 +
 src/vertex.h               |    2 ++
 10 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/cell.c b/src/cell.c
index 97f2fe7..f95ff21 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -44,7 +44,6 @@
 }
 
 
-//TODO: not debugged at all!
 inline ts_uint vertex_self_avoidance(ts_vesicle *vesicle, ts_vertex *vtx){
     ts_uint cellidx;
     ts_uint ncx, ncy,ncz;
@@ -68,7 +67,6 @@
 }
 
 
-//TODO: looks ok, but debug anyway in the future
 inline ts_bool cell_add_vertex(ts_cell *cell, ts_vertex *vtx){
 	ts_uint i;
 	for(i=0;i<cell->nvertex;i++){
@@ -124,7 +122,7 @@
     return TS_SUCCESS;
 }
 
-// TODO: compiles ok, but it is completely untested and undebugged. It was debugged before rewrite, but this was long time ago.
+
 ts_bool cell_occupation_number_and_internal_proximity(ts_cell_list *clist, ts_uint cellidx, ts_vertex *vtx){
     ts_uint ncx,ncy,ncz,remainder,cell_occupation;
     ts_uint i,j,k,l,neigh_cidx;
@@ -155,7 +153,7 @@
                     //        fprintf(stderr,"calling dist on vertex %i\n",l);
                            dist=vtx_distance_sq(clist->cell[neigh_cidx]->vertex[l],vtx);
                     //        fprintf(stderr,"dist was %f\n",dist);
-                            if(dist<=1.0) return TS_FAIL;
+                            if(dist<=1.0 || (dist<=clist->dmin_interspecies && (clist->cell[neigh_cidx]->vertex[l]->id != vtx->id))) return TS_FAIL;
                         }
                     }
                 }
diff --git a/src/frame.c b/src/frame.c
index aeaef21..237aa87 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2,6 +2,7 @@
 #include "general.h"
 #include "cell.h"
 #include "frame.h"
+
 ts_bool centermass(ts_vesicle *vesicle){
     ts_uint i,j, n=vesicle->vlist->n;
     ts_vertex **vtx=vesicle->vlist->vtx;
diff --git a/src/general.h b/src/general.h
index 79da2ba..e47ef1c 100644
--- a/src/general.h
+++ b/src/general.h
@@ -48,6 +48,8 @@
 
 /* CONSTANTS */
 
+#define TS_ID_FILAMENT 1
+
 /* DATA TYPES */
 /** @brief Sets the default datatype for ts_double
  *
@@ -213,6 +215,7 @@
     ts_double dcell;
     ts_double shift;
     ts_double max_occupancy;
+	ts_double dmin_interspecies;
 } ts_cell_list;
 
 
diff --git a/src/initial_distribution.c b/src/initial_distribution.c
index 3c27e55..a93e2ee 100644
--- a/src/initial_distribution.c
+++ b/src/initial_distribution.c
@@ -69,6 +69,9 @@
 		}
 	}
 
+	for(i=0;i<vesicle->filament_list->n;i++){
+		vertex_list_assign_id(vesicle->filament_list->poly[i]->vlist,TS_ID_FILAMENT);
+	}
 
 //	vesicle->spring_constant=tape->kspring;
 //	poly_assign_spring_const(vesicle);
@@ -76,6 +79,7 @@
 	
 	vesicle->nshell=tape->nshell;
 	vesicle->dmax=tape->dmax*tape->dmax; /* dmax^2 in the vesicle dmax variable */
+	vesicle->clist->dmin_interspecies = tape->dmin_interspecies*tape->dmin_interspecies;
 	vesicle->bending_rigidity=tape->xk0;
 	vtx_set_global_values(vesicle); /* make xk0 default value for every vertex */ 
 	ts_fprintf(stdout, "Tape setting: xk0=%e\n",tape->xk0);
diff --git a/src/io.c b/src/io.c
index 17adda4..a25b16c 100644
--- a/src/io.c
+++ b/src/io.c
@@ -970,6 +970,7 @@
 	CFG_SIMPLE_INT("nfono",&tape->nfono),
 	CFG_SIMPLE_INT("R_nucleus",&tape->R_nucleus),
 	CFG_SIMPLE_FLOAT("dmax", &tape->dmax),
+	CFG_SIMPLE_FLOAT("dmin_interspecies", &tape->dmin_interspecies),
         CFG_SIMPLE_FLOAT("xk0",&tape->xk0),
 	CFG_SIMPLE_INT("pswitch",&tape->pswitch),
 	CFG_SIMPLE_FLOAT("pressure",&tape->pressure),
diff --git a/src/io.h b/src/io.h
index 8118db4..117c9ff 100644
--- a/src/io.h
+++ b/src/io.h
@@ -26,6 +26,7 @@
     	long int brezveze2;
     	ts_double xk0;
 	ts_double dmax;
+	ts_double dmin_interspecies;
 	ts_double stepsize;
 	ts_double kspring;
 	ts_double xi;
diff --git a/src/main.c b/src/main.c
index c052928..fa4b872 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,6 +48,7 @@
 		vesicle->pressure=tape->pressure;
 		vesicle->dmax=tape->dmax*tape->dmax;
 		poly_assign_filament_xi(vesicle,tape);
+		vesicle->clist->dmin_interspecies = tape->dmin_interspecies*tape->dmin_interspecies;
 
 		if(command_line_args.reset_iteration_count) start_iteration=tape->inititer;
 		else start_iteration++;
diff --git a/src/tape b/src/tape
index bd62b6c..8d589d0 100644
--- a/src/tape
+++ b/src/tape
@@ -3,6 +3,8 @@
 nshell=17
 # dmax is the max. bond length (in units l_min)
 dmax=1.7
+# dmin_interspecies in the min. dist. between different vertex species (in units l_min)
+dmin_interspecies=1
 # bending rigidity of the membrane (in units kT)
 xk0=10.0
 # max step size (in units l_min)
@@ -10,13 +12,13 @@
 
 # Pressure calculations
 # (pswitch=1: calc. p*dV energy contribution)
-pswitch = 0
+pswitch = 1
 # pressure difference: p_inside - p_outside (in units kT/l_min^3):
-pressure=0.1
+pressure=-2.0
 
 ####### Polymer (brush) definitions ###########
 # npoly is a number of polymers attached to npoly distinct vertices on vesicle
-npoly=300
+npoly=0
 # nmono is a number of monomers in each polymer
 nmono=10
 # Spring constant between monomers of the polymer
@@ -42,7 +44,7 @@
 
 ####### Program Control ############
 #how many MC sweeps between subsequent records of states to disk
-mcsweeps=500
+mcsweeps=100
 #how many initial mcsweeps*inititer MC sweeps before recording to disk?
 inititer=0
 #how many records do you want on the disk iteration are there in a run?
diff --git a/src/vertex.c b/src/vertex.c
index 38647aa..f733d49 100644
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -6,6 +6,14 @@
 #include "bond.h"
 #include<stdio.h>
 
+ts_bool vertex_list_assign_id(ts_vertex_list *vlist, ts_uint id){
+	ts_uint i;	
+	for(i=0;i<vlist->n;i++){
+		vlist->vtx[i]->id = id;
+	}
+	return TS_SUCCESS;
+}
+
 ts_vertex_list *init_vertex_list(ts_uint N){	
 	ts_int i;
     ts_vertex_list *vlist=(ts_vertex_list *)malloc(sizeof(ts_vertex_list));
diff --git a/src/vertex.h b/src/vertex.h
index 97775d2..cca12ee 100644
--- a/src/vertex.h
+++ b/src/vertex.h
@@ -1,6 +1,8 @@
 #ifndef _VERTEX_H
 #define _VERTEX_H
 
+ts_bool vertex_list_assign_id(ts_vertex_list *vlist, ts_uint id);
+
 /** @brief Creates initial vertex list
  *  
  *  Allocates memory and initializes the vertices.

--
Gitblit v1.9.3