From dc77e8ef10378188ee0a9657cedd1b7991a0a29f Mon Sep 17 00:00:00 2001 From: Samo Penic <samo@CAE-linux.(none)> Date: Wed, 09 Apr 2014 21:27:38 +0000 Subject: [PATCH] Added spherical harmonics as-is into rbc --- src/Makefile.am | 2 src/main.c | 2 + src/timestep.c | 11 +++++ src/io.c | 1 src/sh.h | 1 src/tape | 5 ++ src/spherical_trisurf.c | 23 ----------- src/initial_distribution.c | 3 + src/spherical_trisurf_ff.c | 24 ------------ src/sh.c | 25 ++++++++++++ src/io.h | 1 11 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 204da92..970dec2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ trisurfdir=../ trisurf_PROGRAMS = trisurf -trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c bondflip.c main.c poly.c stats.c +trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c bondflip.c main.c poly.c stats.c sh.c #trisurf_LDFLAGS = -lm -lconfuse shdiscoverdir=../ shdiscover_PROGRAMS= shdiscover diff --git a/src/initial_distribution.c b/src/initial_distribution.c index 0587d18..7d5647c 100644 --- a/src/initial_distribution.c +++ b/src/initial_distribution.c @@ -11,6 +11,7 @@ #include "energy.h" #include "poly.h" #include "io.h" +#include "sh.h" ts_vesicle *initial_distribution_dipyramid(ts_uint nshell, ts_uint ncmax1, ts_uint ncmax2, ts_uint ncmax3, ts_double stepsize){ ts_fprintf(stdout,"Starting initial_distribution on vesicle with %u shells!...\n",nshell); @@ -92,7 +93,7 @@ vesicle->pressure= tape->pressure; vesicle->pswitch=tape->pswitch; - + vesicle->sphHarmonics=sph_init(vesicle->vlist,tape->shc); return vesicle; } diff --git a/src/io.c b/src/io.c index a25b16c..d001b7e 100644 --- a/src/io.c +++ b/src/io.c @@ -988,6 +988,7 @@ CFG_SIMPLE_INT("smp_cores",&tape->brezveze0), CFG_SIMPLE_INT("cluster_nodes",&tape->brezveze1), CFG_SIMPLE_INT("distributed_processes",&tape->brezveze2), + CFG_SIMPLE_INT("spherical_harmonics_coefficients",&tape->shc), CFG_END() }; cfg_t *cfg; diff --git a/src/io.h b/src/io.h index 117c9ff..699c73e 100644 --- a/src/io.h +++ b/src/io.h @@ -35,6 +35,7 @@ long int inititer; long int mcsweeps; long int quiet; + long int shc; } ts_tape; typedef struct{ diff --git a/src/main.c b/src/main.c index eef5835..63b72cf 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,7 @@ #include "frame.h" #include "timestep.h" #include "poly.h" +#include "sh.h" /** Entrance function to the program * @param argv is a number of parameters used in program call (including the program name @@ -50,6 +51,7 @@ vesicle->dmax=tape->dmax*tape->dmax; poly_assign_filament_xi(vesicle,tape); vesicle->clist->dmin_interspecies = tape->dmin_interspecies*tape->dmin_interspecies; + vesicle->sphHarmonics=sph_init(vesicle->vlist,tape->shc); if(command_line_args.reset_iteration_count) start_iteration=tape->inititer; else start_iteration++; diff --git a/src/sh.c b/src/sh.c index 0c4b06d..9f28d2f 100644 --- a/src/sh.c +++ b/src/sh.c @@ -379,3 +379,28 @@ sph->N++; return TS_SUCCESS; } + + +ts_bool saveAvgUlm2(ts_vesicle *vesicle){ + + FILE *fh; + + fh=fopen("sph2out.dat", "w"); + if(fh==NULL){ + err("Cannot open file %s for writing"); + return TS_FAIL; + } + + ts_spharm *sph=vesicle->sphHarmonics; + ts_int i,j; + fprintf(fh,"l,\tm,\tulm^2avg\n"); + for(i=0;i<sph->l;i++){ + for(j=0;j<2*i+1;j++){ + fprintf(fh,"%d,\t%d,\t%e\n", i, j-i, sph->sumUlm2[i][j]/(ts_double)sph->N); + + } + fprintf(fh,"\n"); + } + fclose(fh); + return TS_SUCCESS; +} diff --git a/src/sh.h b/src/sh.h index 7853139..32df46b 100644 --- a/src/sh.h +++ b/src/sh.h @@ -13,4 +13,5 @@ ts_bool preparationSh(ts_vesicle *vesicle, ts_double r0); ts_bool calculateYlmi(ts_vesicle *vesicle); ts_bool calculateUlm(ts_vesicle *vesicle); +ts_bool saveAvgUlm2(ts_vesicle *vesicle); #endif diff --git a/src/spherical_trisurf.c b/src/spherical_trisurf.c index 6c5946f..0669981 100644 --- a/src/spherical_trisurf.c +++ b/src/spherical_trisurf.c @@ -104,26 +104,3 @@ -ts_bool saveAvgUlm2(ts_vesicle *vesicle){ - - FILE *fh; - - fh=fopen("sph2out.dat", "w"); - if(fh==NULL){ - err("Cannot open file %s for writing"); - return TS_FAIL; - } - - ts_spharm *sph=vesicle->sphHarmonics; - ts_int i,j; - fprintf(fh,"l,\tm,\tulm^2avg\n"); - for(i=0;i<sph->l;i++){ - for(j=0;j<2*i+1;j++){ - fprintf(fh,"%d,\t%d,\t%e\n", i, j-i, sph->sumUlm2[i][j]/(ts_double)sph->N); - - } - fprintf(fh,"\n"); - } - fclose(fh); - return TS_SUCCESS; -} diff --git a/src/spherical_trisurf_ff.c b/src/spherical_trisurf_ff.c index 00a4cc0..157b0e4 100644 --- a/src/spherical_trisurf_ff.c +++ b/src/spherical_trisurf_ff.c @@ -87,27 +87,3 @@ } - -ts_bool saveAvgUlm2(ts_vesicle *vesicle){ - - FILE *fh; - - fh=fopen("sph2out.dat", "w"); - if(fh==NULL){ - err("Cannot open file %s for writing"); - return TS_FAIL; - } - - ts_spharm *sph=vesicle->sphHarmonics; - ts_int i,j; - fprintf(fh,"l,\tm,\tulm^2avg\n"); - for(i=0;i<sph->l;i++){ - for(j=0;j<2*i+1;j++){ - fprintf(fh,"%d,\t%d,\t%e\n", i, j-i, sph->sumUlm2[i][j]/(ts_double)sph->N); - - } - fprintf(fh,"\n"); - } - fclose(fh); - return TS_SUCCESS; -} diff --git a/src/tape b/src/tape index dbaabdb..833acaa 100644 --- a/src/tape +++ b/src/tape @@ -48,9 +48,12 @@ #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? -iterations=20 +iterations=2000 +###### Spherical harmonics ########### +spherical_harmonics_coefficients=21 + #shut up if we are using cluster!!! quiet=false diff --git a/src/timestep.c b/src/timestep.c index 9ab60fd..c61099b 100644 --- a/src/timestep.c +++ b/src/timestep.c @@ -9,9 +9,12 @@ #include "frame.h" #include "io.h" #include "stats.h" +#include "sh.h" +#include "vesicle.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; + ts_double r0; ts_double l1,l2,l3,volume=0.0,area=0.0,vmsr,bfsr, vmsrt, bfsrt; ts_ulong epochtime; // char filename[255]; @@ -43,6 +46,14 @@ epochtime=get_epoch(); gyration_eigen(vesicle, &l1, &l2, &l3); get_area_volume(vesicle, &area,&volume); + vesicle_volume(vesicle); + r0=getR0(vesicle); + preparationSh(vesicle,r0); + calculateYlmi(vesicle); + calculateUlm(vesicle); + storeUlm2(vesicle); + saveAvgUlm2(vesicle); + fprintf(fd, "%lu %u %e %e %e %e %e %e %e\n",epochtime,i,vmsr,bfsr,volume, area,l1,l2,l3); // sprintf(filename,"timestep-%05d.pov",i-inititer); -- Gitblit v1.9.3