Bridge++  Version 1.4.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 
17 #ifdef USE_FACTORY
18 namespace {
19  Action *create_object()
20  {
21  return new Action_G_Plaq();
22  }
23 
24 
25  bool init = Action::Factory::Register("Action_G_Plaq", create_object);
26 }
27 #endif
28 
29 
30 
31 const std::string Action_G_Plaq::class_name = "Action_G_Plaq";
32 
33 //====================================================================
35 {
36  const string str_vlevel = params.get_string("verbose_level");
37 
38  m_vl = vout.set_verbose_level(str_vlevel);
39 
40  //- fetch and check input parameters
41  double beta;
42 
43  int err = 0;
44  err += params.fetch_double("beta", beta);
45 
46  if (err) {
47  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
48  exit(EXIT_FAILURE);
49  }
50 
51 
52  set_parameters(beta);
53 
54  //- post-process
55  m_force_G->set_parameters(params);
56 }
57 
58 
59 //====================================================================
61 {
62  //- print input parameters
63  vout.general(m_vl, "%s:\n", class_name.c_str());
64  vout.general(m_vl, " beta = %8.4f\n", beta);
65 
66  //- range check
67  // NB. beta == 0 is allowed.
68 
69  //- store values
70  m_beta = beta;
71 }
72 
73 
74 //====================================================================
76 {
77  double H_U = calcH(); // calculate action H_U=beta*(1-Plaq)*Lvol*6 (SA)
78 
79  return H_U;
80 }
81 
82 
83 //====================================================================
85 {
86  int Lvol = CommonParameters::Lvol();
87  int Ndim = CommonParameters::Ndim();
88 
89  int Ndim2 = Ndim * (Ndim - 1) / 2;
90  int size_U = Lvol * Ndim2;
91 
92  double plaq = m_staple.plaquette(*m_U); // calculate plaquette (SA)
93  double H_U = m_beta * (1.0 - plaq) * Lvol * Ndim2; // action (SA)
94 
95  vout.general(m_vl, "H_Gplaq = %18.8f\n", H_U); // total action (SA)
96  vout.general(m_vl, "H_G/dof = %18.8f\n", H_U / size_U); // action per dof (SA)
97 
98  return H_U;
99 }
100 
101 
102 //====================================================================
104 {
105  //- check of argument type
106  assert(force.nin() == m_U->nin());
107  assert(force.nvol() == m_U->nvol());
108  assert(force.nex() == m_U->nex());
109 
110  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
111 
112  force.set(0.0);
113 
114  m_force_G->force_core(force, m_U);
115 }
116 
117 
118 //====================================================================
119 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:495
double langevin(RandomNumbers *)
Langevis step.
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
HMC action class for plaquette gauge action.
Definition: action_G_Plaq.h:33
void set_parameters(const Parameters &params)
void general(const char *format,...)
Definition: bridgeIO.cpp:195
Field_G * m_U
Definition: action_G_Plaq.h:42
Container of Field-type object.
Definition: field.h:39
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
double plaquette(const Field_G &)
calculates plaquette value.
Definition: staple_lex.cpp:46
int nvol() const
Definition: field.h:116
Class for parameters.
Definition: parameters.h:46
Force_G * m_force_G
Definition: action_G_Plaq.h:44
static int Lvol()
virtual void force_core(Field &)=0
Staple_lex m_staple
Definition: action_G_Plaq.h:43
Base class of HMC action class family.
Definition: action.h:36
int nin() const
Definition: field.h:115
int nex() const
Definition: field.h:117
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:36
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:116
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.