Bridge++  Ver. 2.0.2
action_G_Plaq.cpp
Go to the documentation of this file.
1 
14 #include "action_G_Plaq.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Action_G_Plaq::register_factory();
19 }
20 #endif
21 
22 const std::string Action_G_Plaq::class_name = "Action_G_Plaq";
23 
24 //====================================================================
26 {
27  std::string vlevel;
28  if (!params.fetch_string("verbose_level", vlevel)) {
29  m_vl = vout.set_verbose_level(vlevel);
30  }
31 
32  //- fetch and check input parameters
33  double beta;
34 
35  int err = 0;
36  err += params.fetch_double("beta", beta);
37 
38  if (err) {
39  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
40  exit(EXIT_FAILURE);
41  }
42 
43 
44  set_parameters(beta);
45 
46  //- post-process
47  m_force_G->set_parameters(params);
48 }
49 
50 
51 //====================================================================
53 {
54  params.set_double("beta", m_beta);
55 
56  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
57 }
58 
59 
60 //====================================================================
61 void Action_G_Plaq::set_parameters(const double beta)
62 {
63  //- print input parameters
64  vout.general(m_vl, "%s:\n", class_name.c_str());
65  vout.general(m_vl, " beta = %8.4f\n", beta);
66 
67  //- range check
68  // NB. beta == 0 is allowed.
69 
70  //- store values
71  m_beta = beta;
72 }
73 
74 
75 //====================================================================
77 {
78  const double H_U = calcH(); // calculate action H_U=beta*(1-Plaq)*Lvol*6 (SA)
79 
80  return H_U;
81 }
82 
83 
84 //====================================================================
86 {
87  const int Ndim = CommonParameters::Ndim();
88  const int Ndim2 = Ndim * (Ndim - 1) / 2;
89 
90  const int Nvol = CommonParameters::Nvol();
91  const int NPE = CommonParameters::NPE();
92 
93  const double plaq = m_staple.plaquette(*m_U); // calculate plaquette (SA)
94  const double H_U = m_beta * (1.0 - plaq) * Nvol * NPE * Ndim2; // action (SA)
95 
96  vout.general(m_vl, "H_Gplaq = %18.8f\n", H_U); // total action (SA)
97  vout.general(m_vl, "H_G/dof = %18.8f\n", H_U / Nvol / NPE / Ndim2); // action per dof (SA)
98 
99  return H_U;
100 }
101 
102 
103 //====================================================================
105 {
106  //- check of argument type
107  assert(force.nin() == m_U->nin());
108  assert(force.nvol() == m_U->nvol());
109  assert(force.nex() == m_U->nex());
110 
111  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
112 
113  force.set(0.0);
114 
116 }
117 
118 
119 //====================================================================
120 //============================================================END=====
Action_G_Plaq::langevin
double langevin(RandomNumbers *)
Langevis step.
Definition: action_G_Plaq.cpp:76
action_G_Plaq.h
Action_G_Plaq::m_vl
Bridge::VerboseLevel m_vl
Definition: action_G_Plaq.h:39
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Action_G_Plaq::m_beta
double m_beta
Definition: action_G_Plaq.h:41
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
Parameters
Class for parameters.
Definition: parameters.h:46
Force_G::force_core
virtual void force_core(Field &)=0
Staple_lex::plaquette
double plaquette(const Field_G &)
calculates plaquette value.
Definition: staple_lex.cpp:89
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Field::nex
int nex() const
Definition: field.h:128
RandomNumbers
Base class of random number generators.
Definition: randomNumbers.h:43
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
Action_G_Plaq::get_parameters
void get_parameters(Parameters &params) const
Definition: action_G_Plaq.cpp:52
Action_G_Plaq::set_parameters
void set_parameters(const Parameters &params)
Definition: action_G_Plaq.cpp:25
Field::nin
int nin() const
Definition: field.h:126
Force_G::set_parameters
virtual void set_parameters(const Parameters &)=0
Action_G_Plaq::m_label
std::string m_label
Definition: action_G_Plaq.h:42
Action_G_Plaq::calcH
double calcH()
calculate Hamiltonian of this action term.
Definition: action_G_Plaq.cpp:85
Action_G_Plaq::m_force_G
Force_G * m_force_G
Definition: action_G_Plaq.h:46
Action_G_Plaq::class_name
static const std::string class_name
Definition: action_G_Plaq.h:36
Field::nvol
int nvol() const
Definition: field.h:127
CommonParameters::NPE
static int NPE()
Definition: commonParameters.h:101
Action_G_Plaq::m_U
Field_G * m_U
Definition: action_G_Plaq.h:44
Action_G_Plaq::force
void force(Field &)
returns force for molcular dynamical update of conjugate momenta.
Definition: action_G_Plaq.cpp:104
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Action_G_Plaq::m_staple
Staple_lex m_staple
Definition: action_G_Plaq.h:45
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154