Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_CloverTerm_General.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(double kappa_s, double kappa_t,
51  double cSW_s, double cSW_t,
52  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  for (int mu = 0; mu < m_Ndim; ++mu) {
76  m_boundary[mu] = bc[mu];
77  }
78  }
79 
80 
81 //====================================================================
83  {
84  m_U = (Field_G *)U;
85  set_csw();
86  }
87 
88 
89 //====================================================================
90  void Fopr_CloverTerm_General::init(std::string repr)
91  {
96  m_NinF = 2 * m_Nc * m_Nd;
97 
98  m_U = 0;
99 
100  m_repr = repr;
101 
102  m_boundary.resize(m_Ndim);
103  m_SG.resize(m_Ndim * m_Ndim);
104 
105  unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(m_repr));
106 
107  m_GM5 = gmset->get_GM(gmset->GAMMA5);
108 
109  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
110  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
111  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
112  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
113  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
114  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
115 
116  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
117  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
118  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
119  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
120  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
121  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
122 
123  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
124  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
125  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
126  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
127  // these 4 gamma matrices are actually not used.
128  }
129 
130 
131 //====================================================================
133  {
134  // nothing to do.
135  }
136 
137 
138 //====================================================================
140  {
141  assert(v.nvol() == f.nvol());
142  assert(v.nex() == f.nex());
143  assert(v.nin() == f.nin());
144 
145  Field_F vt(f.nvol(), f.nex());
146 
147  mult_GM(vt, m_GM5, (Field_F)f);
148  v = (Field)vt;
149  }
150 
151 
152 //====================================================================
154  const int mu, const int nu)
155  {
156  assert(mu != nu);
157  mult_iGM(v, m_SG[sg_index(mu, nu)], w);
158  }
159 
160 
161 //====================================================================
163  {
164  mult_csw(v, f);
165  }
166 
167 
168 //====================================================================
170  {
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 wt(Nvol, 1), vt(Nvol, 1);
179 
180  vt.set(0.0);
181 
182  mult_iGM(wt, m_SG[sg_index(1, 2)], (Field_F)w);
183  multadd_Field_Gn(vt, 0, m_Bx, 0, wt, 0, kappa_cSW_s);
184 
185  mult_iGM(wt, m_SG[sg_index(2, 0)], (Field_F)w);
186  multadd_Field_Gn(vt, 0, m_By, 0, wt, 0, kappa_cSW_s);
187 
188  mult_iGM(wt, m_SG[sg_index(0, 1)], (Field_F)w);
189  multadd_Field_Gn(vt, 0, m_Bz, 0, wt, 0, kappa_cSW_s);
190 
191  mult_iGM(wt, m_SG[sg_index(3, 0)], (Field_F)w);
192  multadd_Field_Gn(vt, 0, m_Ex, 0, wt, 0, kappa_cSW_t);
193 
194  mult_iGM(wt, m_SG[sg_index(3, 1)], (Field_F)w);
195  multadd_Field_Gn(vt, 0, m_Ey, 0, wt, 0, kappa_cSW_t);
196 
197  mult_iGM(wt, m_SG[sg_index(3, 2)], (Field_F)w);
198  multadd_Field_Gn(vt, 0, m_Ez, 0, wt, 0, kappa_cSW_t);
199 
200  v = (Field)vt;
201  }
202 
203 
204 //====================================================================
206  {
207  set_fieldstrength(m_Bx, 1, 2);
208  set_fieldstrength(m_By, 2, 0);
209  set_fieldstrength(m_Bz, 0, 1);
210  set_fieldstrength(m_Ex, 3, 0);
211  set_fieldstrength(m_Ey, 3, 1);
212  set_fieldstrength(m_Ez, 3, 2);
213  }
214 
215 
216 //====================================================================
218  const int mu, const int nu)
219  {
220  const int Nvol = CommonParameters::Nvol();
221 
222  Staple_lex staple;
223 
224  Field_G Cup(Nvol, 1), Cdn(Nvol, 1);
225  Field_G Umu(Nvol, 1);
226  Field_G v(Nvol, 1), v2(Nvol, 1);
227 
228  staple.upper(Cup, *m_U, mu, nu);
229  staple.lower(Cdn, *m_U, mu, nu);
230  Umu.setpart_ex(0, *m_U, mu);
231 
232  mult_Field_Gnd(Fst, 0, Umu, 0, Cup, 0);
233  multadd_Field_Gnd(Fst, 0, Umu, 0, Cdn, 0, -1.0);
234 
235  mult_Field_Gdn(v, 0, Cup, 0, Umu, 0);
236  multadd_Field_Gdn(v, 0, Cdn, 0, Umu, 0, -1.0);
237 
238  m_shift.forward(v2, v, mu);
239 
240  axpy(Fst, 1.0, v2); // Fst += v2;
241 
242  ah_Field_G(Fst, 0);
243  scal(Fst, 0.25); // Fst *= 0.25;
244  }
245 
246 
247 //====================================================================
249  {
250  // The following counting explicitly depends on the implementation
251  // and to be recalculated when the code is modified.
252  // Present counting is based on rev.1131. [10 Sep 2014 H.Matsufuru]
253 
254  const int Lvol = CommonParameters::Lvol();
255 
256  double flop_site
257  = static_cast<double>(m_Nc * m_Nd * (2 + 12 + 48 * m_Nc));
258  double flop = flop_site * static_cast<double>(Lvol);
259 
260  return flop;
261  }
262 
263 
264 //====================================================================
265 }
266 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
BridgeIO vout
Definition: bridgeIO.cpp:495
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:164
void general(const char *format,...)
Definition: bridgeIO.cpp:195
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:39
void set_parameters(const Parameters &params)
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
void set_config(Field *U)
setting pointer to the gauge configuration.
int nvol() const
Definition: field.h:116
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)
static int Lvol()
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:180
std::vector< GammaMatrix > m_SG
Wilson-type fermion field.
Definition: field_F.h:37
int nin() const
Definition: field.h:115
void mult_csw(Field &, const Field &)
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:128
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:117
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staple_lex.cpp:156
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
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]
static const std::string class_name
double flop_count()
this returns the number of floating point operations.
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:186
string get_string(const string &key) const
Definition: parameters.cpp:116
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:294
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)