Trisurf Monte Carlo simulator
Samo Penic
2012-07-10 3065597ac54173cebdd577c25c8e4b04ca41c650
commit | author | age
d7639a 1 #include<stdio.h>
SP 2 #include<math.h>
3 #include "general.h"
4 #include "vertex.h"
a10dd5 5 #include "bond.h"
a2a676 6 #include "triangle.h"
bb77ca 7 #include "cell.h"
7958e9 8 #include "vesicle.h"
a6b1b5 9 #include "io.h"
7958e9 10 #include "initial_distribution.h"
dac2e5 11 #include "frame.h"
aec47d 12 #include "timestep.h"
d7639a 13
SP 14 /** Entrance function to the program
15   * @param argv is a number of parameters used in program call (including the program name
16   * @param argc is a pointer to strings (character arrays) which holds the arguments
17   * @returns returns 0 on success, any other number on fail.
18 */
19
20 int main(int argv, char *argc[]){
21 ts_bool retval;
aec47d 22 ts_uint i;
3131dc 23     ts_vertex_list *vlist=init_vertex_list(5);
b01cc1 24 ts_vertex_list *vlist1;
a10dd5 25 ts_bond_list *blist=init_bond_list();
a2a676 26 ts_triangle_list *tlist=init_triangle_list();
bb77ca 27 ts_cell_list *clist=init_cell_list(3,3,3,0.3);
7958e9 28 ts_vesicle *vesicle;
d7639a 29
a10dd5 30 retval=vtx_add_cneighbour(blist,vlist->vtx[1],vlist->vtx[0]);
d7639a 31 if(retval==TS_FAIL) printf("1. already a member or vertex is null!\n");
a10dd5 32
SP 33 retval=vtx_add_cneighbour(blist,vlist->vtx[0],vlist->vtx[1]);
d7639a 34 if(retval==TS_FAIL) printf("2. already a member or vertex is null!\n");
306559 35 fprintf(stderr,"Was here");
9802f1 36 retval=vtx_remove_neighbour(vlist->vtx[0],vlist->vtx[1]);
SP 37 vtx_add_neighbour(vlist->vtx[0],vlist->vtx[1]);
306559 38 fprintf(stderr,"Was here too!\n");
9802f1 39
8f6a69 40 vlist->vtx[0]->x=1.0;
SP 41 vlist->vtx[0]->x=1.1;
b01cc1 42 vlist1=vertex_list_copy(vlist);
a10dd5 43 bond_add(blist, vlist->vtx[1],vlist->vtx[0]);
a2a676 44 triangle_add(tlist,vlist->vtx[1],vlist->vtx[2],vlist->vtx[3]);
a10dd5 45
a2a676 46 triangle_add(tlist,vlist->vtx[1],vlist->vtx[2],vlist->vtx[3]);
SP 47
34d3de 48 printf("Cell idx=1 has vertices=%u\n",clist->cell[0]->nvertex);
bb77ca 49 cell_add_vertex(clist->cell[0], vlist->vtx[0]);
34d3de 50 printf("Cell idx=1 has vertices=%u\n",clist->cell[0]->nvertex);
8f6a69 51 printf("Cell idx=1 has vertex[0] has x coordinate=%e\n",clist->cell[0]->vertex[0]->x);
bb77ca 52 cell_list_cell_occupation_clear(clist);
34d3de 53 printf("Cell idx=1 has vertices=%u\n",clist->cell[0]->nvertex);
bb77ca 54 cell_add_vertex(clist->cell[0], vlist->vtx[0]);
SP 55
56
a2a676 57 triangle_list_free(tlist);
a10dd5 58 bond_list_free(blist);
73f967 59 vtx_list_free(vlist);
bb77ca 60 cell_list_free(clist);
7958e9 61
b01cc1 62 vtx_list_free(vlist1);
SP 63 printf("Tests complete.\n");
83b03a 64 vesicle=initial_distribution_dipyramid(17,60,60,60,0.15);
314f2d 65 //parsetape(vesicle,&i);
SP 66
67 //these four must come from parsetype!
83b03a 68 vesicle->dmax=1.67*1.67;
314f2d 69 vesicle->stepsize=0.15;
SP 70 vesicle->clist->max_occupancy=8;
71 vesicle->bending_rigidity=25.0;
72 fprintf(stderr,"xk=%f",vesicle->bending_rigidity);
dac2e5 73
SP 74 centermass(vesicle);
75 cell_occupation(vesicle);
314f2d 76 for(i=0;i<10000;i++){
aec47d 77 single_timestep(vesicle);
314f2d 78 if(i%100==0){
SP 79 write_vertex_xml_file(vesicle,i/100);
80 }
41a035 81 }
a6b1b5 82 write_master_xml_file("test.pvd");
3131dc 83 write_dout_fcompat_file(vesicle,"dout");
7958e9 84 vesicle_free(vesicle);
SP 85
d7639a 86 return 0; //program finished perfectly ok. We return 0.
SP 87