Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hmc_General.h
Go to the documentation of this file.
1 
14 #ifndef HMC_GENERAL_INCLUDED
15 #define HMC_GENERAL_INCLUDED
16 
17 #include "action.h"
18 #include "director.h"
19 #include "integrator.h"
20 #include "randomNumbers.h"
21 #include "staples.h"
22 
23 #include "bridgeIO.h"
24 using Bridge::vout;
25 
26 using std::valarray;
27 
29 
30 /*
31  This class defines Hybrid Monte Carlo update algorithm
32  with a given molecular dynamics integrator.
33  To be improved:
34  - at present setting conjugate momenta explicitly assumes
35  SU(3) gauge group. This should be generalized, and for
36  SU(3) case assert is necessary.
37  [25 Dec 2011 H.Matsufuru]
38  (Coding history will be recovered from trac.)
39  YAML is implemented. [14 Nov 2012 Y.Namekawa]
40  */
41 
42 //- parameters class
43 class Parameters_HMC_General : virtual public Parameters
44 {
45  public:
47 };
48 //- end
49 
51 {
52  private:
54  valarray<Action *> m_action;
55  valarray<Director *> m_director;
60 
61  public:
63  HMC_General(std::valarray<Action *> action,
64  std::valarray<Director *> director,
65  Integrator *integrator,
66  RandomNumbers *rand)
67  : m_vl(CommonParameters::Vlevel())
68  {
69  m_action.resize(action.size());
70  for (int i = 0; i < action.size(); ++i) {
71  m_action[i] = action[i];
72  }
73  m_director.resize(director.size());
74  for (int i = 0; i < director.size(); ++i) {
75  m_director[i] = director[i];
76  }
77  m_integrator = integrator;
78  m_rand = rand;
79  m_staple = new Staples;
80  m_Mtpl_test = 0;
81  }
82 
84  HMC_General(std::valarray<Action *> action,
85  Integrator *integrator,
86  RandomNumbers *rand)
87  : m_vl(CommonParameters::Vlevel())
88  {
89  m_action.resize(action.size());
90  for (int i = 0; i < action.size(); ++i) {
91  m_action[i] = action[i];
92  }
93  m_integrator = integrator;
94  m_rand = rand;
95  m_staple = new Staples;
96  m_Mtpl_test = 0;
97  }
98 
101  {
102  delete m_staple;
103  }
104 
105  void set_parameters(const Parameters& params);
106  void set_parameters(int Mtpl_test);
107 
109 
110  double update(Field_G&);
111 
112  double langevin(Field_G& iP, Field_G& U);
113  double langevin_P(Field_G& iP);
114 
115  double calc_Hamiltonian(Field_G& iP, Field_G& U);
116  double calcH_P(Field_G& iP);
117 };
118 #endif