Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  const string str_vlevel = params.get_string("verbose_level");
28 
29  m_vl = vout.set_verbose_level(str_vlevel);
30 
31  //- fetch and check input parameters
32  double beta;
33 
34  int err = 0;
35  err += params.fetch_double("beta", beta);
36 
37  if (err) {
38  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
39  exit(EXIT_FAILURE);
40  }
41 
42 
43  set_parameters(beta);
44 
45  //- post-process
46  m_force_G->set_parameters(params);
47 }
48 
49 
50 //====================================================================
51 void Action_G_Plaq::set_parameters(const double beta)
52 {
53  //- print input parameters
54  vout.general(m_vl, "%s:\n", class_name.c_str());
55  vout.general(m_vl, " beta = %8.4f\n", beta);
56 
57  //- range check
58  // NB. beta == 0 is allowed.
59 
60  //- store values
61  m_beta = beta;
62 }
63 
64 
65 //====================================================================
67 {
68  const double H_U = calcH(); // calculate action H_U=beta*(1-Plaq)*Lvol*6 (SA)
69 
70  return H_U;
71 }
72 
73 
74 //====================================================================
76 {
77  const int Ndim = CommonParameters::Ndim();
78  const int Ndim2 = Ndim * (Ndim - 1) / 2;
79 
80  const int Nvol = CommonParameters::Nvol();
81  const int NPE = CommonParameters::NPE();
82 
83  const double plaq = m_staple.plaquette(*m_U); // calculate plaquette (SA)
84  const double H_U = m_beta * (1.0 - plaq) * Nvol * NPE * Ndim2; // action (SA)
85 
86  vout.general(m_vl, "H_Gplaq = %18.8f\n", H_U); // total action (SA)
87  vout.general(m_vl, "H_G/dof = %18.8f\n", H_U / Nvol / NPE / Ndim2); // action per dof (SA)
88 
89  return H_U;
90 }
91 
92 
93 //====================================================================
95 {
96  //- check of argument type
97  assert(force.nin() == m_U->nin());
98  assert(force.nvol() == m_U->nvol());
99  assert(force.nex() == m_U->nex());
100 
101  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
102 
103  force.set(0.0);
104 
105  m_force_G->force_core(force, m_U);
106 }
107 
108 
109 //====================================================================
110 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
double langevin(RandomNumbers *)
Langevis step.
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void set_parameters(const Parameters &params)
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Field_G * m_U
Definition: action_G_Plaq.h:42
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
double plaquette(const Field_G &)
calculates plaquette value.
Definition: staple_lex.cpp:38
int nvol() const
Definition: field.h:127
Class for parameters.
Definition: parameters.h:46
Force_G * m_force_G
Definition: action_G_Plaq.h:44
virtual void force_core(Field &)=0
Staple_lex m_staple
Definition: action_G_Plaq.h:43
int nin() const
Definition: field.h:126
int nex() const
Definition: field.h:128
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
Bridge::VerboseLevel m_vl
Definition: action.h:75
Base class of random number generators.
Definition: randomNumbers.h:43
std::string m_label
Definition: action_G_Plaq.h:40
virtual void set_parameters(const Parameters &)=0
string get_string(const string &key) const
Definition: parameters.cpp:221
double calcH()
calculate Hamiltonian of this action term.
static const std::string class_name
Definition: action_G_Plaq.h:36
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void force(Field &)
returns force for molcular dynamical update of conjugate momenta.