Trisurf Monte Carlo simulator
Samo Penic
2013-11-27 dcf17d56fd0a7c361e5076c3023e628effb7fa5f
Returning back to 142a67fe82b830e5c7816914afa62445959c87ca
5 files modified
60 ■■■■ changed files
src/general.h 1 ●●●● patch | view | raw | blame | history
src/tape 4 ●●●● patch | view | raw | blame | history
src/timestep.c 18 ●●●●● patch | view | raw | blame | history
src/vertex.c 33 ●●●●● patch | view | raw | blame | history
src/vertex.h 4 ●●● patch | view | raw | blame | history
src/general.h
@@ -154,7 +154,6 @@
        ts_double projArea;
        ts_double relR;
        ts_double solAngle;
    ts_int locked;
};
typedef struct ts_vertex ts_vertex;
src/tape
@@ -19,9 +19,9 @@
#how many MC sweeps between subsequent records of states to disk
mcsweeps=100
#how many initial mcsweeps*inititer MC sweeps before recording to disk?
inititer=10
inititer=100
#how many records do you want on the disk iteration are there in a run?
iterations=100
iterations=1000
#shut up if we are using cluster!!!
src/timestep.c
@@ -7,7 +7,6 @@
#include "vertexmove.h"
#include "bondflip.h"
#include "frame.h"
#include "vertex.h"
#include "io.h"
ts_bool run_simulation(ts_vesicle *vesicle, ts_uint mcsweeps, ts_uint inititer, ts_uint iterations){
    ts_uint i, j;
@@ -31,25 +30,21 @@
ts_bool single_timestep(ts_vesicle *vesicle){
    ts_bool retval;
    ts_double rnvec[3];
    ts_uint i;// b;
    ts_uint i, b;
    for(i=0;i<vesicle->vlist->n;i++){
        rnvec[0]=drand48();
        rnvec[1]=drand48();
        rnvec[2]=drand48();
    vertex_taint(vesicle->vlist->vtx[i],1);
//        ts_fprintf(stdout, "Vertex %d should be tainted, level=%d.\n", i, vesicle->vlist->vtx[i]->locked);
    if(vertex_tainted(vesicle->vlist->vtx[i],1,1)){
        ts_fprintf(stdout, "Vertex %d tainted, level=%d. Waiting....\n", i, vesicle->vlist->vtx[i]->locked);
        while(vertex_tainted(vesicle->vlist->vtx[i],1,1));
    }
        retval=single_verticle_timestep(vesicle,vesicle->vlist->vtx[i],rnvec);
    vertex_untaint(vesicle->vlist->vtx[i],1);
//        ts_fprintf(stdout, "Vertex %d should be untainted, level=%d.\n", i, vesicle->vlist->vtx[i]->locked);
    }
//    ts_int cnt=0;
/*
    for(i=0;i<vesicle->vlist->n;i++){
//why is rnvec needed in bondflip?
/*        rnvec[0]=drand48();
        rnvec[1]=drand48();
        rnvec[2]=drand48();
*/
    b=rand() % vesicle->blist->n;
        //find a bond and return a pointer to a bond...
        //call single_bondflip_timestep...
@@ -57,7 +52,6 @@
//    if(retval==TS_SUCCESS) cnt++;        
    } 
//    printf("Bondflip success rate in one sweep: %d/%d=%e\n", cnt,vesicle->blist->n,(double)cnt/(double)vesicle->blist->n);
*/
    if(retval);
    return TS_SUCCESS;
}
src/vertex.c
@@ -311,36 +311,3 @@
    return vlist;
}
ts_bool vertex_taint(ts_vertex *vtx, ts_uint level){
    if(level==0){
        vtx->locked++;
        return TS_SUCCESS;
    }
    ts_uint i;
    for(i=0; i<vtx->neigh_no; i++){
        vertex_taint(vtx->neigh[i], level-1);
    }
        vtx->locked++;
    return TS_SUCCESS;
}
ts_bool vertex_untaint(ts_vertex *vtx, ts_uint level){
    if(level==0){
        vtx->locked--;
        return TS_SUCCESS;
    }
    ts_uint i;
    for(i=0; i<vtx->neigh_no; i++){
        vertex_untaint(vtx->neigh[i], level-1);
    }
        vtx->locked--;
    return TS_SUCCESS;
}
inline ts_bool vertex_tainted(ts_vertex *vtx, ts_uint level, ts_uint amount){
    if(vtx->locked>amount) return 1;
    else return 0;
}
src/vertex.h
@@ -30,7 +30,5 @@
ts_bool vtx_duplicate(ts_vertex *cvtx, ts_vertex *ovtx);
ts_vertex **vtx_neigh_copy(ts_vertex_list *vlist,ts_vertex *ovtx);
ts_vertex_list *vertex_list_copy(ts_vertex_list *ovlist);
ts_bool vertex_taint(ts_vertex *vtx, ts_uint level);
ts_bool vertex_untaint(ts_vertex *vtx, ts_uint level);
inline ts_bool vertex_tainted(ts_vertex *vtx, ts_uint level, ts_uint amount);
#endif