Trisurf Monte Carlo simulator
mihaf
2013-12-03 2bdec5571ad2582dcc492d03148620b1b0c618ce
commit | author | age
1d5dff 1 ts_poly    *init_poly(ts_uint n, ts_vertex *grafted_vtx){
M 2     ts_poly    *poly=(ts_poly *)calloc(1,sizeof(ts_poly));
3     poly->vlist = init_vertex_list(n);
4     poly->blist = init_bond_list();
5     poly->grafted_vtx = grafted_vtx;
6     grafted_vtx->grafted_poly = poly;
7
8     ts_uint i;
9     for(i=0,i<n-1,i++){
10         vtx_add_cneighbour(poly->blist, poly->vlist->vtx[i], poly->vlist->vtx[i+1]);
11     }
12
13     return poly;
14 }
15
16
17 ts_poly_list *init_poly_list(ts_uint n_poly, ts_uint n_mono, ts_vertex_list vlist){
18     ts_poly_list *poly_list=(ts_poly_list *)calloc(1,sizeof(ts_poly_list));
19
20     if (n_poly > vlist->n){fatal("Number of polymers larger then numbero f vertices on a vesicle.",310);}
21     
22     ts_uint i=0;
23     ts_uint gvtxi;
24     while(i<n_poly){
25         gvtxi = rand() % vlist->n
26         if (vlist->vtx[gvtxi]->grafted_poly == NULL){
27         poly_list->poly = init_poly(n_mono, vlist->vtx[gvtxi]);
28         i++;
29         }
30     }
31     
32     poly_list->n = n_poly;
33
34     return poly_list;
35 }
36