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