Trisurf Monte Carlo simulator
Samo Penic
2020-04-13 2a1e3d528265c3d366dab9ad4b0c4d3d65e1c4ed
Storing previously debugged version
10 files modified
2 files deleted
256 ■■■■■ changed files
src/bond.c 2 ●●● patch | view | raw | blame | history
src/bondflip.c 6 ●●●● patch | view | raw | blame | history
src/cell.c 6 ●●●● patch | view | raw | blame | history
src/initial_distribution.c 3 ●●●● patch | view | raw | blame | history
src/io.c 25 ●●●● patch | view | raw | blame | history
src/io.h 1 ●●●● patch | view | raw | blame | history
src/main.c 1 ●●●● patch | view | raw | blame | history
src/snapshot.c 2 ●●● patch | view | raw | blame | history
src/spherical_trisurf.c 107 ●●●●● patch | view | raw | blame | history
src/spherical_trisurf_ff.c 90 ●●●●● patch | view | raw | blame | history
src/tape 10 ●●●● patch | view | raw | blame | history
src/timestep.c 3 ●●●● patch | view | raw | blame | history
src/bond.c
@@ -23,7 +23,7 @@
    blist->n++;
    blist->bond=(ts_bond **)realloc(blist->bond,blist->n*sizeof(ts_bond *));
    if(blist->bond==NULL) fatal("Cannot reallocate memory for additional **ts_bond.",100);
    blist->bond[blist->n-1]=(ts_bond *)malloc(sizeof(ts_bond));
    blist->bond[blist->n-1]=(ts_bond *)calloc(1,sizeof(ts_bond));
    if(blist->bond[blist->n-1]==NULL) fatal("Cannot allocate memory for additional *ts_bond.",100);
    
    //NOW insert vertices into data!    
src/bondflip.c
@@ -32,7 +32,7 @@
    ts_vertex *k=bond->vtx2;
    ts_uint nei,neip,neim;
    ts_uint i,j;
    ts_double oldenergy, delta_energy, dvol=0.0, darea=0.0;
    ts_double oldenergy=0.0, delta_energy=0.0, dvol=0.0, darea=0.0;
    ts_triangle *lm=NULL,*lp=NULL, *lp1=NULL, *lm2=NULL;
    ts_vertex *kp,*km;
@@ -163,7 +163,7 @@
/* end backup vertex */
/* Save old energy */
  oldenergy=0;
  oldenergy=0.0;
  oldenergy+=k->xk* k->energy;
  oldenergy+=kp->xk* kp->energy;
  oldenergy+=km->xk* km->energy;
@@ -181,7 +181,7 @@
/* Calculating the new energy */
  delta_energy=0;
  delta_energy=0.0;
  delta_energy+=k->xk* k->energy;
  delta_energy+=kp->xk* kp->energy;
  delta_energy+=km->xk* km->energy;
