Trisurf Monte Carlo simulator
Samo Penic
2014-04-09 dc77e8ef10378188ee0a9657cedd1b7991a0a29f
Added spherical harmonics as-is into rbc
11 files modified
98 ■■■■ changed files
src/Makefile.am 2 ●●● patch | view | raw | blame | history
src/initial_distribution.c 3 ●●●● patch | view | raw | blame | history
src/io.c 1 ●●●● patch | view | raw | blame | history
src/io.h 1 ●●●● patch | view | raw | blame | history
src/main.c 2 ●●●●● patch | view | raw | blame | history
src/sh.c 25 ●●●●● patch | view | raw | blame | history
src/sh.h 1 ●●●● patch | view | raw | blame | history
src/spherical_trisurf.c 23 ●●●●● patch | view | raw | blame | history
src/spherical_trisurf_ff.c 24 ●●●●● patch | view | raw | blame | history
src/tape 5 ●●●● patch | view | raw | blame | history
src/timestep.c 11 ●●●●● patch | view | raw | blame | history
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
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;
}
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;    
src/io.h
@@ -35,6 +35,7 @@
    long int inititer;
    long int mcsweeps;
    long int quiet;
    long int shc;
} ts_tape;
typedef struct{
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++;
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;
}
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
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;
}
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;
}
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
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);