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