Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
force_G_Plaq_SF.cpp
Go to the documentation of this file.
1 
14 #include "force_G_Plaq_SF.h"
15 
16 
17 #ifdef USE_FACTORY
18 namespace {
19  Force_G *create_object()
20  {
21  return new Force_G_Plaq_SF();
22  }
23 
24 
25  bool init = Force_G::Factory::Register("Force_G_Plaq_SF", create_object);
26 }
27 #endif
28 
29 
30 const std::string Force_G_Plaq_SF::class_name = "Force_G_Plaq_SF";
31 
32 //====================================================================
34 {
35  const string str_vlevel = params.get_string("verbose_level");
36 
37  m_vl = vout.set_verbose_level(str_vlevel);
38 
39  //- fetch and check input parameters
40  double beta, ct0, ct1, ct2;
41  std::vector<double> phi, phipr;
42 
43  int err = 0;
44  err += params.fetch_double("beta", beta);
45  err += params.fetch_double("ct0", ct0);
46  err += params.fetch_double("ct1", ct1);
47  err += params.fetch_double("ct2", ct2);
48  err += params.fetch_double_vector("phi", phi);
49  err += params.fetch_double_vector("phipr", phipr);
50 
51  if (err) {
52  vout.crucial(m_vl, "Error ar %s: input parameter not found.\n", class_name.c_str());
53  exit(EXIT_FAILURE);
54  }
55 
56 
57  double gg = 6.0 / beta;
58  double ct = ct0 + ct1 * gg + ct2 * gg * gg;
59 
60  set_parameters(beta, &phi[0], &phipr[0], ct);
61 }
62 
63 
64 //====================================================================
65 
74 void Force_G_Plaq_SF::set_parameters(double beta, double *phi, double *phipr, double ct)
75 {
76  //- print input parameters
77  vout.general(m_vl, "%s:\n", class_name.c_str());
78  vout.general(m_vl, " beta = %12.6f\n", beta);
79  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
80  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
81  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
82  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
83  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
84  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
85  vout.general(m_vl, " ct = %12.6f\n", ct);
86 
87  //- range check
88  // NB. beta,phi,phipr,ct = 0 is allowed.
89 
90  //- store values
91  m_beta = beta;
92 
93  m_ct = ct;
94 
95  m_phi = phi;
96  m_phipr = phipr;
97 
98  //- post-process
100 }
101 
102 
103 //====================================================================
104 
116 {
117  int Nin = m_U->nin();
118  int Nvol = m_U->nvol();
119  int Nex = m_U->nex();
120  int Nc = CommonParameters::Nc();
121 
122  assert(force.nin() == Nin);
123  assert(force.nvol() == Nvol);
124  assert(force.nex() == Nex);
125 
126  Mat_SU_N ut(Nc);
127  Field_G st(Nvol, 1), force1(Nvol, 1);
128 
129  for (int mu = 0; mu < Nex; ++mu) {
130  m_staple.staple_ct(st, *m_U, mu, m_ct);
131  for (int site = 0; site < Nvol; ++site) {
132  ut = m_U->mat(site, mu) * st.mat_dag(site);
133  ut.at();
134  force1.set_mat(site, 0, ut);
135  }
136  axpy(force, mu, -(m_beta / Nc), force1, 0);
137  }
138 
139  double Fave, Fmax, Fdev;
140  force.stat(Fave, Fmax, Fdev);
141  vout.general(m_vl, " Fave = %12.6f Fmax = %12.6f Fdev = %12.6f\n",
142  Fave, Fmax, Fdev);
143 }
144 
145 
146 //====================================================================
147 
154 {
155  int Nc = CommonParameters::Nc();
156  int Nx = CommonParameters::Nx();
157  int Ny = CommonParameters::Ny();
158  int Nz = CommonParameters::Nz();
159  int Nt = CommonParameters::Nt();
160 
161  Index_lex idx;
162  int ix;
163  Mat_SU_N Tmp(Nc);
164 
165  // if(comm->ipe(3)==0){
166  for (int t = 0; t < Nt; t++) {
167  for (int x = 0; x < Nx; x++) {
168  for (int y = 0; y < Ny; y++) {
169  for (int z = 0; z < Nz; z++) {
170  ix = idx.site(x, y, z, t);
171 
172  for (int mu = 0; mu < 4; mu++) {
173  Tmp = U->mat(ix, mu);
174  for (int c = 0; c < Nc * Nc; ++c) {
175  vout.general(m_vl, "%d %d %d %d %d %d %0.16e %0.16e\n",
176  x, y, z, t, mu, c, Tmp.r(c), Tmp.i(c));
177  }
178  }
179  }
180  }
181  }
182  }
183 }
184 
185 
186 //====================================================================
187 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:495
double i(int c) const
Definition: mat_SU_N.h:115
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:275
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:53
Field_G * m_U
Definition: force_G.h:34
Staple_SF m_staple
void general(const char *format,...)
Definition: bridgeIO.cpp:195
Container of Field-type object.
Definition: field.h:39
void staple_ct(Field_G &, const Field_G &, const int, double ct)
Definition: staple_SF.cpp:782
double * m_phi
SF boundary condition at t=0.
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
int nvol() const
Definition: field.h:116
Class for parameters.
Definition: parameters.h:46
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:329
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:39
int nin() const
Definition: field.h:115
SU(N) gauge field.
Definition: field_G.h:38
Base class of gauge force calculation.
Definition: force_G.h:31
Bridge::VerboseLevel m_vl
Definition: force_G.h:35
void set_parameters(const Parameters &params)
static const std::string class_name
int nex() const
Definition: field.h:117
Lexical site index.
Definition: index_lex.h:34
void print_force(const Field_G *)
Print out the gauge force for the boundary spatial links (for debugging).
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
double * m_phipr
SF boundary condition at t=Nt.
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
double r(int c) const
Definition: mat_SU_N.h:114
void force_core(Field &)
string get_string(const string &key) const
Definition: parameters.cpp:116
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
double m_ct
SF boundary improvement coefficient for the plaquatte force.
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
HMC force class for plaquette gauge force with SF BC.