Trisurf Monte Carlo simulator
mihaf
2014-03-10 152052a93b7e7b5151c42992c79d8e3667471a3e
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;
8a6614 24     ts_uint start_iteration=0;
152052 25     force_from_tape=0;
8a6614 26     parse_args(argv,argc); // sets global variable command_line_args (defined in io.h)
SP 27     ts_fprintf(stdout,"Starting program...\n\n");
152052 28     if(command_line_args.force_from_tape){
8a6614 29         ts_fprintf(stdout,"************************************************\n");
SP 30         ts_fprintf(stdout,"**** Generating initial geometry from tape *****\n");
31         ts_fprintf(stdout,"************************************************\n\n");
32         tape=parsetape("tape");
33         vesicle=create_vesicle_from_tape(tape);
34     } else {
083e03 35
8a6614 36         ts_fprintf(stdout,"**********************************************************************\n");
SP 37         ts_fprintf(stdout,"**** Recreating vesicle from dump file and continuing simulation *****\n");
38         ts_fprintf(stdout,"**********************************************************************\n\n");
39         tape=parsetape("tape");
40         vesicle=restore_state(&start_iteration);
152052 41         // nove vrednosti iz tapea...
M 42 /*    vesicle->bending_stiffness=tape->xk0;
43         set_global_values(tape->xk0);
44         vesicle->pressure=tape->pressure;
45 */
80887d 46         if(command_line_args.reset_iteration_count) start_iteration=tape->inititer+1;
8a6614 47         else start_iteration++;
083e03 48
8a6614 49         if(start_iteration>=tape->iterations){
SP 50             ts_fprintf(stdout, "Simulation already completed. if you want to rerun it try with --force-from-tape or --reset-iteration-count\n\n");
51             return 0;
52         }
53     }
54
55     run_simulation(vesicle, tape->mcsweeps, tape->inititer, tape->iterations, start_iteration);
56     write_master_xml_file("test.pvd");
57     write_dout_fcompat_file(vesicle,"dout");
58     vesicle_free(vesicle);
59     tape_free(tape);
60     return 0; //program finished perfectly ok. We return 0.
d7639a 61