From 3006183b769f2e126b1a96e6bf697c2b7f657df7 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sun, 26 Apr 2020 17:35:26 +0000
Subject: [PATCH] Code for incremental adding of inclusions done
---
src/timestep.c | 49 ++++--------------------
src/initial_distribution.h | 2 +
src/tape | 16 ++++----
src/initial_distribution.c | 25 ++++++++----
4 files changed, 36 insertions(+), 56 deletions(-)
diff --git a/src/initial_distribution.c b/src/initial_distribution.c
index 21eda68..23c5827 100644
--- a/src/initial_distribution.c
+++ b/src/initial_distribution.c
@@ -122,13 +122,23 @@
ts_bool initial_population_with_c0(ts_vesicle *vesicle, ts_tape *tape){
- int rndvtx,i,j;
+// OVERRIDE! JUST FOR TEST BRANCH!!!
+// WARNING !!!!
+// WARNING !!!!
+// WARNING !!!!
+ return TS_SUCCESS;
if(tape->number_of_vertices_with_c0>0){
// ts_fprintf(stderr,"Setting values for spontaneous curvature as defined in tape\n");
- j=0;
- for(i=0;i<tape->number_of_vertices_with_c0;i++){
+ add_vertices_with_c0(vesicle, tape->number_of_vertices_with_c0, tape->c0, tape->w);
+ }
+ return TS_SUCCESS;
+}
+
+ts_bool add_vertices_with_c0(ts_vesicle *vesicle, ts_int n, ts_double c0, ts_double w){
+ ts_int rndvtx,i,j=0;
+ for(i=0;i<n;i++){
rndvtx=rand() % vesicle->vlist->n;
- if(fabs(vesicle->vlist->vtx[rndvtx]->c-tape->c0)<1e-15){
+ if(fabs(vesicle->vlist->vtx[rndvtx]->c-c0)<1e-15){
j++;
i--;
if(j>10*vesicle->vlist->n){
@@ -136,17 +146,16 @@
}
continue;
}
- vesicle->vlist->vtx[rndvtx]->c=tape->c0;
+ vesicle->vlist->vtx[rndvtx]->c=c0;
}
mean_curvature_and_energy(vesicle);
- if(fabs(tape->w)>1e-16){ //if nonzero energy
+ if(fabs(w)>1e-16){ //if nonzero energy
// ts_fprintf(stderr,"Setting attraction between vertices with spontaneous curvature\n");
sweep_attraction_bond_energy(vesicle);
}
- }
return TS_SUCCESS;
-}
+}
ts_bool pentagonal_dipyramid_vertex_distribution(ts_vertex_list *vlist){
/* Some often used relations */
diff --git a/src/initial_distribution.h b/src/initial_distribution.h
index e54ee08..8af71f8 100644
--- a/src/initial_distribution.h
+++ b/src/initial_distribution.h
@@ -22,6 +22,8 @@
* @param *vlist is a pointer to list of vertices
* @returns TS_SUCCESS on success, TS_FAIL otherwise
*/
+ts_bool add_vertices_with_c0(ts_vesicle *vesicle, ts_int n, ts_double c0, ts_double w);
+
ts_bool pentagonal_dipyramid_vertex_distribution(ts_vertex_list *vlist);
/** Finds the neighbouring vertices and add them to a list of each vertex
diff --git a/src/tape b/src/tape
index d2965a6..1e96bcb 100644
--- a/src/tape
+++ b/src/tape
@@ -1,12 +1,12 @@
####### Vesicle definitions ###########
# nshell is a number of divisions of dipyramid
-nshell=7
+nshell=10
# 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.2
# bending rigidity of the membrane (in units kT)
-xk0=10.0
+xk0=20.0
# max step size (in units l_min)
stepsize=0.15
@@ -30,9 +30,9 @@
####### Polymer (brush) definitions ###########
# npoly is a number of polymers attached to npoly distinct vertices on vesicle
-npoly=10
+npoly=0
# nmono is a number of monomers in each polymer
-nmono=20
+nmono=0
# Spring constant between monomers of the polymer
k_spring=800
#set to 1 if half of the polymeres are inside the vesicle
@@ -61,13 +61,13 @@
####### Program Control ############
#how many MC sweeps between subsequent records of states to disk
#200000
-mcsweeps=200
+mcsweeps=2000
#how many initial mcsweeps*inititer MC sweeps before recording to disk?
#2
inititer=0
#how many records do you want on the disk iteration are there in a run?
#10000
-iterations=10
+iterations=100
###### Spherical harmonics ###########
@@ -92,13 +92,13 @@
#number of vertices with spontaneous curvature (integer)
-number_of_vertices_with_c0=0
+number_of_vertices_with_c0=400
#c0/2 is spontaneous curvature. c0 is used as (c1+c1-c0)^2 in energy term (float)
c0=0.5
#energy of attraction of vertices with spontaneous curvature (float, positive value for attraction)
w=10.0
#direct force on vesicles with spontaneous curvature (float)
-F=2.0
+F=0.0
diff --git a/src/timestep.c b/src/timestep.c
index 66b3a39..fe0ca24 100644
--- a/src/timestep.c
+++ b/src/timestep.c
@@ -17,7 +17,7 @@
#include<gsl/gsl_complex_math.h>
#include<string.h>
#include <sys/stat.h>
-
+#include "initial_distribution.h"
ts_bool run_simulation(ts_vesicle *vesicle, ts_uint mcsweeps, ts_uint inititer, ts_uint iterations, ts_uint start_iteration){
ts_uint i, j,k; //,l,m;
@@ -75,6 +75,9 @@
epsvol=4.0*sqrt(2.0*M_PI)/pow(3.0,3.0/4.0)*V0/pow(vesicle->tlist->n,3.0/2.0);
// printf("epsvol=%e\n",epsvol);
epsarea=A0/(ts_double)vesicle->tlist->n;
+
+ int delta_number_c0=ceil((float)vesicle->tape->number_of_vertices_with_c0/(float)(iterations-1));
+ ts_fprintf(stdout, "Adding additional %d inclusions every %d iterations (%d times, total=%d).\n",delta_number_c0, mcsweeps, (vesicle->tape->number_of_vertices_with_c0)/delta_number_c0,(vesicle->tape->number_of_vertices_with_c0/delta_number_c0)*delta_number_c0);
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++){
@@ -112,6 +115,11 @@
/* vesicle_volume(vesicle);
fprintf(stderr,"Volume before TS=%1.16e\n", vesicle->volume); */
+
+ if(i*delta_number_c0<vesicle->tape->number_of_vertices_with_c0){
+ fprintf(stdout, "Adding %d inclusions.\n", delta_number_c0);
+ add_vertices_with_c0(vesicle, delta_number_c0, vesicle->tape->c0, vesicle->tape->w);
+ }
for(j=0;j<mcsweeps;j++){
single_timestep(vesicle, &vmsrt, &bfsrt);
vmsr+=vmsrt;
@@ -140,45 +148,6 @@
epochtime=get_epoch();
gyration_eigen(vesicle, &l1, &l2, &l3);
//r0=getR0(vesicle);
-/* if(vesicle->sphHarmonics!=NULL){
- preparationSh(vesicle,r0);
- //calculateYlmi(vesicle);
- calculateUlmComplex(vesicle);
- storeUlmComplex2(vesicle);
- saveAvgUlm2(vesicle);
- kc1=calculateKc(vesicle, 2,9);
- kc2=calculateKc(vesicle, 6,9);
- kc3=calculateKc(vesicle, 2,vesicle->sphHarmonics->l);
- kc4=calculateKc(vesicle, 3,6);
-
- strcpy(filename,command_line_args.path);
- strcat(filename,"state.dat");
- fd1=fopen(filename,"w");
- fprintf(fd1,"%e %e\n",vesicle->volume, getR0(vesicle));
- for(k=0;k<vesicle->vlist->n;k++){
- fprintf(fd1,"%e %e %e %e %e\n",
- vesicle->vlist->vtx[k]->x,
- vesicle->vlist->vtx[k]->y,
- vesicle->vlist->vtx[k]->z,
- vesicle->vlist->vtx[k]->solAngle,
- vesicle->vlist->vtx[k]->relR
- );
- }
- fclose(fd1);
-
- fprintf(fd2,"%u ", i);
- for(l=0;l<vesicle->sphHarmonics->l;l++){
- for(m=l;m<2*l+1;m++){
- fprintf(fd2,"%e ", gsl_complex_abs2(vesicle->sphHarmonics->ulmComplex[l][m]) );
- }
- }
- fprintf(fd2,"\n");
-
- fflush(fd2);
-
-
- }
-*/
fprintf(fd, "%lu %u %e %e %1.16e %1.16e %1.16e %1.16e %1.16e %1.16e %1.16e %1.16e %1.16e\n",epochtime,i,vmsr,bfsr,vesicle->volume, vesicle->area,l1,l2,l3,kc1, kc2, kc3,kc4);
--
Gitblit v1.8.0