src/bond.c | ●●●●● patch | view | raw | blame | history | |
src/energy.c | ●●●●● patch | view | raw | blame | history | |
src/general.h | ●●●●● patch | view | raw | blame | history | |
src/io.c | ●●●●● patch | view | raw | blame | history |
src/bond.c
@@ -15,8 +15,8 @@ if(vtx1==NULL || vtx2==NULL) return NULL; /* Verify if the bond already exists... Don't do multiple bonds */ for(i=0;i<blist->n;i++){ if((blist->bond[i]->data->vtx1==vtx1 || blist->bond[i]->data->vtx1==vtx2) &&(blist->bond[i]->data->vtx2==vtx1 || blist->bond[i]->data->vtx2==vtx2)) if((blist->bond[i]->vtx1==vtx1 || blist->bond[i]->vtx1==vtx2) &&(blist->bond[i]->vtx2==vtx1 || blist->bond[i]->vtx2==vtx2)) return blist->bond[i]; } blist->n++; @@ -24,11 +24,10 @@ if(blist->bond==NULL) fatal("Cannot reallocate memory for additional **ts_bond.",100); blist->bond[blist->n-1]=(ts_bond *)malloc(sizeof(ts_bond)); if(blist->bond[blist->n-1]==NULL) fatal("Cannot allocate memory for additional *ts_bond.",100); blist->bond[blist->n-1]->data=(ts_bond_data *)malloc(sizeof(ts_bond_data)); //NOW insert vertices into data! blist->bond[blist->n - 1]->data->vtx1=vtx1; blist->bond[blist->n - 1]->data->vtx2=vtx2; blist->bond[blist->n - 1]->vtx1=vtx1; blist->bond[blist->n - 1]->vtx2=vtx2; //Should we calculate bond length NOW? @@ -38,7 +37,6 @@ ts_bool bond_list_free(ts_bond_list *blist){ ts_uint i; for(i=0;i<blist->n;i++){ free(blist->bond[i]->data); free(blist->bond[i]); } free(blist->bond); src/energy.c
@@ -74,16 +74,16 @@ tot=0.5*tot; xlen=vtx_distance_sq(j,vtx); #ifdef TS_DOUBLE_DOUBLE data->bond[jj-1]->data->bond_length=sqrt(xlen); data->bond[jj-1]->bond_length=sqrt(xlen); #endif #ifdef TS_DOUBLE_FLOAT data->bond[jj-1]->data->bond_length=sqrtf(xlen); data->bond[jj-1]->bond_length=sqrtf(xlen); #endif #ifdef TS_DOUBLE_LONGDOUBLE data->bond[jj-1]->data->bond_length=sqrtl(xlen); data->bond[jj-1]->bond_length=sqrtl(xlen); #endif data->bond[jj-1]->data->bond_length_dual=tot*data->bond[jj-1]->data->bond_length; data->bond[jj-1]->bond_length_dual=tot*data->bond[jj-1]->bond_length; s+=tot*xlen; xh+=tot*(j->data->x - data->x); src/general.h
@@ -149,18 +149,12 @@ } ts_vertex_list; /** ts_bond_data is a structure that describes a bond */ typedef struct { struct ts_bond { ts_uint idx; ts_vertex *vtx1; ts_vertex *vtx2; ts_double bond_length; ts_double bond_length_dual; } ts_bond_data; struct ts_bond { ts_uint idx; ts_bond_data *data; }; typedef struct ts_bond ts_bond; src/io.c
@@ -108,11 +108,11 @@ vlist->vtx[i]->data->xk,vlist->vtx[i]->data->c,vlist->vtx[i]->data->energy, vlist->vtx[i]->data->energy_h, vlist->vtx[i]->data->curvature, 0); for(j=0;j<vlist->vtx[i]->data->neigh_no;j++){ fprintf(fh," %.17E", vlist->vtx[i]->data->bond[j]->data->bond_length_dual); fprintf(fh," %.17E", vlist->vtx[i]->data->bond[j]->bond_length_dual); } fprintf(fh,"\n"); for(j=0;j<vlist->vtx[i]->data->neigh_no;j++){ fprintf(fh," %.17E", vlist->vtx[i]->data->bond[j]->data->bond_length); fprintf(fh," %.17E", vlist->vtx[i]->data->bond[j]->bond_length); } fprintf(fh,"\n"); } @@ -122,9 +122,9 @@ ts_bool fprint_bonds(FILE *fh,ts_vesicle *vesicle){ ts_uint i; for(i=0;i<vesicle->blist->n;i++){ fprintf(fh,"\t%u\t%u\n",(ts_uint)(vesicle->blist->bond[i]->data->vtx1->idx), fprintf(fh,"\t%u\t%u\n",(ts_uint)(vesicle->blist->bond[i]->vtx1->idx), //-vesicle->vlist->vtx+1), (ts_uint)(vesicle->blist->bond[i]->data->vtx2->idx)); (ts_uint)(vesicle->blist->bond[i]->vtx2->idx)); //-vesicle->vlist.vtx+1)); } return TS_SUCCESS; @@ -231,7 +231,7 @@ fprintf(fh,"</DataArray>\n</Points>\n<Cells>\n<DataArray type=\"Int64\" Name=\"connectivity\" format=\"ascii\">"); for(i=0;i<blist->n;i++){ fprintf(fh,"%u %u\n",blist->bond[i]->data->vtx1->idx,blist->bond[i]->data->vtx2->idx); fprintf(fh,"%u %u\n",blist->bond[i]->vtx1->idx,blist->bond[i]->vtx2->idx); } fprintf(fh,"</DataArray>\n<DataArray type=\"Int64\" Name=\"offsets\" format=\"ascii\">"); for (i=2;i<blist->n*2+1;i+=2){ @@ -275,7 +275,7 @@ fprintf(fh,"CELLS %u %u\n",blist->n,3*blist->n); for(i=0;i<blist->n;i++){ fprintf(fh,"2 %u %u\n",blist->bond[i]->data->vtx1->idx,blist->bond[i]->data->vtx2->idx); fprintf(fh,"2 %u %u\n",blist->bond[i]->vtx1->idx,blist->bond[i]->vtx2->idx); } fprintf(fh,"CELL_TYPES %u\n",blist->n); for(i=0;i<blist->n;i++)