]> git.treefish.org Git - phys/heatbath.git/blob - heatbath.cpp
Renamed and redefined algorithms.
[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 #else
21 #error NO UPDATE-ALGORITHM DEFINED!
22 #endif
23
24 #ifdef NONMETRO_A_HB
25 #error SADSADS
26 #endif
27
28 o815 *O815;
29 sim *Sim;
30
31 const complex<double> _i_ = complex<double>(0.0,1.0);
32
33 #include "obs_phi2.hpp"
34 #include "obs_phi2_hist.hpp"
35 #include "obs_phip2_hist.hpp"
36
37 o815::comoption specOps[] = {
38   { "mass", required_argument, NULL, 'm', "set mass", "min:max:inc" },
39   { "", 0, NULL, 0, "", "" }
40 };
41
42 void parseSpecOps() 
43 {
44   for (int isopt = 0; isopt < O815->parsedSpecOps.size(); isopt++)
45     switch(O815->parsedSpecOps[isopt].first) {
46     case 'm':
47       O815->paraQ->addRange("mass", O815->parsedSpecOps[isopt].second);
48       break;
49     }
50 }
51
52 void helpHeader() 
53
54   cout << "Usage: ./heatbath-"ALGORITHM" [OPTIONS] [obs1] ... [obsN]" << endl << endl;
55 }
56
57 void parseLonelyArgs()
58 {
59   for (vector<char*>::iterator lonit = O815->lonelyArgs.begin(); lonit != O815->lonelyArgs.end(); ++lonit) {
60     if ( strcmp(*lonit, "phi2") == 0 ) {
61       *O815->out->log << "MASTER: registered observable: phi2" << endl << flush;
62       O815->observables.push_back(new obs_phi2(O815));
63     }
64     else if ( strcmp(*lonit, "phi2_hist") == 0 ) {
65       *O815->out->log << "MASTER: registered observable: phi2_hist" << endl << flush;
66       O815->observables.push_back(new obs_phi2_hist(O815));
67     }
68     else if ( strcmp(*lonit, "phip2_hist") == 0 ) {
69       *O815->out->log << "MASTER: registered observable: phip2_hist" << endl << flush;
70       O815->observables.push_back(new obs_phip2_hist(O815));
71     }
72   }
73 }
74
75 int main (int argc, char *argv[])
76 {
77   O815 = new o815(argc, argv, "heatbath-"ALGORITHM, specOps, &helpHeader);
78
79   O815->addPara("mass", 1);
80
81   parseSpecOps();
82
83   O815->postParaInit();
84
85   O815->Sim = new sim(O815);
86
87   parseLonelyArgs();
88   
89   O815->mainLoop();
90
91   delete O815;
92   return 0;
93 }