10 files modified
4 files deleted
| | |
| | | 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! |
| | |
| | | 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; |
| | |
| | | /* 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; |
| | |
| | | |
| | | |
| | | /* 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; |
| | |
| | | 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; |
| | |
| | | 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++){ |
| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | 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; |
| | |
| | | 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); |
| | | |
| | | |
| | |
| | | //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. |
| | |
| | | /* 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; |
| | | |
| | |
| | | ####### 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) |
| | |
| | | |
| | | |
| | | #Stretching |
| | | stretchswitch=1 |
| | | stretchswitch=0 |
| | | xkA0=1.0 |
| | | |
| | | ####### Polymer (brush) definitions ########### |
| | |
| | | inititer=0 |
| | | #how many records do you want on the disk iteration are there in a run? |
| | | #10000 |
| | | iterations=100 |
| | | iterations=10 |
| | | |
| | | |
| | | ###### Spherical harmonics ########### |
| | |
| | | |
| | | |
| | | #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) |
| | |
| | | |
| | | |
| | | #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 |
| | |
| | | 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){ |