Bridge++  Ver. 2.0.2
action_G_Plaq_SF.cpp
Go to the documentation of this file.
1 
14 #include "action_G_Plaq_SF.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Action_G_Plaq_SF::register_factory();
19 }
20 #endif
21 
22 const std::string Action_G_Plaq_SF::class_name = "Action_G_Plaq_SF";
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, ct0, ct1, ct2;
34  std::vector<double> phi, phipr;
35 
36  int err = 0;
37  err += params.fetch_double("beta", beta);
38  err += params.fetch_double("ct0", ct0);
39  err += params.fetch_double("ct1", ct1);
40  err += params.fetch_double("ct2", ct2);
41  err += params.fetch_double_vector("phi", phi);
42  err += params.fetch_double_vector("phipr", phipr);
43 
44  if (err) {
45  vout.crucial(m_vl, "Error ar %s: input parameter not found.\n", class_name.c_str());
46  exit(EXIT_FAILURE);
47  }
48 
49 
50  const double gg = 6.0 / beta;
51  const double ct = ct0 + ct1 * gg + ct2 * gg * gg;
52 
53  set_parameters(beta, &phi[0], &phipr[0], ct);
54 
55  //- post-process
56  m_force_G->set_parameters(params);
57 }
58 
59 
60 //====================================================================
62 {
63  params.set_double("beta", m_beta);
64  // params.set_double("ct0", m_ct0);
65  // params.set_double("ct1", m_ct1);
66  // params.set_double("ct2", m_ct2);
67  params.set_double_vector("phi", m_phi);
68  params.set_double_vector("phipr", m_phipr);
69 
70  params.set_double("ct", m_ct);
71 
72  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
73 }
74 
75 
76 //====================================================================
77 
86 void Action_G_Plaq_SF::set_parameters(const double beta,
87  double *phi, double *phipr,
88  const double ct)
89 {
90  //- print input parameters
91  vout.general(m_vl, "%s:\n", class_name.c_str());
92  vout.general(m_vl, " beta = %12.6f\n", beta);
93  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
94  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
95  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
96  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
97  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
98  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
99  vout.general(m_vl, " ct = %12.6f\n", ct);
100 
101  //- range check
102  // NB. beta,phi,phipr,ct = 0 is allowed.
103 
104  //- store values
105  m_beta = beta;
106 
107  // m_phi = phi;
108  // m_phipr = phipr;
109  // m_ct = ct;
110  // m_phi = std::vector<double>(phi, phi+3);
111  // m_phipr = std::vector<double>(phipr, phi+3);
112  m_phi.resize(3);
113  m_phipr.resize(3);
114  for (int i = 0; i < 3; ++i) {
115  m_phi[i] = phi[i];
116  m_phipr[i] = phipr[i];
117  }
118  // m_phipr = std::vector<double>(phipr, phi+3);
119  m_ct = ct;
120 
121  //- post-process
123 }
124 
125 
126 //====================================================================
128 {
129  const double H_U = calcH();
130 
131  return H_U;
132 }
133 
134 
135 //====================================================================
136 
152 {
153  const int Nc = CommonParameters::Nc();
154 
155  const double plaq = m_staple.plaquette_ct(*m_U, m_ct);
156 
157  const double H_U = -(1.0 / Nc) * m_beta * plaq;
158 
159  vout.general(m_vl, "H_Gplaq = %18.8f\n", H_U);
160 
161  return H_U;
162 }
163 
164 
165 //====================================================================
166 
178 {
179  //- check of argument type
180  assert(force.nin() == m_U->nin());
181  assert(force.nvol() == m_U->nvol());
182  assert(force.nex() == m_U->nex());
183 
184  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
185 
186  force.set(0.0);
187 
189 }
190 
191 
192 //====================================================================
193 //============================================================END=====
Action_G_Plaq_SF::force
void force(Field &)
Definition: action_G_Plaq_SF.cpp:177
Action_G_Plaq_SF::m_U
Field_G * m_U
Definition: action_G_Plaq_SF.h:82
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Staple_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:35
Action_G_Plaq_SF::m_ct
double m_ct
SF boundary improvement coefficient for the plaquatte action.
Definition: action_G_Plaq_SF.h:78
Parameters
Class for parameters.
Definition: parameters.h:46
Force_G::force_core
virtual void force_core(Field &)=0
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
Action_G_Plaq_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: action_G_Plaq_SF.h:69
Parameters::set_double_vector
void set_double_vector(const string &key, const vector< double > &value)
Definition: parameters.cpp:42
Action_G_Plaq_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: action_G_Plaq_SF.cpp:25
Field::nin
int nin() const
Definition: field.h:126
Action_G_Plaq_SF::m_staple
Staple_SF m_staple
Definition: action_G_Plaq_SF.h:83
Action_G_Plaq_SF::get_parameters
void get_parameters(Parameters &params) const
Definition: action_G_Plaq_SF.cpp:61
Force_G::set_parameters
virtual void set_parameters(const Parameters &)=0
Staple_SF::plaquette_ct
double plaquette_ct(const Field_G &, const double ct)
Definition: staple_SF.cpp:632
Action_G_Plaq_SF::m_label
std::string m_label
Definition: action_G_Plaq_SF.h:80
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
Action_G_Plaq_SF::m_force_G
Force_G * m_force_G
Definition: action_G_Plaq_SF.h:84
Field::nvol
int nvol() const
Definition: field.h:127
Action_G_Plaq_SF::langevin
double langevin(RandomNumbers *)
Langevis step.
Definition: action_G_Plaq_SF.cpp:127
action_G_Plaq_SF.h
Action_G_Plaq_SF::class_name
static const std::string class_name
Definition: action_G_Plaq_SF.h:66
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Action_G_Plaq_SF::calcH
double calcH()
Definition: action_G_Plaq_SF.cpp:151
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
Action_G_Plaq_SF::m_beta
double m_beta
Definition: action_G_Plaq_SF.h:71
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Action_G_Plaq_SF::m_phipr
std::vector< double > m_phipr
SF boundary condition at t=Nt.
Definition: action_G_Plaq_SF.h:76
Parameters::fetch_double_vector
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
Action_G_Plaq_SF::m_phi
std::vector< double > m_phi
SF boundary condition at t=0.
Definition: action_G_Plaq_SF.h:74
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