Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_CloverTerm_impl.cpp
Go to the documentation of this file.
1 
14 #include "fopr_CloverTerm_impl.h"
15 
16 namespace Org {
17 //====================================================================
18 
19  const std::string Fopr_CloverTerm::class_name = "Org::Fopr_CloverTerm";
20 
21 //====================================================================
23  {
24  const std::string str_vlevel = params.get_string("verbose_level");
25 
26  m_vl = vout.set_verbose_level(str_vlevel);
27 
28  //- fetch and check input parameters
29  double kappa, cSW;
30  std::vector<int> bc;
31 
32  int err = 0;
33  err += params.fetch_double("hopping_parameter", kappa);
34  err += params.fetch_double("clover_coefficient", cSW);
35  err += params.fetch_int_vector("boundary_condition", bc);
36 
37  if (err) {
38  vout.crucial(m_vl, "Error at %s: input parameter not found\n", class_name.c_str());
39  exit(EXIT_FAILURE);
40  }
41 
42 
43  set_parameters(kappa, cSW, bc);
44  }
45 
46 
47 //====================================================================
48  void Fopr_CloverTerm::set_parameters(const double kappa, const double cSW,
49  const std::vector<int> bc)
50  {
51  //- print input parameters
52  vout.general(m_vl, "%s:\n", class_name.c_str());
53  vout.general(m_vl, " kappa = %12.8f\n", kappa);
54  vout.general(m_vl, " cSW = %12.8f\n", cSW);
55  for (int mu = 0; mu < m_Ndim; ++mu) {
56  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
57  }
58 
59  //- range check
60  // NB. kappa,cSW == 0 is allowed.
61  assert(bc.size() == m_Ndim);
62 
63  //- store values
64  m_kappa = kappa;
65  m_cSW = cSW;
66 
67  // m_boundary.resize(m_Ndim); // already resized in init.
68  m_boundary = bc;
69  }
70 
71 
72 //====================================================================
74  {
75  m_U = (Field_G *)U;
76  set_csw();
77  }
78 
79 
80 //====================================================================
81  void Fopr_CloverTerm::init(const std::string repr)
82  {
87  m_NinF = 2 * m_Nc * m_Nd;
88 
89  m_U = 0;
90 
91  m_repr = repr;
92 
93  m_boundary.resize(m_Ndim);
94  m_SG.resize(m_Ndim * m_Ndim);
95 
96  unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(m_repr));
97 
98  m_GM5 = gmset->get_GM(gmset->GAMMA5);
99 
100  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
101  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
102  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
103  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
104  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
105  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
106 
107  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
108  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
109  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
110  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
111  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
112  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
113 
114  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
115  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
116  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
117  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
118  // these 4 gamma matrices are actually not used.
119  }
120 
121 
122 //====================================================================
124  {
125  // nothing to do.
126  }
127 
128 
129 //====================================================================
131  {
132  assert(v.nvol() == f.nvol());
133  assert(v.nex() == f.nex());
134  assert(v.nin() == f.nin());
135 
136  Field_F vt(f.nvol(), f.nex());
137 
138  mult_GM(vt, m_GM5, (Field_F)f);
139  v = (Field)vt;
140  }
141 
142 
143 //====================================================================
145  const int mu, const int nu)
146  {
147  assert(mu != nu);
148  mult_iGM(v, m_SG[sg_index(mu, nu)], w);
149  }
150 
151 
152 //====================================================================
154  {
155  mult_csw(v, f);
156  }
157 
158 
159 //====================================================================
161  {
162  // multiplies csw kappa sigma_{mu nu} F_{mu nu}
163  // NOTE: this is NOT 1 - csw kappa sigma_{mu nu} F_{mu nu}
164  const int Nc = CommonParameters::Nc();
165  const int Nd = CommonParameters::Nd();
166  const int Nvol = w.nvol();
167 
168  Field_F vt;
169 
170  vt.set(0.0);
171 
172  Field_F wt;
173  mult_iGM(wt, m_SG[sg_index(1, 2)], (Field_F)w);
174  multadd_Field_Gn(vt, 0, m_Bx, 0, wt, 0, 1.0);
175 
176  mult_iGM(wt, m_SG[sg_index(2, 0)], (Field_F)w);
177  multadd_Field_Gn(vt, 0, m_By, 0, wt, 0, 1.0);
178 
179  mult_iGM(wt, m_SG[sg_index(0, 1)], (Field_F)w);
180  multadd_Field_Gn(vt, 0, m_Bz, 0, wt, 0, 1.0);
181 
182  mult_iGM(wt, m_SG[sg_index(3, 0)], (Field_F)w);
183  multadd_Field_Gn(vt, 0, m_Ex, 0, wt, 0, 1.0);
184 
185  mult_iGM(wt, m_SG[sg_index(3, 1)], (Field_F)w);
186  multadd_Field_Gn(vt, 0, m_Ey, 0, wt, 0, 1.0);
187 
188  mult_iGM(wt, m_SG[sg_index(3, 2)], (Field_F)w);
189  multadd_Field_Gn(vt, 0, m_Ez, 0, wt, 0, 1.0);
190 
191  scal(vt, m_kappa * m_cSW);
192 
193  v = (Field)vt;
194  }
195 
196 
197 //====================================================================
199  {
200  set_fieldstrength(m_Bx, 1, 2);
201  set_fieldstrength(m_By, 2, 0);
202  set_fieldstrength(m_Bz, 0, 1);
203  set_fieldstrength(m_Ex, 3, 0);
204  set_fieldstrength(m_Ey, 3, 1);
205  set_fieldstrength(m_Ez, 3, 2);
206  }
207 
208 
209 //====================================================================
211  const int mu, const int nu)
212  {
213  const int Nvol = CommonParameters::Nvol();
214 
215  Staple_lex staple;
216 
217  Field_G Cup;
218 
219  staple.upper(Cup, *m_U, mu, nu);
220 
221  Field_G Cdn;
222  staple.lower(Cdn, *m_U, mu, nu);
223 
224  Field_G Umu;
225  Umu.setpart_ex(0, *m_U, mu);
226 
227  mult_Field_Gnd(Fst, 0, Umu, 0, Cup, 0);
228  multadd_Field_Gnd(Fst, 0, Umu, 0, Cdn, 0, -1.0);
229 
230  Field_G v;
231  mult_Field_Gdn(v, 0, Cup, 0, Umu, 0);
232  multadd_Field_Gdn(v, 0, Cdn, 0, Umu, 0, -1.0);
233 
234  Field_G v2;
235  m_shift.forward(v2, v, mu);
236 
237  axpy(Fst, 1, v2);
238 
239  ah_Field_G(Fst, 0);
240  scal(Fst, 0.25);
241  }
242 
243 
244 //====================================================================
246  {
247  // Counting of floating point operations in giga unit.
248  // The following counting explicitly depends on the implementation
249  // and to be recalculated when the code is modified.
250  // Present counting is based on rev.1131. [10 Sep 2014 H.Matsufuru]
251 
252  const int Nvol = CommonParameters::Nvol();
253  const int NPE = CommonParameters::NPE();
254 
255  const int flop_site = m_Nc * m_Nd * (2 + 12 + 48 * m_Nc);
256 
257  const double gflop = flop_site * (Nvol * (NPE / 1.0e+9));
258 
259  return gflop;
260  }
261 
262 
263 //====================================================================
264 }
265 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
BridgeIO vout
Definition: bridgeIO.cpp:503
void ah_Field_G(Field_G &W, const int ex)
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void set_parameters(const Parameters &params)
static const std::string class_name
double flop_count()
this returns the number of floating point operations.
void general(const char *format,...)
Definition: bridgeIO.cpp:197
GammaMatrix get_GM(GMspecies spec)
void mult_csw(Field &, const Field &)
void multadd_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2, const double ff)
void set_config(Field *U)
setting pointer to the gauge configuration.
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
int nvol() const
Definition: field.h:127
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void mult_sigmaF(Field &, const Field &)
void mult_gm5(Field &v, const Field &w)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
Class for parameters.
Definition: parameters.h:46
void multadd_Field_Gn(Field_F &y, const int ex, const Field_G &u, int ex1, const Field_F &x, int ex2, const double a)
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:177
int sg_index(const int mu, const int nu)
Wilson-type fermion field.
Definition: field_F.h:37
int nin() const
Definition: field.h:126
Staple construction.
Definition: staple_lex.h:39
SU(N) gauge field.
Definition: field_G.h:38
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
Bridge::VerboseLevel m_vl
Definition: fopr.h:127
int nex() const
Definition: field.h:128
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:151
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
std::vector< GammaMatrix > m_SG
std::vector< int > m_boundary
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_GM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication
const Field_G * m_U
pointer to gauge configuration.
Field_G m_Ez
field strength.
void set_fieldstrength(Field_G &, const int, const int)
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
string get_string(const string &key) const
Definition: parameters.cpp:221
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void init(const std::string repr)
void multadd_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2, const double ff)
void forward(Field &, const Field &, const int mu)
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)