From 88bdd70987e76a58ea0fd917f63aa0c682848116 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sun, 09 Dec 2018 21:47:36 +0000
Subject: [PATCH] testing confinement (preliminary)
---
src/timestep.c | 13 +++++++++++--
src/io.c | 4 ++--
src/vertexmove.c | 8 ++++++++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/io.c b/src/io.c
index 669a4b0..d5157be 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1195,8 +1195,8 @@
cfg = cfg_init(opts, 0);
retval=cfg_parse_buf(cfg, buffer);
tape->plane_confinement_switch=cfg_getint(cfg,"plane_confinement_switch");
- tape->plane_d=cfg_getint(cfg,"plane_d");
- tape->plane_F=cfg_getint(cfg,"plane_F");
+ tape->plane_d=cfg_getfloat(cfg,"plane_d");
+ tape->plane_F=cfg_getfloat(cfg,"plane_F");
if(retval==CFG_FILE_ERROR){
fatal("No tape file.",100);
diff --git a/src/timestep.c b/src/timestep.c
index 27400e7..d8440d0 100644
--- a/src/timestep.c
+++ b/src/timestep.c
@@ -62,7 +62,7 @@
centermass(vesicle);
cell_occupation(vesicle);
vesicle_volume(vesicle); //needed for constant volume at this moment
- vesicle_area(vesicle); //needed for constant area at this moment
+ vesicle_area(vesicle); //needed for constant area at this moment
if(V0<0.000001)
V0=vesicle->volume;
ts_fprintf(stdout,"Setting volume V0=%.17f\n",V0);
@@ -70,7 +70,16 @@
A0=vesicle->area;
ts_fprintf(stdout,"Setting area A0=%.17f\n",A0);
epsvol=4.0*sqrt(2.0*M_PI)/pow(3.0,3.0/4.0)*V0/pow(vesicle->tlist->n,3.0/2.0);
- epsarea=A0/(ts_double)vesicle->tlist->n;
+ epsarea=A0/(ts_double)vesicle->tlist->n;
+
+ //plane confinement part 1
+
+ if(vesicle->tape->plane_confinement_switch){
+ vesicle->confinement_plane.z_min=-vesicle->tape->plane_d/2.0;
+ vesicle->confinement_plane.z_max=vesicle->tape->plane_d/2.0;
+ ts_fprintf(stderr,"Vesicle confinement by plane set to (zmin, zmax)=(%e,%e).\n",vesicle->confinement_plane.z_min,vesicle->confinement_plane.z_max);
+ }
+
// fprintf(stderr, "DVol=%1.16f (%1.16f), V0=%1.16f\n", epsvol,0.003e-2*V0,V0);
if(start_iteration<inititer) ts_fprintf(stdout, "Starting simulation (first %d x %d MC sweeps will not be recorded on disk)\n", inititer, mcsweeps);
for(i=start_iteration;i<inititer+iterations;i++){
diff --git a/src/vertexmove.c b/src/vertexmove.c
index 2517f69..a3244b2 100644
--- a/src/vertexmove.c
+++ b/src/vertexmove.c
@@ -88,6 +88,14 @@
}
}
+
+ // plane confinement check whether the new position of vertex will be out of bounds
+ if(vesicle->tape->plane_confinement_switch){
+ if(vtx->z>vesicle->confinement_plane.z_max || vtx->z<vesicle->confinement_plane.z_min){
+ vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex));
+ return TS_FAIL;
+ }
+ }
//#undef SQ
//self avoidance check with distant vertices
cellidx=vertex_self_avoidance(vesicle, vtx);
--
Gitblit v1.8.0