Trisurf Monte Carlo simulator
Samo Penic
2016-07-06 250de4d124ea8dc4929a9c334d94fc51018fa53c
Finished spontaneous force
6 files modified
40 ■■■■■ changed files
src/energy.c 27 ●●●●● patch | view | raw | blame | history
src/energy.h 2 ●●● patch | view | raw | blame | history
src/general.h 1 ●●●● patch | view | raw | blame | history
src/io.c 1 ●●●● patch | view | raw | blame | history
src/tape 7 ●●●●● patch | view | raw | blame | history
src/vertexmove.c 2 ●●●●● patch | view | raw | blame | history
src/energy.c
@@ -207,3 +207,30 @@
    }
    return TS_SUCCESS;
}
ts_double direct_force_energy(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *vtx_old){
    if(fabs(vtx->c)<1e-15) return 0.0;
//    printf("was here");
    if(fabs(vesicle->tape->F)<1e-15) return 0.0;
    ts_double norml,ddp=0.0;
    ts_uint i;
    ts_double xnorm=0.0,ynorm=0.0,znorm=0.0;
    /*find normal of the vertex as average normal of all the triangles surrounding it. */
    for(i=0;i<vtx->tristar_no;i++){
            xnorm=vtx->tristar[i]->xnorm;
            ynorm=vtx->tristar[i]->ynorm;
            znorm=vtx->tristar[i]->znorm;
    }
    /*normalize*/
    norml=sqrt(xnorm*xnorm+ynorm*ynorm+znorm*znorm);
    xnorm/=norml;
    ynorm/=norml;
    znorm/=norml;
    /*calculate ddp, perpendicular displacement*/
    ddp=xnorm*(vtx->x-vtx_old->x)+xnorm*(vtx->y-vtx_old->y)+znorm*(vtx->z-vtx_old->z);
    /*calculate dE*/
//    printf("ddp=%e",ddp);
    return vesicle->tape->F*ddp;
}
src/energy.h
@@ -7,5 +7,5 @@
ts_bool sweep_attraction_bond_energy(ts_vesicle *vesicle);
inline ts_bool attraction_bond_energy(ts_bond *bond, ts_double w);
ts_double direct_force_energy(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *vtx_old);
#endif
src/general.h
@@ -287,6 +287,7 @@
    long int number_of_vertices_with_c0;
    ts_double c0;
    ts_double w;
    ts_double F;
} ts_tape;
src/io.c
@@ -1182,6 +1182,7 @@
    CFG_SIMPLE_INT("number_of_vertices_with_c0", &tape->number_of_vertices_with_c0),
    CFG_SIMPLE_FLOAT("c0",&tape->c0),
    CFG_SIMPLE_FLOAT("w",&tape->w),
    CFG_SIMPLE_FLOAT("F",&tape->F),
        CFG_END()
    };
    cfg_t *cfg;    
src/tape
@@ -86,9 +86,10 @@
#NirGov branch only!
#number of vertices with spontaneous curvature (integer)
number_of_vertices_with_c0=30
number_of_vertices_with_c0=100
#spontaneous curvature (float)
c0=0.5
#energy of attraction of vertices with spontaneous curvature (float, positive value for attraction)
w=100.0
w=10.0
#direct force on vesicles with spontaneous curvature (float)
F=2.0
src/vertexmove.c
@@ -189,6 +189,8 @@
    delta_energy+=delta_energy_cv;
//    fprintf(stderr,"Denergy after=%e\n",delta_energy);
    }
/* Vertices with spontaneous curvature may have spontaneous force perpendicular to the surface of the vesicle. additional delta energy is calculated in this function */
    delta_energy+=direct_force_energy(vesicle,vtx,backupvtx);
/* No poly-bond energy for now!
    if(vtx->grafted_poly!=NULL){
        delta_energy+=