Bridge++  Ver. 2.0.2
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  std::string vlevel;
25  if (!params.fetch_string("verbose_level", vlevel)) {
26  m_vl = vout.set_verbose_level(vlevel);
27  }
28 
29  //- fetch and check input parameters
30  double kappa_s, kappa_t, cSW_s, cSW_t;
31  std::vector<int> bc;
32 
33  int err = 0;
34  err += params.fetch_double("hopping_parameter_spatial", kappa_s);
35  err += params.fetch_double("hopping_parameter_temporal", kappa_t);
36  err += params.fetch_double("clover_coefficient_spatial", cSW_s);
37  err += params.fetch_double("clover_coefficient_temporal", cSW_t);
38  err += params.fetch_int_vector("boundary_condition", bc);
39 
40  if (err) {
41  vout.crucial(m_vl, "Error at %s: input parameter not found\n", class_name.c_str());
42  exit(EXIT_FAILURE);
43  }
44 
45 
46  set_parameters(kappa_s, kappa_t, cSW_s, cSW_t, bc);
47  }
48 
49 
50 //====================================================================
52  {
53  params.set_double("hopping_parameter_spatial", m_kappa_s);
54  params.set_double("hopping_parameter_temporal", m_kappa_t);
55  params.set_double("clover_coefficient_spatial", m_cSW_s);
56  params.set_double("clover_coefficient_temporal", m_cSW_t);
57  params.set_int_vector("boundary_condition", m_boundary);
58 
59  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
60  }
61 
62 
63 //====================================================================
64  void Fopr_CloverTerm_General::set_parameters(const double kappa_s, const double kappa_t,
65  const double cSW_s, const double cSW_t,
66  const std::vector<int> bc)
67  {
68  //- print input parameters
69  vout.general(m_vl, "%s:\n", class_name.c_str());
70  vout.general(m_vl, " kappa_s = %12.8f\n", kappa_s);
71  vout.general(m_vl, " kappa_t = %12.8f\n", kappa_t);
72  vout.general(m_vl, " cSW_s = %12.8f\n", cSW_s);
73  vout.general(m_vl, " cSW_t = %12.8f\n", cSW_t);
74  for (int mu = 0; mu < m_Ndim; ++mu) {
75  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
76  }
77 
78  //- range check
79  // NB. kappa,cSW == 0 is allowed.
80  assert(bc.size() == m_Ndim);
81 
82  //- store values
83  m_kappa_s = kappa_s;
84  m_kappa_t = kappa_t;
85  m_cSW_s = cSW_s;
86  m_cSW_t = cSW_t;
87 
88  // m_boundary.resize(m_Ndim); // already resized in init.
89  m_boundary = bc;
90  }
91 
92 
93 //====================================================================
95  {
96  m_U = (Field_G *)U;
97  set_csw();
98  }
99 
100 
101 //====================================================================
102  void Fopr_CloverTerm_General::init(const std::string repr)
103  {
108  m_NinF = 2 * m_Nc * m_Nd;
109 
110  m_U = 0;
111 
112  m_repr = repr;
113 
114  m_boundary.resize(m_Ndim);
115  m_SG.resize(m_Ndim * m_Ndim);
116 
117  GammaMatrixSet *gmset = GammaMatrixSet::New(m_repr);
118 
119  m_GM5 = gmset->get_GM(gmset->GAMMA5);
120 
121  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
122  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
123  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
124  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
125  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
126  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
127 
128  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
129  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
130  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
131  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
132  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
133  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
134 
135  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
136  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
137  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
138  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
139  // these 4 gamma matrices are actually not used.
140 
141  delete gmset;
142  }
143 
144 
145 //====================================================================
147  {
148  // nothing to do.
149  }
150 
151 
152 //====================================================================
154  {
155  assert(v.nvol() == f.nvol());
156  assert(v.nex() == f.nex());
157  assert(v.nin() == f.nin());
158 
159  Field_F vt(f.nvol(), f.nex());
160 
161  mult_GM(vt, m_GM5, (Field_F)f);
162  v = (Field)vt;
163  }
164 
165 
166 //====================================================================
168  const int mu, const int nu)
169  {
170  assert(mu != nu);
171  mult_iGM(v, m_SG[sg_index(mu, nu)], w);
172  }
173 
174 
175 //====================================================================
177  {
178  mult_csw(v, f);
179  }
180 
181 
182 //====================================================================
184  {
185  // multiplies csw kappa sigma_{mu nu} F_{mu nu}
186  // NOTE: this is NOT 1 - csw kappa sigma_{mu nu} F_{mu nu}
187  const int Nc = CommonParameters::Nc();
188  const int Nd = CommonParameters::Nd();
189  const int Nvol = w.nvol();
190 
191  const double kappa_cSW_s = m_kappa_s * m_cSW_s;
192  const double kappa_cSW_t = m_kappa_t * m_cSW_t;
193 
194  Field_F vt;
195 
196  vt.set(0.0);
197 
198  Field_F wt;
199  mult_iGM(wt, m_SG[sg_index(1, 2)], (Field_F)w);
200  multadd_Field_Gn(vt, 0, m_Bx, 0, wt, 0, kappa_cSW_s);
201 
202  mult_iGM(wt, m_SG[sg_index(2, 0)], (Field_F)w);
203  multadd_Field_Gn(vt, 0, m_By, 0, wt, 0, kappa_cSW_s);
204 
205  mult_iGM(wt, m_SG[sg_index(0, 1)], (Field_F)w);
206  multadd_Field_Gn(vt, 0, m_Bz, 0, wt, 0, kappa_cSW_s);
207 
208  mult_iGM(wt, m_SG[sg_index(3, 0)], (Field_F)w);
209  multadd_Field_Gn(vt, 0, m_Ex, 0, wt, 0, kappa_cSW_t);
210 
211  mult_iGM(wt, m_SG[sg_index(3, 1)], (Field_F)w);
212  multadd_Field_Gn(vt, 0, m_Ey, 0, wt, 0, kappa_cSW_t);
213 
214  mult_iGM(wt, m_SG[sg_index(3, 2)], (Field_F)w);
215  multadd_Field_Gn(vt, 0, m_Ez, 0, wt, 0, kappa_cSW_t);
216 
217  v = (Field)vt;
218  }
219 
220 
221 //====================================================================
223  {
224  set_fieldstrength(m_Bx, 1, 2);
225  set_fieldstrength(m_By, 2, 0);
226  set_fieldstrength(m_Bz, 0, 1);
227  set_fieldstrength(m_Ex, 3, 0);
228  set_fieldstrength(m_Ey, 3, 1);
229  set_fieldstrength(m_Ez, 3, 2);
230  }
231 
232 
233 //====================================================================
235  const int mu, const int nu)
236  {
237  const int Nvol = CommonParameters::Nvol();
238 
239  Staple_lex staple;
240 
241  Field_G Cup;
242 
243  staple.upper(Cup, *m_U, mu, nu);
244 
245  Field_G Cdn;
246  staple.lower(Cdn, *m_U, mu, nu);
247 
248  Field_G Umu;
249  Umu.setpart_ex(0, *m_U, mu);
250 
251  mult_Field_Gnd(Fst, 0, Umu, 0, Cup, 0);
252  multadd_Field_Gnd(Fst, 0, Umu, 0, Cdn, 0, -1.0);
253 
254  Field_G v;
255  mult_Field_Gdn(v, 0, Cup, 0, Umu, 0);
256  multadd_Field_Gdn(v, 0, Cdn, 0, Umu, 0, -1.0);
257 
258  Field_G v2;
259  m_shift.forward(v2, v, mu);
260 
261  axpy(Fst, 1.0, v2); // Fst += v2;
262 
263  ah_Field_G(Fst, 0);
264  scal(Fst, 0.25); // Fst *= 0.25;
265  }
266 
267 
268 //====================================================================
270  {
271  // Counting of floating point operations in giga unit.
272  // The following counting explicitly depends on the implementation
273  // and to be recalculated when the code is modified.
274  // Present counting is based on rev.1131. [10 Sep 2014 H.Matsufuru]
275 
276  const int Nvol = CommonParameters::Nvol();
277  const int NPE = CommonParameters::NPE();
278 
279  const int flop_site = m_Nc * m_Nd * (2 + 12 + 48 * m_Nc);
280 
281  double gflop = flop_site * (Nvol * (NPE / 1.0e+9));
282 
283  return gflop;
284  }
285 
286 
287 //====================================================================
288 }
289 //============================================================END=====
GammaMatrixSet
Set of Gamma Matrices: basis class.
Definition: gammaMatrixSet.h:37
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
Org::Fopr_CloverTerm_General::m_Nc
int m_Nc
Definition: fopr_CloverTerm_General_impl.h:60
GammaMatrixSet::GAMMA5
@ GAMMA5
Definition: gammaMatrixSet.h:48
mult_Field_Gdn
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:134
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
Org::Fopr_CloverTerm_General::m_U
const Field_G * m_U
pointer to gauge configuration.
Definition: fopr_CloverTerm_General_impl.h:63
ShiftField_lex::forward
void forward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:79
Org::Fopr_CloverTerm_General::mult_isigma
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
Definition: fopr_CloverTerm_General_impl.cpp:167
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
mult_GM
void mult_GM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication
Definition: field_F_imp.cpp:198
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
GammaMatrixSet::UNITY
@ UNITY
Definition: gammaMatrixSet.h:48
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Org::Fopr_CloverTerm_General::m_Bz
Field_G m_Bz
Definition: fopr_CloverTerm_General_impl.h:68
Field::nex
int nex() const
Definition: field.h:128
Org::Fopr_CloverTerm_General::mult_csw
void mult_csw(Field &, const Field &)
Definition: fopr_CloverTerm_General_impl.cpp:183
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
fopr_CloverTerm_General_impl.h
Org::Fopr_CloverTerm_General::mult_gm5
void mult_gm5(Field &v, const Field &w)
multiplies gamma_5 matrix.
Definition: fopr_CloverTerm_General_impl.cpp:153
Staple_lex::lower
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staple_lex.cpp:286
Org::Fopr_CloverTerm_General::tidyup
void tidyup()
Definition: fopr_CloverTerm_General_impl.cpp:146
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
Org::Fopr_CloverTerm_General::m_repr
std::string m_repr
Definition: fopr_CloverTerm_General_impl.h:55
Field::nin
int nin() const
Definition: field.h:126
Org::Fopr_CloverTerm_General::m_cSW_t
double m_cSW_t
Definition: fopr_CloverTerm_General_impl.h:53
Org::Fopr_CloverTerm_General::m_GM5
GammaMatrix m_GM5
Definition: fopr_CloverTerm_General_impl.h:73
multadd_Field_Gn
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)
Definition: field_F_imp.cpp:116
Org::Fopr_CloverTerm_General::m_cSW_s
double m_cSW_s
Definition: fopr_CloverTerm_General_impl.h:53
GammaMatrixSet::SIGMA41
@ SIGMA41
Definition: gammaMatrixSet.h:52
Org::Fopr_CloverTerm_General::m_Ex
Field_G m_Ex
Definition: fopr_CloverTerm_General_impl.h:68
Org::Fopr_CloverTerm_General::class_name
static const std::string class_name
Definition: fopr_CloverTerm_General_impl.h:47
Org::Fopr_CloverTerm_General::get_parameters
void get_parameters(Parameters &params) const
gets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_CloverTerm_General_impl.cpp:51
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
Org::Fopr_CloverTerm_General::m_vl
Bridge::VerboseLevel m_vl
Definition: fopr_CloverTerm_General_impl.h:50
ah_Field_G
void ah_Field_G(Field_G &W, const int ex)
Definition: field_G_imp.cpp:462
mult_iGM
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
Definition: field_F_imp.cpp:250
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Org::Fopr_CloverTerm_General::m_Nd
int m_Nd
Definition: fopr_CloverTerm_General_impl.h:60
Org::Fopr_CloverTerm_General::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_CloverTerm_General_impl.cpp:22
Org::Fopr_CloverTerm_General::m_By
Field_G m_By
Definition: fopr_CloverTerm_General_impl.h:68
Field::nvol
int nvol() const
Definition: field.h:127
Org
Clover term operator.
Definition: fopr_CloverTerm_eo_impl.cpp:23
CommonParameters::NPE
static int NPE()
Definition: commonParameters.h:101
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
Org::Fopr_CloverTerm_General::m_Ey
Field_G m_Ey
Definition: fopr_CloverTerm_General_impl.h:68
GammaMatrixSet::SIGMA42
@ SIGMA42
Definition: gammaMatrixSet.h:52
Org::Fopr_CloverTerm_General::m_SG
std::vector< GammaMatrix > m_SG
Definition: fopr_CloverTerm_General_impl.h:72
multadd_Field_Gnd
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)
Definition: field_G_imp.cpp:335
Org::Fopr_CloverTerm_General::set_csw
void set_csw()
Definition: fopr_CloverTerm_General_impl.cpp:222
Org::Fopr_CloverTerm_General::m_Ndim
int m_Ndim
Definition: fopr_CloverTerm_General_impl.h:60
Staple_lex::upper
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:263
CommonParameters::Nd
static int Nd()
Definition: commonParameters.h:116
Org::Fopr_CloverTerm_General::set_config
void set_config(Field *U)
sets the gauge configuration.
Definition: fopr_CloverTerm_General_impl.cpp:94
Staple_lex
Staple construction.
Definition: staple_lex.h:39
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
Org::Fopr_CloverTerm_General::m_shift
ShiftField_lex m_shift
Definition: fopr_CloverTerm_General_impl.h:65
Org::Fopr_CloverTerm_General::flop_count
double flop_count()
this returns the number of floating point operations.
Definition: fopr_CloverTerm_General_impl.cpp:269
Org::Fopr_CloverTerm_General::m_NinF
int m_NinF
Definition: fopr_CloverTerm_General_impl.h:60
GammaMatrixSet::SIGMA23
@ SIGMA23
Definition: gammaMatrixSet.h:51
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Field_F
Wilson-type fermion field.
Definition: field_F.h:37
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
GammaMatrixSet::SIGMA12
@ SIGMA12
Definition: gammaMatrixSet.h:51
Org::Fopr_CloverTerm_General::m_kappa_s
double m_kappa_s
Definition: fopr_CloverTerm_General_impl.h:52
GammaMatrixSet::get_GM
GammaMatrix get_GM(GMspecies spec)
Definition: gammaMatrixSet.h:76
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
Org::Fopr_CloverTerm_General::m_boundary
std::vector< int > m_boundary
Definition: fopr_CloverTerm_General_impl.h:54
Org::Fopr_CloverTerm_General::m_Ez
Field_G m_Ez
field strength.
Definition: fopr_CloverTerm_General_impl.h:68
Org::Fopr_CloverTerm_General::set_fieldstrength
void set_fieldstrength(Field_G &, const int, const int)
Definition: fopr_CloverTerm_General_impl.cpp:234
Field
Container of Field-type object.
Definition: field.h:46
GammaMatrixSet::SIGMA31
@ SIGMA31
Definition: gammaMatrixSet.h:51
GammaMatrixSet::SIGMA43
@ SIGMA43
Definition: gammaMatrixSet.h:52
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Org::Fopr_CloverTerm_General::m_Nvol
int m_Nvol
Definition: fopr_CloverTerm_General_impl.h:61
Org::Fopr_CloverTerm_General::m_Bx
Field_G m_Bx
Definition: fopr_CloverTerm_General_impl.h:68
Org::Fopr_CloverTerm_General::mult_sigmaF
void mult_sigmaF(Field &, const Field &)
Definition: fopr_CloverTerm_General_impl.cpp:176
Org::Fopr_CloverTerm_General::init
void init(std::string repr)
Definition: fopr_CloverTerm_General_impl.cpp:102
Org::Fopr_CloverTerm_General::m_kappa_t
double m_kappa_t
Definition: fopr_CloverTerm_General_impl.h:52
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
multadd_Field_Gdn
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)
Definition: field_G_imp.cpp:293
mult_Field_Gnd
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:173
Org::Fopr_CloverTerm_General::sg_index
int sg_index(const int mu, const int nu)
Definition: fopr_CloverTerm_General_impl.h:173
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