Trisurf Monte Carlo simulator
Samo Penic
2016-09-15 3cd5f4a96d445b55da8a7e6da8509bbd7d5d41b8
Fixes #19.
3 files modified
17 ■■■■ changed files
src/main.c 1 ●●●● patch | view | raw | blame | history
src/poly.c 9 ●●●●● patch | view | raw | blame | history
src/restore.c 7 ●●●● patch | view | raw | blame | history
src/main.c
@@ -48,6 +48,7 @@
        ts_fprintf(stdout,"**** Restoring vesicle from VTK points list ****\n");
        ts_fprintf(stdout,"************************************************\n\n");
        vesicle = parseDump(command_line_args.dump_from_vtk);
//        write_vertex_xml_file(vesicle,9999); // here you can test if restoration and rewritting results in the same dump file. Only the date od creation of dump file must differ.
        tape = vesicle->tape;
        int arguments_no;
        FILE *fd=fopen(".status","r");
src/poly.c
@@ -156,9 +156,9 @@
ts_bool poly_free(ts_poly *poly){
    if (poly->grafted_vtx!=NULL){
        poly->grafted_vtx->grafted_poly=NULL;
    }
//    if (poly->grafted_vtx!=NULL){
//        poly->grafted_vtx->grafted_poly=NULL;
//    }
    vtx_list_free(poly->vlist);
    bond_list_free(poly->blist);
    free(poly);
@@ -168,8 +168,9 @@
ts_bool poly_list_free(ts_poly_list *poly_list){
    ts_uint i;
    //fprintf(stderr,"no. of polys=%d\n", poly_list->n);
    for(i=0;i<poly_list->n;i++){
    //    fprintf(stderr,"%d poly address in mem=%ld\n",i+1,(long)&(poly_list->poly[i]));
        poly_free(poly_list->poly[i]);
    }
    free(poly_list->poly);
src/restore.c
@@ -372,6 +372,7 @@
    char *b;
    int idx, polyidx;
    char *token[2];
    int temp_cnt=0;
    while (child != NULL) {
        conname=xmlGetProp(child, (xmlChar *)"Name");
        if ((!xmlStrcmp(child->name, (const xmlChar *)"DataArray")) && !xmlStrcmp(conname, (const xmlChar *)"connectivity") ){
@@ -383,11 +384,15 @@
            while(token[0]!=NULL){
                if(idx<3*(vesicle->vlist->n-2)){
                    bond_add(vesicle->blist, vesicle->vlist->vtx[atoi(token[0])], vesicle->vlist->vtx[atoi(token[1])]);
                    //fprintf(stderr,"Bonds in vesicle count idx=%d\n",idx);
                }
                else {
                //find grafted vtx
                    if(vesicle->tape->npoly && vesicle->tape->nmono && (vesicle->tape->nmono-1)==(idx-3*(vesicle->vlist->n-2))%(vesicle->tape->nmono)
                        && idx<(3*vesicle->vlist->n-2+vesicle->tape->nmono*vesicle->tape->npoly+vesicle->tape->npoly)){
                        && idx<(3*vesicle->vlist->n-2+vesicle->tape->nmono*vesicle->tape->npoly)){
                        temp_cnt++;
                        //fprintf(stderr,"%d: Bonds in poly count idx=%d, t1=%s t2=%s\n",temp_cnt,idx, token[0], token[1]);
                        polyidx=(idx-3*(vesicle->vlist->n-2))/(vesicle->tape->nmono);
                        //fprintf(stderr,"poly=%d, vertex=%d\n",polyidx,atoi(token[0]));
                        vesicle->poly_list->poly[polyidx]->grafted_vtx=vesicle->vlist->vtx[atoi(token[0])];