Bridge++  Version 1.5.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 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Force_G_Plaq_SF::register_factory();
19 }
20 #endif
21 
22 const std::string Force_G_Plaq_SF::class_name = "Force_G_Plaq_SF";
23 
24 //====================================================================
26 {
27  const string str_vlevel = params.get_string("verbose_level");
28 
29  m_vl = vout.set_verbose_level(str_vlevel);
30 
31  //- fetch and check input parameters
32  double beta, ct0, ct1, ct2;
33  std::vector<double> phi, phipr;
34 
35  int err = 0;
36  err += params.fetch_double("beta", beta);
37  err += params.fetch_double("ct0", ct0);
38  err += params.fetch_double("ct1", ct1);
39  err += params.fetch_double("ct2", ct2);
40  err += params.fetch_double_vector("phi", phi);
41  err += params.fetch_double_vector("phipr", phipr);
42 
43  if (err) {
44  vout.crucial(m_vl, "Error ar %s: input parameter not found.\n", class_name.c_str());
45  exit(EXIT_FAILURE);
46  }
47 
48 
49  const double gg = 6.0 / beta;
50  const double ct = ct0 + ct1 * gg + ct2 * gg * gg;
51 
52  set_parameters(beta, &phi[0], &phipr[0], ct);
53 }
54 
55 
56 //====================================================================
57 
66 void Force_G_Plaq_SF::set_parameters(const double beta,
67  double *phi, double *phipr, const double ct)
68 {
69  //- print input parameters
70  vout.general(m_vl, "%s:\n", class_name.c_str());
71  vout.general(m_vl, " beta = %12.6f\n", beta);
72  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
73  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
74  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
75  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
76  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
77  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
78  vout.general(m_vl, " ct = %12.6f\n", ct);
79 
80  //- range check
81  // NB. beta,phi,phipr,ct = 0 is allowed.
82 
83  //- store values
84  m_beta = beta;
85 
86  m_ct = ct;
87 
88  m_phi = phi;
89  m_phipr = phipr;
90 
91  //- post-process
93 }
94 
95 
96 //====================================================================
97 
109 {
110  const int Nin = m_U->nin();
111  const int Nvol = m_U->nvol();
112  const int Nex = m_U->nex();
113  const int Nc = CommonParameters::Nc();
114 
115  assert(force.nin() == Nin);
116  assert(force.nvol() == Nvol);
117  assert(force.nex() == Nex);
118 
119  for (int mu = 0; mu < Nex; ++mu) {
120  Field_G st;
121  m_staple.staple_ct(st, *m_U, mu, m_ct);
122 
123  Field_G force1;
124 
125  for (int site = 0; site < Nvol; ++site) {
126  Mat_SU_N ut(Nc);
127  ut = m_U->mat(site, mu) * st.mat_dag(site);
128  ut.at();
129  force1.set_mat(site, 0, ut);
130  }
131  axpy(force, mu, -(m_beta / Nc), force1, 0);
132  }
133 
134  double Fave, Fmax, Fdev;
135  force.stat(Fave, Fmax, Fdev);
136  vout.general(m_vl, " Fave = %12.6f Fmax = %12.6f Fdev = %12.6f\n",
137  Fave, Fmax, Fdev);
138 }
139 
140 
141 //====================================================================
142 
149 {
150  const int Nc = CommonParameters::Nc();
151  const int Nx = CommonParameters::Nx();
152  const int Ny = CommonParameters::Ny();
153  const int Nz = CommonParameters::Nz();
154  const int Nt = CommonParameters::Nt();
155 
156  // if(comm->ipe(3)==0){
157  for (int t = 0; t < Nt; t++) {
158  for (int x = 0; x < Nx; x++) {
159  for (int y = 0; y < Ny; y++) {
160  for (int z = 0; z < Nz; z++) {
161  Index_lex index;
162  int ix = index.site(x, y, z, t);
163 
164  for (int mu = 0; mu < 4; mu++) {
165  Mat_SU_N Tmp(Nc);
166  Tmp = U->mat(ix, mu);
167 
168  for (int c = 0; c < Nc * Nc; ++c) {
169  vout.general(m_vl, "%d %d %d %d %d %d %0.16e %0.16e\n",
170  x, y, z, t, mu, c, Tmp.r(c), Tmp.i(c));
171  }
172  }
173  }
174  }
175  }
176  }
177 }
178 
179 
180 //====================================================================
181 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
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:410
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:197
Container of Field-type object.
Definition: field.h:45
double * m_phi
SF boundary condition at t=0.
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
int nvol() const
Definition: field.h:127
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:35
int nin() const
Definition: field.h:126
SU(N) gauge field.
Definition: field_G.h:38
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:128
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:319
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:667
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
double r(int c) const
Definition: mat_SU_N.h:114
void staple_ct(Field_G &, const Field_G &, const int, const double ct)
Definition: staple_SF.cpp:842
void force_core(Field &)
string get_string(const string &key) const
Definition: parameters.cpp:221
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
double m_ct
SF boundary improvement coefficient for the plaquatte force.
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131