Trisurf Monte Carlo simulator
Samo Penic
2014-03-08 62681163a4c47fc6dbd6b2b96f84171b20cba3ed
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"
8db569 13 #include "poly.h"
d7639a 14
SP 15 /** Entrance function to the program
16   * @param argv is a number of parameters used in program call (including the program name
17   * @param argc is a pointer to strings (character arrays) which holds the arguments
18   * @returns returns 0 on success, any other number on fail.
19 */
20
21 int main(int argv, char *argc[]){
1ab449 22     ts_vesicle *vesicle;
SP 23     ts_tape *tape;
626811 24     ts_uint start_iteration=-1;
1ab449 25     parse_args(argv,argc);
SP 26     ts_fprintf(stdout,"\nStarting program...\n\n");
083e03 27 if(force_from_tape){
SP 28 ts_fprintf(stdout,"****************************************************\n");
29 ts_fprintf(stdout,"**** Reinitializing initial geometry from tape *****\n");
30 ts_fprintf(stdout,"****************************************************\n\n");
1ab449 31 tape=parsetape("tape");
SP 32 vesicle=create_vesicle_from_tape(tape);
083e03 33 } else {
SP 34
35 ts_fprintf(stdout,"**********************************************************************\n");
36 ts_fprintf(stdout,"**** Recreating vesicle from dump file and continuing simulation *****\n");
37 ts_fprintf(stdout,"**********************************************************************\n\n");
1ab449 38 tape=parsetape("tape");
SP 39 vesicle=restore_state(&start_iteration);
626811 40
SP 41 if(start_iteration>=tape->iterations){
42     ts_fprintf(stdout, "Simulation already completed. if you want to rerun it try with --force-from-tape or --reset-iteration-count\n\n");
43     return 0;
44 }
083e03 45 }
SP 46
626811 47 run_simulation(vesicle, tape->mcsweeps, tape->inititer, tape->iterations, start_iteration+1);
a6b1b5 48 write_master_xml_file("test.pvd");
3131dc 49 write_dout_fcompat_file(vesicle,"dout");
7958e9 50 vesicle_free(vesicle);
1ab449 51 tape_free(tape);
d7639a 52 return 0; //program finished perfectly ok. We return 0.
SP 53