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