Trisurf Monte Carlo simulator
Samo Penic
2014-03-05 719c9febac2eaff9483fda487b57684afbb59bb2
src/energy.c
@@ -20,6 +20,14 @@
}
inline ts_bool bond_energy(ts_bond *bond,ts_poly *poly){
//TODO: This value to be changed and implemented in data structure:
   ts_double d_relaxed=1.0;
   bond->energy=poly->k*pow(bond->bond_length-d_relaxed,2);
   return TS_SUCCESS;
};
inline ts_bool energy_vertex(ts_vertex *vtx){
//    ts_vertex *vtx=&vlist->vertex[n]-1; // Caution! 0 Indexed value!
//    ts_triangle *tristar=vtx->tristar-1;
@@ -31,14 +39,14 @@
    ts_double s=0.0,xh=0.0,yh=0.0,zh=0.0,txn=0.0,tyn=0.0,tzn=0.0;
    ts_double x1,x2,x3,ctp,ctm,tot,xlen;
    ts_double h,ht;
    for(jj=1; jj<=vtx->neigh_no;jj++){
    for(jj=1; jj<=vtx->neigh->n;jj++){
        jjp=jj+1;
        if(jjp>vtx->neigh_no) jjp=1;
        if(jjp>vtx->neigh->n) jjp=1;
        jjm=jj-1;
        if(jjm<1) jjm=vtx->neigh_no;
        j=vtx->neigh[jj-1];
        jp=vtx->neigh[jjp-1];
        jm=vtx->neigh[jjm-1];
        if(jjm<1) jjm=vtx->neigh->n;
        j=vtx->neigh->vtx[jj-1];
        jp=vtx->neigh->vtx[jjp-1];
        jm=vtx->neigh->vtx[jjm-1];
//        printf("tristar_no=%u, neigh_no=%u, jj=%u\n",data->tristar_no,data->neigh_no,jj);
        jt=vtx->tristar[jj-1];
        x1=vtx_distance_sq(vtx,jp); //shouldn't be zero!