commiting before checking out onother branch
| | |
| | | ts_uint i; //j; |
| | | ts_double oldenergy, delta_energy; |
| | | // ts_triangle *lm=NULL,*lp=NULL, *lp1=NULL, *lp2=NULL, *lm1=NULL, *lm2=NULL; |
| | | |
| | | ts_vertex *kp,*km; |
| | | ts_vertex *kp=NULL,*km=NULL; |
| | | ts_triangle *lm=NULL, *lp=NULL; |
| | | |
| | | if(it->neigh->n< 3) return TS_FAIL; |
| | | if(k->neigh->n< 3) return TS_FAIL; |
| | | |
| | | if(k==NULL || it==NULL){ |
| | | fatal("In bondflip, number of neighbours of k or it is less than 3!",999); |
| | | } |
| | | |
| | | |
| | | nei=0; |
| | | for(i=0;i<it->neigh->n;i++){ // Finds the nn of it, that is k |
| | | if(it->neigh->vtx[i]==k){ |
| | |
| | | km=it->neigh->vtx[neim]; // We located km and kp |
| | | kp=it->neigh->vtx[neip]; |
| | | |
| | | //find lm and lp (triangles that is common with k and it) |
| | | for(i=0;i<it->tristar_no;i++){ |
| | | if(it->tristar[i]->vertex[0]==k || it->tristar[i]->vertex[1]==k || it->tristar[i]->vertex[2]==k){ |
| | | if(lm==NULL) lm=it->tristar[i]; |
| | | else lp=it->tristar[i]; |
| | | } |
| | | } |
| | | |
| | | if(lm==NULL || lp==NULL) { |
| | | fatal("In bondflip, cannot determine lp and lm",999); |
| | | } |
| | | |
| | | if(km==NULL || kp==NULL){ |
| | | fatal("In bondflip, cannot determine km and kp!",999); |
| | | } |
| | |
| | | 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[1]=drand48(); |
| | | rnvec[2]=drand48(); |
| | | */ |
| | | // b=rand() % vesicle->blist->n; |
| | | b=rand() % vesicle->blist->n; |
| | | //find a bond and return a pointer to a bond... |
| | | //call single_bondflip_timestep... |
| | | // retval=single_bondflip_timestep(vesicle,vesicle->blist->bond[b],rnvec); |
| | | retval=single_bondflip_timestep(vesicle,vesicle->blist->bond[b],rnvec); |
| | | // 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); |
| | |
| | | /* initialize Ylm for spherical hamonics DONE in sh.c */ |
| | | } |
| | | vlist->n=N; |
| | | vlist->list_size=TS_VLIST_CHUNK; //TODO: can be buggy in some cases, when N>0 and we want to delete some vertices. |
| | | return vlist; |
| | | vlist->list_size=TS_VLIST_CHUNK; //TODO: can be buggy in some cases, when N>0 and we want to delete some vertices. |
| | | return vlist; |
| | | } |
| | | |
| | | |
| | | ts_bool vertex_list_add_vtx(ts_vertex_list *vlist, ts_vertex *vtx){ |
| | | |
| | | #ifdef DEBUG |
| | | if(vtx==NULL) |
| | | err("VTX is null"); |
| | | if(vlist==NULL) err("VLIST is null"); |
| | | |
| | | if(vtx==NULL || vlist==NULL) |
| | | return TS_FAIL; |
| | | #endif |
| | |
| | | } |
| | | vlist->list_size+=TS_VLIST_CHUNK; |
| | | } |
| | | // printf("Test %u (max %u)!\n", vlist->n, vlist->list_size); |
| | | vlist->vtx[vlist->n]=vtx; |
| | | vlist->n++; |
| | | return TS_SUCCESS; |
| | |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | |
| | | ts_bool vtx_add_cneighbour(ts_bond_list *blist, ts_vertex *vtx1, ts_vertex *vtx2){ |
| | | ts_bool retval; |
| | | retval=vtx_add_neighbour(vtx1, vtx2); |