Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_G_Plaq_SF.cpp
Go to the documentation of this file.
1 
14 #include "action_G_Plaq_SF.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 //- parameter entries
21 namespace {
22  void append_entry(Parameters& param)
23  {
24  param.Register_double("beta", 0.0);
25 
26  param.Register_double("ct0", 0.0);
27  param.Register_double("ct1", 0.0);
28  param.Register_double("ct2", 0.0);
29 
30  param.Register_double_vector("phi", std::valarray<double>());
31  param.Register_double_vector("phipr", std::valarray<double>());
32 
33  param.Register_string("verbose_level", "NULL");
34  }
35 
36 
37 #ifdef USE_PARAMETERS_FACTORY
38  bool init_param = ParametersFactory::Register("Action.G_Plaq_SF", append_entry);
39 #endif
40 }
41 //- end
42 
43 //- parameters class
45 //- end
46 
47 const std::string Action_G_Plaq_SF::class_name = "Action_G_Plaq_SF";
48 
49 //====================================================================
51 {
52  const string str_vlevel = params.get_string("verbose_level");
53 
54  m_vl = vout.set_verbose_level(str_vlevel);
55 
56  //- fetch and check input parameters
57  double beta, ct0, ct1, ct2;
58  std::valarray<double> phi, phipr;
59 
60  int err = 0;
61  err += params.fetch_double("beta", beta);
62  err += params.fetch_double("ct0", ct0);
63  err += params.fetch_double("ct1", ct1);
64  err += params.fetch_double("ct2", ct2);
65  err += params.fetch_double_vector("phi", phi);
66  err += params.fetch_double_vector("phipr", phipr);
67 
68  if (err) {
69  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
70  abort();
71  }
72 
73 
74  double gg = 6.0 / beta;
75  double ct = ct0 + ct1 * gg + ct2 * gg * gg;
76 
77  set_parameters(beta, &phi[0], &phipr[0], ct);
78 }
79 
80 
81 //====================================================================
82 
91 void Action_G_Plaq_SF::set_parameters(double beta, double *phi, double *phipr, double ct)
92 {
93  //- print input parameters
94  vout.general(m_vl, "%s:\n", class_name.c_str());
95  vout.general(m_vl, " beta = %12.6f\n", beta);
96  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
97  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
98  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
99  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
100  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
101  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
102  vout.general(m_vl, " ct = %12.6f\n", ct);
103 
104  //- range check
105  // NB. beta,phi,phipr,ct = 0 is allowed.
106 
107  //- store values
108  m_beta = beta;
109 
110  m_ct = ct;
111 
112  m_phi = phi;
113  m_phipr = phipr;
114 
115  //- post-process
117 
118  int Nc = CommonParameters::Nc();
119  int Nvol = CommonParameters::Nvol();
120  int Ndim = CommonParameters::Ndim();
121  int NinG = 2 * Nc * Nc;
122 
123  m_force.reset(NinG, Nvol, Ndim);
124 
125  m_status_linkv = 0;
126 }
127 
128 
129 //====================================================================
131 {
132  double H_U = calcH();
133 
134  m_status_linkv = 0;
135 
136  return H_U;
137 }
138 
139 
140 //====================================================================
141 
157 {
158  int Nc = CommonParameters::Nc();
159 
160  // double plaq = m_staple.plaquette(m_U);
161  double plaq = m_staple.plaquette_ct(*m_U, m_ct);
162 
163  // double H_U = m_beta * (1.0-plaq) * Lvol * Ndim2;
164  double H_U = -1.0 / Nc * m_beta * plaq;
165 
166  vout.general(m_vl, "H_Gplaq = %18.8f\n", H_U);
167 
168  return H_U;
169 }
170 
171 
172 //====================================================================
173 
185 {
186  if (m_status_linkv == 0) {
187  int Nin = m_U->nin();
188  int Nvol = m_U->nvol();
189  int Nex = m_U->nex();
190  int Nc = CommonParameters::Nc();
191 
192  double betaNc = m_beta / Nc;
193  Mat_SU_N ut(Nc);
194 
195  Field_G force(Nvol, Nex);
196  Field_G st(Nvol, 1);
197 
198  vout.general(m_vl, " %s: %s\n", class_name.c_str(), m_label.c_str());
199 
200  for (int mu = 0; mu < Nex; ++mu) {
201  // m_staple.staple(st,m_U,mu);
202  m_staple.staple_ct(st, *m_U, mu, m_ct);
203  for (int site = 0; site < Nvol; ++site) {
204  ut = m_U->mat(site, mu) * st.mat_dag(site);
205  ut.at();
206  ut *= -betaNc;
207  force.set_mat(site, mu, ut);
208  }
209  }
210 
211  m_force = (Field)force;
212  ++m_status_linkv;
213 
214  double Fave, Fmax, Fdev;
215  m_force.stat(Fave, Fmax, Fdev);
216  vout.general(m_vl, " Fave = %12.6f Fmax = %10.6f Fdev = %12.6f\n",
217  Fave, Fmax, Fdev);
218 
219  return m_force;
220  } else {
221  vout.general(m_vl, " %s returns previous force.\n", class_name.c_str());
222  return m_force;
223  }
224 }
225 
226 
233 //====================================================================
235 {
236  int Nc = CommonParameters::Nc();
237  int Nx = CommonParameters::Nx();
238  int Ny = CommonParameters::Ny();
239  int Nz = CommonParameters::Nz();
240  int Nt = CommonParameters::Nt();
241 
242  Index_lex idx;
243  int ix;
244  Mat_SU_N Tmp(Nc);
245 
246  // if(comm->ipe(3)==0){
247  for (int t = 0; t < Nt; t++) {
248  for (int x = 0; x < Nx; x++) {
249  for (int y = 0; y < Ny; y++) {
250  for (int z = 0; z < Nz; z++) {
251  ix = idx.site(x, y, z, t);
252 
253  for (int mu = 0; mu < 4; mu++) {
254  Tmp = U->mat(ix, mu);
255  for (int c = 0; c < Nc * Nc; ++c) {
256  vout.general(m_vl, "%d %d %d %d %d %d %0.16e %0.16e\n",
257  x, y, z, t, mu, c, Tmp.r(c), Tmp.i(c));
258  }
259  }
260  }
261  }
262  }
263  }
264 }
265 
266 
267 //====================================================================
268 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:207
double i(int c) const
Definition: mat_SU_N.h:115
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
void set_parameters(const Parameters &params)
Definition: staples_SF.cpp:63
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:38
void set_parameters(const Parameters &params)
Container of Field-type object.
Definition: field.h:37
int nvol() const
Definition: field.h:101
std::string m_label
Class for parameters.
Definition: parameters.h:40
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:329
int fetch_double_vector(const string &key, std::valarray< double > &val) const
Definition: parameters.cpp:158
int nin() const
Definition: field.h:100
void staple_ct(Field_G &, const Field_G &, const int, double ct)
Definition: staples_SF.cpp:809
SU(N) gauge field.
Definition: field_G.h:36
double m_ct
SF boundary improvement coefficient for the plaquatte action.
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:82
int nex() const
Definition: field.h:102
Lexical site index.
Definition: index_lex.h:34
double * m_phipr
SF boundary condition at t=Nt.
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:26
static bool Register(const std::string &realm, const creator_callback &cb)
Bridge::VerboseLevel m_vl
Definition: action.h:64
Base class of random number generators.
Definition: randomNumbers.h:40
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:544
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:123
void Register_double_vector(const string &, const std::valarray< double > &)
Definition: parameters.cpp:338
void Register_double(const string &, const double)
Definition: parameters.cpp:324
double r(int c) const
Definition: mat_SU_N.h:114
double plaquette_ct(const Field_G &, double ct)
Definition: staples_SF.cpp:620
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:85
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:156
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:110
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
double * m_phi
SF boundary condition at t=0.