Trisurf Monte Carlo simulator
Samo Penic
2012-02-23 41a0355002fda513dbf8d878b6793e1f21a20ef1
src/initial_distribution.c
@@ -25,8 +25,10 @@
    retval = init_triangles(vesicle);
    retval = init_triangle_neighbours(vesicle);
    retval = init_common_vertex_triangle_neighbours(vesicle);
    retval = init_normal_vectors(vesicle->tlist);
    retval = mean_curvature_and_energy(vesicle);
 ts_fprintf(stderr,"initial_distribution finished!\n");
   if(retval);
   return vesicle;
@@ -248,7 +250,7 @@
   for(i=0;i<tlist->n;i++){
        k=0;
      for(j=0;j<3;j++){
         if(tlist->tria[i]->data->vertex[j]!=NULL)
         if(tlist->tria[i]->vertex[j]!=NULL)
            k++;
      }
            if(k!=3){
@@ -272,14 +274,14 @@
    ts_triangle **tria=tlist->tria -1;
    nobo=0;
    for(i=1;i<=tlist->n;i++){
        i1=tria[i]->data->vertex[0];
        i2=tria[i]->data->vertex[1];
        i3=tria[i]->data->vertex[2];
        i1=tria[i]->vertex[0];
        i2=tria[i]->vertex[1];
        i3=tria[i]->vertex[2];
        for(j=1;j<=tlist->n;j++){
            if(j==i) continue;
            j1=tria[j]->data->vertex[0];
            j2=tria[j]->data->vertex[1];
            j3=tria[j]->data->vertex[2];
            j1=tria[j]->vertex[0];
            j2=tria[j]->vertex[1];
            j3=tria[j]->vertex[2];
            if((i1==j1 && i3==j2) || (i1==j2 && i3==j3) || (i1==j3 && i3==j1)){
                    triangle_add_neighbour(tria[i],tria[j]);
                    nobo++;
@@ -287,14 +289,14 @@
        }
    }
    for(i=1;i<=tlist->n;i++){
        i1=tria[i]->data->vertex[0];
        i2=tria[i]->data->vertex[1];
        i3=tria[i]->data->vertex[2];
        i1=tria[i]->vertex[0];
        i2=tria[i]->vertex[1];
        i3=tria[i]->vertex[2];
        for(j=1;j<=tlist->n;j++){
            if(j==i) continue;
            j1=tria[j]->data->vertex[0];
            j2=tria[j]->data->vertex[1];
            j3=tria[j]->data->vertex[2];
            j1=tria[j]->vertex[0];
            j2=tria[j]->vertex[1];
            j3=tria[j]->vertex[2];
            if((i1==j1 && i2==j3) || (i1==j3 && i2==j2) || (i1==j2 && i2==j1)){
                triangle_add_neighbour(tria[i],tria[j]);
                nobo++;
@@ -302,14 +304,14 @@
        }
    }
    for(i=1;i<=tlist->n;i++){
        i1=tria[i]->data->vertex[0];
        i2=tria[i]->data->vertex[1];
        i3=tria[i]->data->vertex[2];
        i1=tria[i]->vertex[0];
        i2=tria[i]->vertex[1];
        i3=tria[i]->vertex[2];
        for(j=1;j<=tlist->n;j++){
            if(j==i) continue;
            j1=tria[j]->data->vertex[0];
            j2=tria[j]->data->vertex[1];
            j3=tria[j]->data->vertex[2];
            j1=tria[j]->vertex[0];
            j2=tria[j]->vertex[1];
            j3=tria[j]->vertex[2];
            if((i2==j1 && i3==j3) || (i2==j3 && i3==j2) || (i2==j2 && i3==j1)){
                triangle_add_neighbour(tria[i],tria[j]);
                nobo++;
@@ -338,9 +340,9 @@
            if(j == vtx[i]->data->neigh_no) jp=1;
            k2=vtx[i]->data->neigh[jp-1];
            for(k=1;k<=tlist->n;k++){      // VERY NON-OPTIMAL!!! too many loops (vlist.n * vtx.neigh * tlist.n )!
                k3=tria[k]->data->vertex[0];
                k4=tria[k]->data->vertex[1];
                k5=tria[k]->data->vertex[2];
                k3=tria[k]->vertex[0];
                k4=tria[k]->vertex[1];
                k5=tria[k]->vertex[2];
//                ts_fprintf(stderr,"%u %u: k=(%u %u %u)\n",k1,k2,k3,k4,k5);
                if((vtx[i]==k3 && k1==k4 && k2==k5) ||
                (vtx[i]==k4 && k1==k5 && k2==k3) ||
@@ -348,7 +350,7 @@
//TODO: probably something wrong with neighbour distribution.
//                if(vtx[i]==k3 || vtx[i]==k4 || vtx[i]==k5){
//                    if(i==6) ts_fprintf(stdout, "Vtx[%u] > Added to tristar!\n",i);
    //                    if(i==6) ts_fprintf(stdout, "Vtx[%u] > Added to tristar!\n",i);
                    vertex_add_tristar(vtx[i],tria[k]);
                }
            }