| | |
| | | #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; |
| | |
| | | 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++){ |
| | |
| | | |
| | | /* 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; |
| | |
| | | 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); |
| | | |