25 for (
int i = 0; i < action.size(); ++i) {
44 for (
int i = 0; i < action.size(); ++i) {
60 std::vector<Director *> director,
65 for (
int i = 0; i < action.size(); ++i) {
69 for (
int i = 0; i < director.size(); ++i) {
84 std::vector<Director *> director,
89 for (
int i = 0; i < action.size(); ++i) {
93 for (
int i = 0; i < director.size(); ++i) {
115 for (
int i = 0; i < action_set.size(); ++i) {
136 for (
int i = 0; i < action_set.size(); ++i) {
152 std::vector<Director *> director,
159 for (
int i = 0; i < action_set.size(); ++i) {
163 for (
int i = 0; i < director.size(); ++i) {
178 std::vector<Director *> director,
185 for (
int i = 0; i < action_set.size(); ++i) {
189 for (
int i = 0; i < director.size(); ++i) {
214 const string str_vlevel = params.
get_string(
"verbose_level");
221 bool Metropolis_test;
225 err += params.
fetch_int(
"number_of_steps", Nmdc);
226 err += params.
fetch_int(
"order_of_exp_iP", Nprec);
227 err += params.
fetch_bool(
"Metropolis_test", Metropolis_test);
242 vout.
crucial(
m_vl,
"%s: warning: integer variable for Metroplis_test is obsolete. use boolean parameter.\n",
class_name.c_str());
244 return set_parameters(Estep, Nmdc, Nprec, (Metropolis_test == 0 ?
false :
true));
257 vout.
general(
m_vl,
" Metropolis_test = %s\n", Metropolis_test ?
"true" :
"false");
277 for (
int i = 0; i <
m_action.size(); ++i) {
281 const int Nin = U.
nin();
282 const int Nvol = U.
nvol();
283 const int Nex = U.
nex();
291 const double H_total0 =
langevin(iP, U);
315 const double diff_H = H_total1 - H_total0;
316 const double exp_minus_diff_H = exp(-diff_H);
326 if (rand <= exp_minus_diff_H) {
346 const int NcA = Nc * Nc - 1;
362 vout.
general(
m_vl,
" H_kin/dof = %18.8f\n", H_iP / NcA / Nvol / NPE / Ndim);
365 double H_actions = 0.0;
366 for (
int i = 0; i <
m_action.size(); ++i) {
371 const double H_total = H_iP + H_actions;
379 const int Nin = U.
nin();
380 const int Nvol = U.
nvol();
381 const int Nex = U.
nex();
385 const int NcA = Nc * Nc - 1;
392 const double H_iP =
calcH_P(iP);
394 vout.
general(
m_vl,
" H_kin/dof = %18.8f\n", H_iP / NcA / Nvol / NPE / Nex);
396 double H_actions = 0.0;
397 for (
int i = 0; i <
m_action.size(); ++i) {
402 const double H_total = H_iP + H_actions;
411 const double hn = iP.
norm();
412 const double H_iP = 0.5 * hn * hn;
424 const double estep2 = 0.5 *
m_Estep;
434 for (
int imdc = 1; imdc <
m_Nmdc + 1; imdc++) {
451 const int Nin = U.
nin();
452 const int Nvol = U.
nvol();
453 const int Nex = U.
nex();
456 Field force(Nin, Nvol, Nex);
460 Field force1(Nin, Nvol, Nex);
462 for (
int i = 0; i <
m_action.size(); ++i) {
464 axpy(force, estep, force1);
468 axpy(iP, 1.0, force);
475 const int Nvol = U.
nvol();
476 const int Nex = U.
nex();
482 for (
int ex = 0; ex < Nex; ++ex) {
483 for (
int site = 0; site < Nvol; ++site) {
484 u0 = U.
mat(site, ex);
485 u1 = U.
mat(site, ex);
486 h1 = iP.
mat(site, ex);
488 for (
int iprec = 0; iprec <
m_Nprec; ++iprec) {
489 double exf = estep / (m_Nprec - iprec);
int fetch_bool(const string &key, bool &value) const
void set_parameters(const Parameters ¶ms)
void set(const int jin, const int site, const int jex, double v)
double calcH_P(const Field_G &iP)
void general(const char *format,...)
Container of Field-type object.
int fetch_double(const string &key, double &value) const
double plaquette(const Field_G &)
calculates plaquette value.
static const std::string class_name
double set_iP(Field_G &iP)
Setting conjugate momenta and returns kinetic part of Hamiltonian.
double calc_Hamiltonian(const Field_G &iP, const Field_G &U)
Langevin_Momentum * m_Langevin_P
Bridge::VerboseLevel m_vl
std::vector< Action * > m_action
ActionSet get_actions() const
int fetch_int(const string &key, int &value) const
void integrate(Field_G &iP, Field_G &U)
Common parameter class: provides parameters as singleton.
double langevin(Field_G &iP, const Field_G &U)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void update_U(const double estep, const Field_G &iP, Field_G &U)
void crucial(const char *format,...)
std::vector< Director * > m_director
lists of actions at respective integrator levels.
Base class of random number generators.
~HMC_Leapfrog()
destructor
string get_string(const string &key) const
void set_mat(const int site, const int mn, const Mat_SU_N &U)
std::vector< Action * > ActionSet
Mat_SU_N mat(const int site, const int mn=0) const
static VerboseLevel set_verbose_level(const std::string &str)
HMC_Leapfrog(std::vector< Action * > action, RandomNumbers *rand)
constructor: with array of actions
Langevin part of HMC for conjugate momentum to link variable.
void update_P(const double estep, Field_G &iP, const Field_G &U)