Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hmc_Leapfrog.h
Go to the documentation of this file.
1 
14 #ifndef HMC_LEAPFROG_INCLUDED
15 #define HMC_LEAPFROG_INCLUDED
16 
17 #include "action.h"
18 #include "director.h"
19 #include "integrator.h"
20 #include "randomNumbers.h"
21 #include "staples.h"
22 #include "langevin_Momentum.h"
23 
24 #include "bridgeIO.h"
25 using Bridge::vout;
26 
28 
42 //- parameters class
43 class Parameters_HMC_Leapfrog : virtual public Parameters
44 {
45  public:
47 };
48 //- end
49 
51 {
52  public:
53  static const std::string class_name;
54 
55  private:
56  int m_Nmdc;
57  int m_Nprec;
59  double m_Estep;
60 
63 
64  std::valarray<Action *> m_action;
65  std::valarray<Director *> m_director;
68 
69  public:
70  HMC_Leapfrog(std::valarray<Action *> action,
71  RandomNumbers *rand)
72  : m_vl(CommonParameters::Vlevel())
73  {
74  m_action.resize(action.size());
75  for (int i = 0; i < action.size(); ++i) {
76  m_action[i] = action[i];
77  }
78  m_staple = new Staples;
79  m_rand = rand;
80  m_Estep = 0.0;
81  m_Nmdc = 0;
82  m_Nprec = 0;
83  m_Mtpl_test = 0;
85  }
86 
87  HMC_Leapfrog(std::valarray<Action *> action,
88  std::valarray<Director *> director,
89  RandomNumbers *rand)
90  : m_vl(CommonParameters::Vlevel())
91  {
92  m_action.resize(action.size());
93  for (int i = 0; i < action.size(); ++i) {
94  m_action[i] = action[i];
95  }
96  m_director.resize(director.size());
97  for (int i = 0; i < director.size(); ++i) {
98  m_director[i] = director[i];
99  }
100  m_staple = new Staples;
101  m_rand = rand;
102  m_Estep = 0.0;
103  m_Nmdc = 0;
104  m_Nprec = 0;
105  m_Mtpl_test = 0;
107  }
108 
110  {
111  delete m_staple;
112  delete m_Langevin_P;
113  }
114 
115  void set_parameters(const Parameters& params);
116  void set_parameters(double Estep, int Nmdc, int Nprec, int Mtpl_test);
117 
119 
120  // Mtpl_test=0: no test, !=0: test
121  double update(Field_G&);
122 
123  double langevin(Field_G& iP, Field_G& U);
124 
125  // double langevin_P(Field_G& iP); removed. [07 May 2014]
126 
127  double calc_Hamiltonian(Field_G& iP, Field_G& U);
128  double calcH_P(Field_G& iP);
129 
130  void integrate(Field_G& iP, Field_G& U);
131 
132  void update_U(double estep, Field_G& iP, Field_G& U);
133  void update_P(double estep, Field_G& iP, Field_G& U);
134 };
135 #endif
BridgeIO vout
Definition: bridgeIO.cpp:207
void set_parameters(const Parameters &params)
Staple construction.
Definition: staples.h:40
double m_Estep
Definition: hmc_Leapfrog.h:59
static const std::string class_name
Definition: hmc_Leapfrog.h:53
std::valarray< Director * > m_director
Definition: hmc_Leapfrog.h:65
HMC_Leapfrog(std::valarray< Action * > action, RandomNumbers *rand)
Definition: hmc_Leapfrog.h:70
Class for parameters.
Definition: parameters.h:40
RandomNumbers * m_rand
Definition: hmc_Leapfrog.h:66
Langevin_Momentum * m_Langevin_P
Definition: hmc_Leapfrog.h:61
void update_P(double estep, Field_G &iP, Field_G &U)
void set_parameter_verboselevel(const Bridge::VerboseLevel vl)
Definition: hmc_Leapfrog.h:118
Bridge::VerboseLevel m_vl
Definition: hmc_Leapfrog.h:67
SU(N) gauge field.
Definition: field_G.h:36
void integrate(Field_G &iP, Field_G &U)
double update(Field_G &)
void update_U(double estep, Field_G &iP, Field_G &U)
Common parameter class: provides parameters as singleton.
double langevin(Field_G &iP, Field_G &U)
double calcH_P(Field_G &iP)
std::valarray< Action * > m_action
Definition: hmc_Leapfrog.h:64
Base class of random number generators.
Definition: randomNumbers.h:40
Bridge::VerboseLevel vl
Definition: checker.cpp:18
VerboseLevel
Definition: bridgeIO.h:25
HMC_Leapfrog(std::valarray< Action * > action, std::valarray< Director * > director, RandomNumbers *rand)
Definition: hmc_Leapfrog.h:87
Staples * m_staple
Definition: hmc_Leapfrog.h:62
double calc_Hamiltonian(Field_G &iP, Field_G &U)
HMC with single level leapfrog intetgrator.
Definition: hmc_Leapfrog.h:43
Langevin part of HMC for conjugate momentum to link variable.