]> git.treefish.org Git - phys/heatbath.git/blob - heatbath.cpp
...
[phys/heatbath.git] / heatbath.cpp
1 #include <complex>
2 #include <cstring>
3
4 #include "latlib/o815/o815.h"
5
6 #ifdef ALGORITHM_METRO
7 #define ALGORITHM "metro"
8 #include "sim-metro.hpp"
9 #elif ALGORITHM_AHBMHB
10 #include "sim-nonmetro.hpp"
11 #define ALGORITHM "AhbMhb"
12 #elif ALGORITHM_AHBMOR
13 #include "sim-nonmetro.hpp"
14 #define ALGORITHM "AhbMor"
15 #elif ALGORITHM_AORMHB
16 #include "sim-nonmetro.hpp"
17 #define ALGORITHM "AorMhb"
18 #elif ALGORITHM_AORMOR
19 #include "sim-nonmetro.hpp"
20 #define ALGORITHM "AorMor"
21 #elif ALGORITHM_AORM0
22 #include "sim-nonmetro.hpp"
23 #define ALGORITHM "AorM0"
24 #elif ALGORITHM_AHBM0
25 #include "sim-nonmetro.hpp"
26 #define ALGORITHM "AhbM0"
27 #elif ALGORITHM_A0MOR
28 #include "sim-nonmetro.hpp"
29 #define ALGORITHM "A0Mor"
30 #elif ALGORITHM_A0MHB
31 #include "sim-nonmetro.hpp"
32 #define ALGORITHM "A0Mhb"
33 #else
34 #error NO UPDATE-ALGORITHM DEFINED!
35 #endif
36
37 #ifdef NONMETRO_A_HB
38 #error SADSADS
39 #endif
40
41 o815 *O815;
42 sim *Sim;
43
44 const complex<double> _i_ = complex<double>(0.0,1.0);
45
46 #include "obs_phi2.hpp"
47 #include "obs_phi2_hist.hpp"
48 #include "obs_phip2_hist.hpp"
49
50 o815::comoption specOps[] = {
51   { "mass", required_argument, NULL, 'm', "set mass", "min:max:inc" },
52   { "", 0, NULL, 0, "", "" }
53 };
54
55 void parseSpecOps() 
56 {
57   for (int isopt = 0; isopt < O815->parsedSpecOps.size(); isopt++)
58     switch(O815->parsedSpecOps[isopt].first) {
59     case 'm':
60       O815->paraQ->addRange("mass", O815->parsedSpecOps[isopt].second);
61       break;
62     }
63 }
64
65 void helpHeader() 
66
67   cout << "Usage: ./heatbath-"ALGORITHM" [OPTIONS] [obs1] ... [obsN]" << endl << endl;
68 }
69
70 void parseLonelyArgs()
71 {
72   for (vector<char*>::iterator lonit = O815->lonelyArgs.begin(); lonit != O815->lonelyArgs.end(); ++lonit) {
73     if ( strcmp(*lonit, "phi2") == 0 ) {
74       *O815->out->log << "MASTER: registered observable: phi2" << endl << flush;
75       O815->observables.push_back(new obs_phi2(O815));
76     }
77     else if ( strcmp(*lonit, "phi2_hist") == 0 ) {
78       *O815->out->log << "MASTER: registered observable: phi2_hist" << endl << flush;
79       O815->observables.push_back(new obs_phi2_hist(O815));
80     }
81     else if ( strcmp(*lonit, "phip2_hist") == 0 ) {
82       *O815->out->log << "MASTER: registered observable: phip2_hist" << endl << flush;
83       O815->observables.push_back(new obs_phip2_hist(O815));
84     }
85   }
86 }
87
88 int main (int argc, char *argv[])
89 {
90   O815 = new o815(argc, argv, "heatbath-"ALGORITHM, specOps, &helpHeader);
91
92   O815->addPara("mass", 1);
93
94   parseSpecOps();
95
96   O815->postParaInit();
97
98   O815->Sim = new sim(O815);
99
100   parseLonelyArgs();
101   
102   O815->mainLoop();
103
104   delete O815;
105   return 0;
106 }