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 +++++++++----------------------------------------
 1 files changed, 9 insertions(+), 40 deletions(-)

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.9.3