Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_CloverTerm.cpp
Go to the documentation of this file.
1 
14 #include "Fopr/fopr_CloverTerm.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(double kappa, double cSW,
49  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  for (int mu = 0; mu < m_Ndim; ++mu) {
69  m_boundary[mu] = bc[mu];
70  }
71  }
72 
73 
74 //====================================================================
76  {
77  m_U = (Field_G *)U;
78  set_csw();
79  }
80 
81 
82 //====================================================================
83  void Fopr_CloverTerm::init(std::string repr)
84  {
89  m_NinF = 2 * m_Nc * m_Nd;
90 
91  m_U = 0;
92 
93  m_repr = repr;
94 
95  m_boundary.resize(m_Ndim);
96  m_SG.resize(m_Ndim * m_Ndim);
97 
98  GammaMatrixSet *gmset = GammaMatrixSet::New(m_repr);
99 
100  m_GM5 = gmset->get_GM(gmset->GAMMA5);
101 
102  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
103  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
104  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
105  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
106  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
107  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
108 
109  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
110  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
111  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
112  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
113  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
114  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
115 
116  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
117  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
118  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
119  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
120  // these 4 gamma matrices are actually not used.
121 
122  delete gmset;
123  }
124 
125 
126 //====================================================================
128  {
129  // nothing to do.
130  }
131 
132 
133 //====================================================================
135  {
136  assert(v.nvol() == f.nvol());
137  assert(v.nex() == f.nex());
138  assert(v.nin() == f.nin());
139 
140  Field_F vt(f.nvol(), f.nex());
141 
142  mult_GM(vt, m_GM5, (Field_F)f);
143  v = (Field)vt;
144  }
145 
146 
147 //====================================================================
149  const int mu, const int nu)
150  {
151  assert(mu != nu);
152  mult_iGM(v, m_SG[sg_index(mu, nu)], w);
153  }
154 
155 
156 //====================================================================
158  {
159  mult_csw(v, f);
160  }
161 
162 
163 //====================================================================
165  {
166  int Nc = CommonParameters::Nc();
167  int Nd = CommonParameters::Nd();
168  int Nvol = w.nvol();
169 
170  Field_F wt(Nvol, 1), vt(Nvol, 1);
171 
172  vt.set(0.0);
173 
174  mult_iGM(wt, m_SG[sg_index(1, 2)], (Field_F)w);
175  multadd_Field_Gn(vt, 0, m_Bx, 0, wt, 0, 1.0);
176 
177  mult_iGM(wt, m_SG[sg_index(2, 0)], (Field_F)w);
178  multadd_Field_Gn(vt, 0, m_By, 0, wt, 0, 1.0);
179 
180  mult_iGM(wt, m_SG[sg_index(0, 1)], (Field_F)w);
181  multadd_Field_Gn(vt, 0, m_Bz, 0, wt, 0, 1.0);
182 
183  mult_iGM(wt, m_SG[sg_index(3, 0)], (Field_F)w);
184  multadd_Field_Gn(vt, 0, m_Ex, 0, wt, 0, 1.0);
185 
186  mult_iGM(wt, m_SG[sg_index(3, 1)], (Field_F)w);
187  multadd_Field_Gn(vt, 0, m_Ey, 0, wt, 0, 1.0);
188 
189  mult_iGM(wt, m_SG[sg_index(3, 2)], (Field_F)w);
190  multadd_Field_Gn(vt, 0, m_Ez, 0, wt, 0, 1.0);
191 
192  scal(vt, m_kappa * m_cSW);
193 
194  v = (Field)vt;
195  }
196 
197 
198 //====================================================================
200  {
201  set_fieldstrength(m_Bx, 1, 2);
202  set_fieldstrength(m_By, 2, 0);
203  set_fieldstrength(m_Bz, 0, 1);
204  set_fieldstrength(m_Ex, 3, 0);
205  set_fieldstrength(m_Ey, 3, 1);
206  set_fieldstrength(m_Ez, 3, 2);
207  }
208 
209 
210 //====================================================================
212  const int mu, const int nu)
213  {
214  int Nvol = CommonParameters::Nvol();
215 
216  Staple_lex staple;
217 
218  Field_G Cup(Nvol, 1), Cdn(Nvol, 1);
219  Field_G Umu(Nvol, 1);
220  Field_G v(Nvol, 1), v2(Nvol, 1);
221 
222  staple.upper(Cup, *m_U, mu, nu);
223  staple.lower(Cdn, *m_U, mu, nu);
224  Umu.setpart_ex(0, *m_U, mu);
225 
226  mult_Field_Gnd(Fst, 0, Umu, 0, Cup, 0);
227  multadd_Field_Gnd(Fst, 0, Umu, 0, Cdn, 0, -1.0);
228 
229  mult_Field_Gdn(v, 0, Cup, 0, Umu, 0);
230  multadd_Field_Gdn(v, 0, Cdn, 0, Umu, 0, -1.0);
231 
232  m_shift.forward(v2, v, mu);
233 
234  axpy(Fst, 1, v2);
235 
236  ah_Field_G(Fst, 0);
237  scal(Fst, 0.25);
238  }
239 
240 
241 //====================================================================
243  {
244  // The following counting explicitly depends on the implementation
245  // and to be recalculated when the code is modified.
246  // Present counting is based on rev.1131. [10 Sep 2014 H.Matsufuru]
247 
248  int Lvol = CommonParameters::Lvol();
249 
250  double flop_site
251  = static_cast<double>(m_Nc * m_Nd * (2 + 12 + 48 * m_Nc));
252  double flop = flop_site * static_cast<double>(Lvol);
253 
254  return flop;
255  }
256 
257 
258 //====================================================================
259 }
260 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
ShiftField_lex m_shift
BridgeIO vout
Definition: bridgeIO.cpp:495
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:164
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:195
GammaMatrix get_GM(GMspecies spec)
int sg_index(int mu, int nu)
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:39
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
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)
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
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
Wilson-type fermion field.
Definition: field_F.h:37
int nin() const
Definition: field.h:115
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
Set of Gamma Matrices: basis class.
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
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.
void init(std::string repr)
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: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
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)