Trisurf Monte Carlo simulator
Samo Penic
2010-12-05 b01cc1ac677dc712c27337be8ee4f11ea336f31b
src/bond.c
@@ -10,10 +10,15 @@
}
ts_bond  *bond_add(ts_bond_list *blist, ts_vertex *vtx1, ts_vertex *vtx2){
    ts_uint i;
    /* no vertices must be null! */
    if(vtx1==NULL || vtx2==NULL) return NULL;
    /* TODO: Verify if the bond already exists... Don't do multiple bonds */
    /* 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))
        return blist->bond[i];
    }
   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);