Trisurf Monte Carlo simulator
Samo Penic
2016-07-03 22a18c527943300122e3117d5d81877c9ab6fa04
Stated to write tspoststat.c
1 files added
2 files modified
113 ■■■■■ changed files
src/Makefile.am 5 ●●●● patch | view | raw | blame | history
src/tsmeasure.c 1 ●●●● patch | view | raw | blame | history
src/tspoststat.c 107 ●●●●● patch | view | raw | blame | history
src/Makefile.am
@@ -1,4 +1,4 @@
bin_PROGRAMS = trisurf tsmeasure
bin_PROGRAMS = trisurf tsmeasure tspoststat
trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c dumpstate.c frame.c energy.c timestep.c vertexmove.c bondflip.c main.c poly.c stats.c sh.c shcomplex.c constvol.c snapshot.c restore.c
GITVERSION:=$(shell git --no-pager describe --tags --always --dirty)
AM_CFLAGS = -Wall -Werror -DTS_VERSION=\"$(GITVERSION)\" -fgnu89-inline
@@ -20,5 +20,8 @@
tsmeasure_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c dumpstate.c frame.c energy.c timestep.c vertexmove.c bondflip.c tsmeasure.c poly.c stats.c sh.c shcomplex.c constvol.c snapshot.c restore.c
tsmeasure_LDADD = ${libcurl_LIBS} ${libxml2_LIBS}
tspoststat_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c dumpstate.c frame.c energy.c timestep.c vertexmove.c bondflip.c tspoststat.c poly.c stats.c sh.c shcomplex.c constvol.c snapshot.c restore.c
tspoststat_LDADD = ${libcurl_LIBS} ${libxml2_LIBS}
#gitversion.c: .git/HEAD .git/index
#    echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
src/tsmeasure.c
@@ -84,7 +84,6 @@
            tape_free(vesicle->tape);
            vesicle_free(vesicle);
                }
        free(ent);
        }
    for (n = 0; n < count; n++)
      {
src/tspoststat.c
New file
@@ -0,0 +1,107 @@
/* vim: set ts=4 sts=4 sw=4 noet : */
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include "general.h"
//#include "vertex.h"
//#include "bond.h"
//#include "triangle.h"
//#include "cell.h"
#include "vesicle.h"
#include "io.h"
//#include "initial_distribution.h"
//#include "frame.h"
//#include "timestep.h"
//#include "poly.h"
#include "stats.h"
#include "sh.h"
#include "shcomplex.h"
#include "dumpstate.h"
#include "restore.h"
#include <string.h>
#include <getopt.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <snapshot.h>
#include<gsl/gsl_complex.h>
#include<gsl/gsl_complex_math.h>
ts_vesicle *restoreVesicle(char *filename){
    ts_vesicle *vesicle = parseDump(filename);
    return vesicle;
}
void vesicle_calculate_ulm2(ts_vesicle *vesicle){
    //complex_sph_free(vesicle->sphHarmonics);
    //vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
    vesicle_volume(vesicle);
    preparationSh(vesicle,getR0(vesicle));
    calculateUlmComplex(vesicle);
    ts_int i,j;
    for(i=0;i<vesicle->sphHarmonics->l;i++){
            for(j=i;j<2*i+1;j++){
            printf("%e ", gsl_complex_abs2(vesicle->sphHarmonics->ulmComplex[i][j]));
            }
    }
        printf("\n");
}
int main(){
    ts_vesicle *vesicle;
    ts_char *i,*j;
    ts_uint tstep,n;
        ts_char *number;
    struct dirent **list;
    ts_double l1,l2,l3;
    int count;
    ts_fprintf(stderr,"TRISURF-NG v. %s, compiled on: %s %s.\n", TS_VERSION, __DATE__, __TIME__);
    fprintf(stdout, "OuterLoop Volume Area lamdba1 lambda2 lambda3 Nb/Ncb\n");
    count=scandir(".",&list,0,alphasort);
    if(count<0){
        fatal("Error, cannot open directory.",1);
    }
        tstep=0;
    for(n=0;n<count;n++){
        struct dirent *ent;
        ent=list[n];
                i=rindex(ent->d_name,'.');
                if(i==NULL) {
                continue;
        }
                if(strcmp(i+1,"vtu")==0){
                    j=rindex(ent->d_name,'_');
                    if(j==NULL) continue;
                    number=strndup(j+1,j-i);
            quiet=1;
                    ts_fprintf(stdout,"timestep: %u filename: %s\n",atoi(number),ent->d_name);
//            printf("%u ",atoi(number));
            vesicle=restoreVesicle(ent->d_name);
//            vesicle_calculate_ulm2(vesicle);
            vesicle_volume(vesicle);
            vesicle_area(vesicle);
            gyration_eigen(vesicle,&l1,&l2,&l3);
            fprintf(stdout,"%d %.17e %.17e %.17e %.17e %.17e\n",atoi(number),vesicle->volume, vesicle->area,l1,l2,l3),
                        tstep++;
                    free(number);
            tape_free(vesicle->tape);
            vesicle_free(vesicle);
                }
        }
    for (n = 0; n < count; n++)
      {
          free(list[n]);
      }
    free(list);
    return 0;
}