Bridge++  Ver. 2.0.2
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  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 
56 
57 //====================================================================
59 {
60  params.set_double("beta", m_beta);
61  // params.set_double("ct0", m_ct0);
62  // params.set_double("ct1", m_ct1);
63  // params.set_double("ct2", m_ct2);
64  params.set_double_vector("phi", m_phi);
65  params.set_double_vector("phipr", m_phipr);
66 
67  params.set_double("ct", m_ct);
68 
69  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
70 }
71 
72 
73 //====================================================================
74 
83 void Force_G_Plaq_SF::set_parameters(const double beta,
84  double *phi, double *phipr, const double ct)
85 {
86  //- print input parameters
87  vout.general(m_vl, "%s:\n", class_name.c_str());
88  vout.general(m_vl, " beta = %12.6f\n", beta);
89  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
90  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
91  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
92  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
93  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
94  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
95  vout.general(m_vl, " ct = %12.6f\n", ct);
96 
97  //- range check
98  // NB. beta,phi,phipr,ct = 0 is allowed.
99 
100  //- store values
101  m_beta = beta;
102 
103  m_ct = ct;
104 
105  // m_phi = phi;
106  // m_phipr = phipr;
107  m_phi.resize(3);
108  m_phipr.resize(3);
109  for (int i = 0; i < 3; ++i) {
110  m_phi[i] = phi[i];
111  m_phipr[i] = phipr[i];
112  }
113 
114  //- post-process
116 }
117 
118 
119 //====================================================================
120 
132 {
133  const int Nin = m_U->nin();
134  const int Nvol = m_U->nvol();
135  const int Nex = m_U->nex();
136  const int Nc = CommonParameters::Nc();
137 
138  assert(force.nin() == Nin);
139  assert(force.nvol() == Nvol);
140  assert(force.nex() == Nex);
141 
142  for (int mu = 0; mu < Nex; ++mu) {
143  Field_G st;
144  m_staple.staple_ct(st, *m_U, mu, m_ct);
145 
146  Field_G force1;
147 
148  for (int site = 0; site < Nvol; ++site) {
149  Mat_SU_N ut(Nc);
150  ut = m_U->mat(site, mu) * st.mat_dag(site);
151  ut.at();
152  force1.set_mat(site, 0, ut);
153  }
154  axpy(force, mu, -(m_beta / Nc), force1, 0);
155  }
156 
157  double Fave, Fmax, Fdev;
158  force.stat(Fave, Fmax, Fdev);
159  vout.general(m_vl, " Fave = %12.6f Fmax = %12.6f Fdev = %12.6f\n",
160  Fave, Fmax, Fdev);
161 }
162 
163 
164 //====================================================================
165 
172 {
173  const int Nc = CommonParameters::Nc();
174  const int Nx = CommonParameters::Nx();
175  const int Ny = CommonParameters::Ny();
176  const int Nz = CommonParameters::Nz();
177  const int Nt = CommonParameters::Nt();
178 
179  // if(comm->ipe(3)==0){
180  for (int t = 0; t < Nt; t++) {
181  for (int x = 0; x < Nx; x++) {
182  for (int y = 0; y < Ny; y++) {
183  for (int z = 0; z < Nz; z++) {
184  Index_lex index;
185  int ix = index.site(x, y, z, t);
186 
187  for (int mu = 0; mu < 4; mu++) {
188  Mat_SU_N Tmp(Nc);
189  Tmp = U->mat(ix, mu);
190 
191  for (int c = 0; c < Nc * Nc; ++c) {
192  vout.general(m_vl, "%d %d %d %d %d %d %0.16e %0.16e\n",
193  x, y, z, t, mu, c, Tmp.r(c), Tmp.i(c));
194  }
195  }
196  }
197  }
198  }
199  }
200 }
201 
202 
203 //====================================================================
204 //============================================================END=====
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Index_lex
Lexical site index.
Definition: index_lex.h:34
Staple_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: staple_SF.cpp:35
Staple_SF::staple_ct
void staple_ct(Field_G &, const Field_G &, const int, const double ct)
Definition: staple_SF.cpp:833
Force_G_Plaq_SF::m_staple
Staple_SF m_staple
Definition: force_G_Plaq_SF.h:86
Parameters
Class for parameters.
Definition: parameters.h:46
Field_G::mat_dag
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Force_G_Plaq_SF::print_force
void print_force(const Field_G *)
Print out the gauge force for the boundary spatial links (for debugging).
Definition: force_G_Plaq_SF.cpp:171
Field::nex
int nex() const
Definition: field.h:128
Field_G::set_mat
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:160
Force_G_Plaq_SF::force_core
void force_core(Field &)
Definition: force_G_Plaq_SF.cpp:131
Field::stat
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:169
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Parameters::set_double_vector
void set_double_vector(const string &key, const vector< double > &value)
Definition: parameters.cpp:42
Field::nin
int nin() const
Definition: field.h:126
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
Force_G_Plaq_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: force_G_Plaq_SF.h:70
Force_G_Plaq_SF::m_beta
double m_beta
Definition: force_G_Plaq_SF.h:75
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
Force_G_Plaq_SF::class_name
static const std::string class_name
Definition: force_G_Plaq_SF.h:67
SU_N::Mat_SU_N
Definition: mat_SU_N.h:36
Force_G_Plaq_SF::m_phipr
std::vector< double > m_phipr
SF boundary condition at t=Nt.
Definition: force_G_Plaq_SF.h:82
SU_N::Mat_SU_N::at
Mat_SU_N & at()
antihermitian traceless
Definition: mat_SU_N.h:375
SU_N::Mat_SU_N::r
double r(int c) const
Definition: mat_SU_N.h:115
Field::nvol
int nvol() const
Definition: field.h:127
force_G_Plaq_SF.h
Index_lex::site
int site(const int &x, const int &y, const int &z, const int &t) const
Definition: index_lex.h:55
Force_G_Plaq_SF::set_parameters
void set_parameters(const Parameters &params)
Definition: force_G_Plaq_SF.cpp:25
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Force_G::m_U
Field_G * m_U
Definition: force_G.h:34
SU_N::Mat_SU_N::i
double i(int c) const
Definition: mat_SU_N.h:116
Force_G_Plaq_SF::get_parameters
void get_parameters(Parameters &params) const
Definition: force_G_Plaq_SF.cpp:58
Force_G_Plaq_SF::m_phi
std::vector< double > m_phi
SF boundary condition at t=0.
Definition: force_G_Plaq_SF.h:79
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
Force_G_Plaq_SF::m_ct
double m_ct
SF boundary improvement coefficient for the plaquatte force.
Definition: force_G_Plaq_SF.h:84
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Field
Container of Field-type object.
Definition: field.h:46
Field_G::mat
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Parameters::fetch_double_vector
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:410
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