Trisurf Monte Carlo simulator
Samo Penic
2013-12-08 d33abe246221255be91bacda79f5852b8c4ed8fd
Triangles are ordered in the bond now. Also kp and km are found as adjvtx. They are also ordered.
2 files modified
43 ■■■■■ changed files
src/bond.c 42 ●●●●● patch | view | raw | blame | history
src/general.h 1 ●●●● patch | view | raw | blame | history
src/bond.c
@@ -42,7 +42,8 @@
ts_bool bond_assign_triangles(ts_bond *bond){
    ts_vertex *vtx1=bond->vtx1, *vtx2=bond->vtx2;
    ts_uint i,j,k;
    ts_uint i1=0,i2=0,i3=0,im=0;
    ts_triangle *ttria;
    for(i=0,k=0;i<vtx1->tristar_no;i++){
        for(j=0;j<3;j++){
            if(vtx1->tristar[i]->vertex[j]==vtx2){
@@ -53,7 +54,44 @@
        }
    }
    if(k<2) return TS_FAIL;
    else return TS_SUCCESS;
    //We will sort the triangles so, they are oriented as km and kp for bondflip
    for(i=0;i<3;i++){
        if(bond->tria[0]->vertex[i]==vtx1){
            i1=i;
        }
        else if(bond->tria[0]->vertex[i]==vtx2){
            i2=i;
        }
        else i3=i;
    }
    if(i1>i2 || (i1==0 && i2==2)){
        //pozitivna orientacija!
        ttria=bond->tria[0];
        bond->tria[0]=bond->tria[1];
        bond->tria[1]=ttria;
        bond->adjvtx[1]=bond->tria[0]->vertex[i3];
        im=0;
    }
    else{
        bond->adjvtx[0]=bond->tria[0]->vertex[i3];
        im=1;
    }
        for(i=0;i<3;i++){
        if(bond->tria[1]->vertex[i]==vtx1){
            i1=i;
        }
        else if(bond->tria[1]->vertex[i]==vtx2){
            i2=i;
        }
        else i3=i;
    }
        bond->adjvtx[im]=bond->tria[1]->vertex[i3];
    return TS_SUCCESS;
}
ts_bool bond_list_free(ts_bond_list *blist){
src/general.h
@@ -176,6 +176,7 @@
    ts_uint idx;
    ts_vertex *vtx1;
    ts_vertex *vtx2;
    ts_vertex *adjvtx[2];
    struct ts_triangle *tria[2];
    ts_double bond_length;
    ts_double bond_length_dual;