Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
integrator_Omelyan.cpp
Go to the documentation of this file.
1 
14 #include "integrator_Omelyan.h"
15 
16 const std::string Integrator_Omelyan::class_name = "Integrator_Omelyan";
17 
18 //====================================================================
20 {
21  const std::string str_vlevel = params.get_string("verbose_level");
22 
23  m_vl = vout.set_verbose_level(str_vlevel);
24 
25  //- fetch and check input parameters
26  int level;
27  int Nstep;
28  double lambda_Omelyan;
29 
30  int err = 0;
31  err += params.fetch_int("level", level);
32  err += params.fetch_int("number_of_steps", Nstep);
33  err += params.fetch_double("lambda_Omelyan", lambda_Omelyan);
34 
35  if (err) {
36  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
37  exit(EXIT_FAILURE);
38  }
39 
40  set_parameters(level, Nstep, lambda_Omelyan);
41 }
42 
43 
44 //====================================================================
45 void Integrator_Omelyan::set_parameters(const int level, const int Nstep, const double lambda_Omelyan)
46 {
47  //- print input parameters
48  vout.general(m_vl, "%s:\n", class_name.c_str());
49  vout.general(m_vl, " Level: %4d\n", level);
50  vout.general(m_vl, " Nstep = %4d\n", Nstep);
51  vout.general(m_vl, " lambda_Omelyan = %10.6f\n", lambda_Omelyan);
52 
53  //- range check
54  // NB. level,Estep,Nstep,lambda_Omelyan == 0 is allowed.
55 
56  //- store values
57  m_Nstep = Nstep;
58  m_level = level;
59  m_lambda = lambda_Omelyan;
60 }
61 
62 
63 //====================================================================
65 {
66  m_level = level;
67 }
68 
69 
70 //====================================================================
72 {
73  m_Nstep = Nstep;
74 }
75 
76 
77 //====================================================================
78 void Integrator_Omelyan::set_parameter_Nsteps(const std::vector<int>& Nsteps)
79 {
80  if (Nsteps.size() > 0) {
81  set_parameter_Nstep(Nsteps[0]);
82 
83  // transfer to lower levels
84  if (m_update_U && (Nsteps.size() > 1)) {
85  std::vector<int> next_steps(Nsteps.begin() + 1, Nsteps.end());
86  m_update_U->set_parameter_Nsteps(next_steps);
87  }
88  }
89 }
90 
91 
92 //====================================================================
93 void Integrator_Omelyan::set_parameter_lambda(const double lambda_omelyan)
94 {
95  m_lambda = lambda_omelyan;
96 }
97 
98 
99 //====================================================================
100 void Integrator_Omelyan::evolve(const double step_size, Field_G& iP, Field_G& U)
101 {
102  const int Nin = U.nin();
103  const int Nvol = U.nvol();
104  const int Nex = U.nex();
105  const int Nc = CommonParameters::Nc();
106 
107  vout.detailed(m_vl, "%s: level %d: Nstep = %d, step_size = %8.6f\n", class_name.c_str(), m_level, m_Nstep, step_size);
108 
109  vout.general(m_vl, "Integration level-%d start.\n", m_level);
110 
111  if (m_Nstep > 0) {
112  double estep = step_size / m_Nstep;
113 
114  // initial lambda step
115  m_update_p->evolve(estep * m_lambda, iP, U);
116 
117  // molecular dynamics steps
118  for (int istep = 1; istep <= m_Nstep; ++istep) {
119  m_update_U->evolve(estep * 0.5, iP, U);
120 
121  m_update_p->evolve(estep * (1.0 - 2.0 * m_lambda), iP, U);
122 
123  m_update_U->evolve(estep * 0.5, iP, U);
124 
125  if (istep < m_Nstep) {
126  m_update_p->evolve(estep * m_lambda * 2.0, iP, U);
127  }
128  }
129 
130  // last lambda step
131  m_update_p->evolve(estep * m_lambda, iP, U);
132  } else {
133  vout.general(m_vl, "Nstep is zero. skip.\n");
134  }
135 
136  vout.general(m_vl, "Integration level-%d finished.\n", m_level);
137 }
138 
139 
140 //====================================================================
141 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
void detailed(const char *format,...)
Definition: bridgeIO.cpp:216
void general(const char *format,...)
Definition: bridgeIO.cpp:197
void set_parameter_Nsteps(const std::vector< int > &Nsteps)
void set_parameter_Nstep(const int Nstep)
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
int nvol() const
Definition: field.h:127
virtual void set_parameter_Nsteps(const std::vector< int > &Nsteps)
Definition: integrator.h:46
void set_parameters(const Parameters &params)
Class for parameters.
Definition: parameters.h:46
int nin() const
Definition: field.h:126
SU(N) gauge field.
Definition: field_G.h:38
void set_parameter_lambda(const double lambda_omelyan)
int fetch_int(const string &key, int &value) const
Definition: parameters.cpp:346
int nex() const
Definition: field.h:128
virtual void evolve(const double step_size, Field_G &iP, Field_G &U)=0
Bridge::VerboseLevel m_vl
Definition: integrator.h:58
static const std::string class_name
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void evolve(const double step_size, Field_G &iP, Field_G &U)
string get_string(const string &key) const
Definition: parameters.cpp:221
void set_parameter_level(const int level)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131