Bridge++  Ver. 1.3.x
action_G_Plaq_SF.cpp
Go to the documentation of this file.
1 
14 #include "action_G_Plaq_SF.h"
15 
16 
17 #ifdef USE_FACTORY
18 namespace {
19  Action *create_object()
20  {
21  return new Action_G_Plaq_SF();
22  }
23 
24 
25  bool init = Action::Factory::Register("Action_G_Plaq_SF", create_object);
26 }
27 #endif
28 
29 
30 //- parameter entries
31 namespace {
32  void append_entry(Parameters& param)
33  {
34  param.Register_double("beta", 0.0);
35 
36  param.Register_double("ct0", 0.0);
37  param.Register_double("ct1", 0.0);
38  param.Register_double("ct2", 0.0);
39 
40  param.Register_double_vector("phi", std::vector<double>());
41  param.Register_double_vector("phipr", std::vector<double>());
42 
43  param.Register_string("verbose_level", "NULL");
44  }
45 
46 
47 #ifdef USE_PARAMETERS_FACTORY
48  bool init_param = ParametersFactory::Register("Action.G_Plaq_SF", append_entry);
49 #endif
50 }
51 //- end
52 
53 //- parameters class
55 //- end
56 
57 const std::string Action_G_Plaq_SF::class_name = "Action_G_Plaq_SF";
58 
59 //====================================================================
61 {
62  const string str_vlevel = params.get_string("verbose_level");
63 
64  m_vl = vout.set_verbose_level(str_vlevel);
65 
66  //- fetch and check input parameters
67  double beta, ct0, ct1, ct2;
68  std::vector<double> phi, phipr;
69 
70  int err = 0;
71  err += params.fetch_double("beta", beta);
72  err += params.fetch_double("ct0", ct0);
73  err += params.fetch_double("ct1", ct1);
74  err += params.fetch_double("ct2", ct2);
75  err += params.fetch_double_vector("phi", phi);
76  err += params.fetch_double_vector("phipr", phipr);
77 
78  if (err) {
79  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
80  exit(EXIT_FAILURE);
81  }
82 
83 
84  double gg = 6.0 / beta;
85  double ct = ct0 + ct1 * gg + ct2 * gg * gg;
86 
87  set_parameters(beta, &phi[0], &phipr[0], ct);
88 }
89 
90 
91 //====================================================================
92 
101 void Action_G_Plaq_SF::set_parameters(double beta, double *phi, double *phipr, double ct)
102 {
103  //- print input parameters
104  vout.general(m_vl, "%s:\n", class_name.c_str());
105  vout.general(m_vl, " beta = %12.6f\n", beta);
106  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
107  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
108  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
109  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
110  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
111  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
112  vout.general(m_vl, " ct = %12.6f\n", ct);
113 
114  //- range check
115  // NB. beta,phi,phipr,ct = 0 is allowed.
116 
117  //- store values
118  m_beta = beta;
119 
120  m_ct = ct;
121 
122  m_phi = phi;
123  m_phipr = phipr;
124 
125  //- post-process
127 
128  int Nc = CommonParameters::Nc();
129  int Nvol = CommonParameters::Nvol();
130  int Ndim = CommonParameters::Ndim();
131  int NinG = 2 * Nc * Nc;
132 }
133 
134 
135 //====================================================================
137 {
138  double H_U = calcH();
139 
140  return H_U;
141 }
142 
143 
144 //====================================================================
145 
161 {
162  int Nc = CommonParameters::Nc();
163 
164  double plaq = m_staple.plaquette_ct(*m_U, m_ct);
165 
166  double H_U = -1.0 / Nc * m_beta * plaq;
167 
168  vout.general(m_vl, "H_Gplaq = %18.8f\n", H_U);
169 
170  return H_U;
171 }
172 
173 
174 //====================================================================
175 
187 {
188  int Nin = m_U->nin();
189  int Nvol = m_U->nvol();
190  int Nex = m_U->nex();
191  int Nc = CommonParameters::Nc();
192 
193  assert(force.nin() == Nin);
194  assert(force.nvol() == Nvol);
195  assert(force.nex() == Nex);
196 
197  force.set(0.0);
198 
199  double betaNc = m_beta / Nc;
200  Mat_SU_N ut(Nc);
201 
202  Field_G st(Nvol, 1), force1(Nvol, 1);
203 
204  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
205 
206  for (int mu = 0; mu < Nex; ++mu) {
207  m_staple.staple_ct(st, *m_U, mu, m_ct);
208  for (int site = 0; site < Nvol; ++site) {
209  ut = m_U->mat(site, mu) * st.mat_dag(site);
210  ut.at();
211  force1.set_mat(site, 0, ut);
212  }
213  axpy(force, mu, -betaNc, force1, 0);
214  }
215 
216  double Fave, Fmax, Fdev;
217  force.stat(Fave, Fmax, Fdev);
218  vout.general(m_vl, " Fave = %12.6f Fmax = %10.6f Fdev = %12.6f\n",
219  Fave, Fmax, Fdev);
220 }
221 
222 
229 //====================================================================
230 
231 
232 //====================================================================
234 {
235  int Nc = CommonParameters::Nc();
236  int Nx = CommonParameters::Nx();
237  int Ny = CommonParameters::Ny();
238  int Nz = CommonParameters::Nz();
239  int Nt = CommonParameters::Nt();
240 
241  Index_lex idx;
242  int ix;
243  Mat_SU_N Tmp(Nc);
244 
245  // if(comm->ipe(3)==0){
246  for (int t = 0; t < Nt; t++) {
247  for (int x = 0; x < Nx; x++) {
248  for (int y = 0; y < Ny; y++) {
249  for (int z = 0; z < Nz; z++) {
250  ix = idx.site(x, y, z, t);
251 
252  for (int mu = 0; mu < 4; mu++) {
253  Tmp = U->mat(ix, mu);
254  for (int c = 0; c < Nc * Nc; ++c) {
255  vout.general(m_vl, "%d %d %d %d %d %d %0.16e %0.16e\n",
256  x, y, z, t, mu, c, Tmp.r(c), Tmp.i(c));
257  }
258  }
259  }
260  }
261  }
262  }
263 }
264 
265 
266 //====================================================================
267 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:278
double i(int c) const
Definition: mat_SU_N.h:115
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:155
void set_parameters(const Parameters &params)
Definition: staples_SF.cpp:62
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:53
void general(const char *format,...)
Definition: bridgeIO.cpp:65
void set_parameters(const Parameters &params)
Container of Field-type object.
Definition: field.h:39
int nvol() const
Definition: field.h:116
std::string m_label
Class for parameters.
Definition: parameters.h:38
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:329
Base class of HMC action class family.
Definition: action.h:42
int nin() const
Definition: field.h:115
void staple_ct(Field_G &, const Field_G &, const int, double ct)
Definition: staples_SF.cpp:805
HMC action class for plaquette gauge action with SF BC.
SU(N) gauge field.
Definition: field_G.h:38
double m_ct
SF boundary improvement coefficient for the plaquatte action.
int nex() const
Definition: field.h:117
Lexical site index.
Definition: index_lex.h:34
double * m_phipr
SF boundary condition at t=Nt.
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
void print_force(const Field_G *)
Print out the gauge force for the boundary spatial links (for debugging).
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
static bool Register(const std::string &realm, const creator_callback &cb)
Bridge::VerboseLevel m_vl
Definition: action.h:81
Base class of random number generators.
Definition: randomNumbers.h:39
void Register_double_vector(const string &, const std::vector< double > &)
Definition: parameters.cpp:337
static const std::string class_name
void stat(double &Fave, double &Fmax, double &Fdev) const
determines the statistics of the field. average, maximum value, and deviation is determined over glob...
Definition: field.cpp:516
int fetch_double_vector(const string &key, std::vector< double > &val) const
Definition: parameters.cpp:158
void Register_double(const string &, const double)
Definition: parameters.cpp:323
double r(int c) const
Definition: mat_SU_N.h:114
double plaquette_ct(const Field_G &, double ct)
Definition: staples_SF.cpp:619
double langevin(RandomNumbers *)
Langevis step.
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:87
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:159
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:113
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:28
double * m_phi
SF boundary condition at t=0.