Trisurf Monte Carlo simulator
Samo Penic
2018-06-27 6da644f98434d3eac8b4e19981754f6030a315a5
Resolving the issues with restoring vesicles from vtu and fixing the volume. Dump to vtu has been repaired.
4 files modified
20 ■■■■ changed files
src/main.c 1 ●●●● patch | view | raw | blame | history
src/snapshot.c 12 ●●●● patch | view | raw | blame | history
src/timestep.c 4 ●●●● patch | view | raw | blame | history
src/vertexmove.c 3 ●●●● patch | view | raw | blame | history
src/main.c
@@ -131,6 +131,7 @@
//    exit(1);
            //write_vertex_xml_file(vesicle,1000);
    fprintf(stderr,"constvol=%ld, precision=%e\n", tape->constvolswitch, tape->constvolprecision);
    run_simulation(vesicle, tape->mcsweeps, tape->inititer, tape->iterations, start_iteration);
    write_master_xml_file(command_line_args.output_fullfilename);
    write_dout_fcompat_file(vesicle,"dout");
src/snapshot.c
@@ -22,7 +22,7 @@
/* outputs additional data into paraview xml file */
ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle){
    ts_double cvol_write=0, carea_write=0;
    ts_string *data=(ts_string *)malloc(sizeof(ts_sprintf));
    data->string=(char *)malloc(5120000*sizeof(char)); /*TODO: warning, can break if the string is to long */
    data->beg=0;
@@ -33,7 +33,15 @@
    xml_trisurf_vtx_neigh(data,vesicle->vlist);    
    xml_trisurf_vtx_tristar(data,vesicle->vlist);
    xml_trisurf_nucleus(data,vesicle);
    xml_trisurf_constvolarea(data,V0,A0);
    if(vesicle->tape->constvolswitch==0)
        cvol_write=vesicle->volume;
    else
        cvol_write=V0;
    if(vesicle->tape->constareaswitch==0)
        carea_write=vesicle->area;
    else
        carea_write=A0;
    xml_trisurf_constvolarea(data,cvol_write,carea_write);
#ifdef COMPRESSION
    char *compressed;
    ts_uint nbytes=ts_compress_string64(data->string, data->beg-1, &compressed); //suppress null character at the end with by substracting 1
src/timestep.c
@@ -92,12 +92,12 @@
        cell_occupation(vesicle);
            dump_state(vesicle,i);
        if(i>=inititer){
            vesicle_volume(vesicle); //calculates just volume.
                    vesicle_area(vesicle); //calculates area.
            write_vertex_xml_file(vesicle,i-inititer,NULL);
            write_master_xml_file(command_line_args.output_fullfilename);
            epochtime=get_epoch();            
            gyration_eigen(vesicle, &l1, &l2, &l3);
            vesicle_volume(vesicle); //calculates just volume.
            vesicle_area(vesicle); //calculates area.
            r0=getR0(vesicle);
            if(vesicle->sphHarmonics!=NULL){
                preparationSh(vesicle,r0);
src/vertexmove.c
@@ -165,7 +165,7 @@
    if(vesicle->tape->constvolswitch==2){
        /*check whether the dvol is gt than epsvol */
            //fprintf(stderr,"DVOL=%1.16e\n",dvol);
            //fprintf(stderr,"DVOL=%1.16e, V0=%1.16e, vesicleVolume=%1.16e, |volume+dvol-V0|=%1.16e\n",dvol, V0, vesicle->volume, fabs(vesicle->volume+dvol-V0));
        if(fabs(vesicle->volume+dvol-V0)>epsvol){
            //restore old state.
             vtx=memcpy((void *)vtx,(void *)&backupvtx[0],sizeof(ts_vertex));
@@ -178,6 +178,7 @@
        }
    } else
        //fprintf(stderr, "success\n");
//    vesicle_volume(vesicle);
//    fprintf(stderr,"Volume before=%1.16e\n", vesicle->volume);
   if(vesicle->tape->constvolswitch == 1){