src/cell.c
@@ -6,7 +6,7 @@
ts_cell_list  *init_cell_list(ts_uint ncmax1, ts_uint ncmax2, ts_uint ncmax3, ts_double stepsize){
    ts_uint i;
    ts_uint nocells=ncmax1*ncmax2*ncmax3;
    ts_cell_list *clist=(ts_cell_list *)malloc(sizeof(ts_cell_list));
    ts_cell_list *clist=(ts_cell_list *)calloc(1,sizeof(ts_cell_list));
    if(clist==NULL) fatal("Error while allocating memory for cell list!",100);
    clist->ncmax[0]=ncmax1;
@@ -15,8 +15,8 @@
    clist->cellno=nocells;
    clist->dcell=1.0/(1.0 + stepsize);
    clist->shift=(ts_double) clist->ncmax[0]/2;
    clist->cell=(ts_cell **)malloc(nocells*sizeof(ts_cell *));
    clist->max_occupancy=16; /* hard coded max occupancy? */
    clist->cell=(ts_cell **)calloc(nocells,sizeof(ts_cell *));
    if(clist->cell==NULL) fatal("Error while allocating memory for cell list! ncmax too large?",101);
    for(i=0;i<nocells;i++){
src/initial_distribution.c
@@ -103,7 +103,8 @@
    vesicle->clist->ncmax[0]=tape->ncxmax;
    vesicle->clist->ncmax[1]=tape->ncymax;
    vesicle->clist->ncmax[2]=tape->nczmax;
    vesicle->clist->max_occupancy=16; /* hard coded max occupancy? */
//THIS IS NOW HARDCODED IN CELL.C
//    vesicle->clist->max_occupancy=16; /* hard coded max occupancy? */
    vesicle->pressure= tape->pressure;
    vesicle->pswitch=tape->pswitch;
src/io.c
@@ -424,7 +424,8 @@
    vesicle->tape=parsetape(command_line_args.tape_fullfilename);
// recreating space for cells // 
    vesicle->clist=init_cell_list(vesicle->tape->ncxmax, vesicle->tape->ncymax, vesicle->tape->nczmax, vesicle->tape->stepsize);
    vesicle->clist->max_occupancy=16;
//THIS IS HARDCODED IN CELL.C NOW
//    vesicle->clist->max_occupancy=16;
//    vesicle->tape=(ts_tape *)malloc(sizeof(ts_tape));
//    retval=fread(vesicle->tape, sizeof(ts_tape),1,fh);
    retval=fread(iteration,sizeof(ts_uint),1,fh);
@@ -750,22 +751,6 @@
}
ts_bool write_dout_fcompat_file(ts_vesicle *vesicle, ts_char *filename){
    FILE *fh;
    fh=fopen(filename, "w");
    if(fh==NULL){
        err("Cannot open file %s for writing");
        return TS_FAIL;
    }
    fprintf(fh,"%.17E\n%.17E\n",vesicle->stepsize,vesicle->dmax);
    fprint_vertex_list(fh,vesicle->vlist);
    fprint_tristar(fh,vesicle);
    fprint_triangle_list(fh,vesicle);
    fprint_vertex_data(fh,vesicle->vlist);
    fprint_bonds(fh,vesicle);
    fclose(fh);
    return TS_SUCCESS;
}
ts_bool read_tape_fcompat_file(ts_vesicle *vesicle, ts_char *filename){
    FILE *fh;
@@ -845,7 +830,8 @@
    ts_uint monono=0, polyno=0, poly_idx=0, filno=0, fonono=0;
    ts_bool poly=0, fil=0;
    if(vesicle->poly_list!=NULL){
        if(vesicle->poly_list->poly[0]!=NULL){
        if(vesicle->poly_list->n!=0){
        //if(vesicle->poly_list->poly[0]!=NULL){
        polyno=vesicle->poly_list->n;
        monono=vesicle->poly_list->poly[0]->vlist->n;
        poly=1;
@@ -853,7 +839,8 @@
    }
    if(vesicle->filament_list!=NULL){
        if(vesicle->filament_list->poly[0]!=NULL){
        if(vesicle->filament_list->n!=0){
        //if(vesicle->filament_list->poly[0]!=NULL){
        filno=vesicle->filament_list->n;
        fonono=vesicle->filament_list->poly[0]->vlist->n;
        fil=1;
src/io.h
@@ -61,7 +61,6 @@
ts_bool fprint_triangle_list(FILE *fh, ts_vesicle *vesicle);
ts_bool fprint_vertex_data(FILE *fh,ts_vertex_list *vlist);
ts_bool fprint_bonds(FILE *fh,ts_vesicle *vesicle);
ts_bool write_dout_fcompat_file(ts_vesicle *vesicle, ts_char *filename);
ts_bool read_tape_fcompat_file(ts_vesicle *vesicle, ts_char *filename);
src/main.c
@@ -133,7 +133,6 @@
            //write_vertex_xml_file(vesicle,1000);
    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");
    vesicle_free(vesicle);
    tape_free(tape);
    return 0; //program finished perfectly ok. We return 0.
src/snapshot.c
@@ -23,7 +23,7 @@
/* outputs additional data into paraview xml file */
ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle){
    ts_string *data=(ts_string *)malloc(sizeof(ts_sprintf));
    ts_string *data=(ts_string *)malloc(sizeof(ts_string));
    data->string=(char *)malloc(5120000*sizeof(char)); /*TODO: warning, can break if the string is to long */
    data->beg=0;
    
src/spherical_trisurf.c
File was deleted
src/spherical_trisurf_ff.c
File was deleted
src/tape
@@ -1,6 +1,6 @@
####### Vesicle definitions ###########
# nshell is a number of divisions of dipyramid
nshell=17
nshell=7
# dmax is the max. bond length (in units l_min)
dmax=1.7
# dmin_interspecies in the min. dist. between different vertex species (in units l_min)
@@ -25,7 +25,7 @@
#Stretching
stretchswitch=1
stretchswitch=0
xkA0=1.0
####### Polymer (brush) definitions ###########
@@ -67,7 +67,7 @@
inititer=0
#how many records do you want on the disk iteration are there in a run?
#10000
iterations=100
iterations=10
###### Spherical harmonics ###########
@@ -92,7 +92,7 @@
#number of vertices with spontaneous curvature (integer)
number_of_vertices_with_c0=100
number_of_vertices_with_c0=0
#c0/2 is spontaneous curvature. c0 is used as (c1+c1-c0)^2 in energy term (float)
c0=0.5
#energy of attraction of vertices with spontaneous curvature (float, positive value for attraction)
@@ -103,7 +103,7 @@
#plane confinement
plane_confinement_switch=1
plane_confinement_switch=0
#final plane distance (float in lmin)
plane_d=10
#plane to vesicle repulsion force while closing
src/timestep.c
@@ -124,7 +124,8 @@
        bfsr/=(ts_double)mcsweeps;
        centermass(vesicle);
        cell_occupation(vesicle);
                dump_state(vesicle,i);
/* BINARY DUMPS ARE OBSOLETE. SHOULD WORK AS OF MAR 2020, BUT NO LONGER MAINTAINED */
//                dump_state(vesicle,i);
            vesicle_volume(vesicle); //calculates just volume. 
                    vesicle_area(vesicle); //calculates area.
        if(vesicle->tape->constvolswitch==0){