Bridge++  Ver. 1.3.x
fopr_CloverTerm_General.cpp
Go to the documentation of this file.
1 
15 
16 const std::string Fopr_CloverTerm_General::class_name = "Fopr_CloverTerm_General";
17 
18 //====================================================================
19 //- parameter entries
20 namespace {
21  void append_entry(Parameters& param)
22  {
23  param.Register_double("hopping_parameter_spatial", 0.0);
24  param.Register_double("hopping_parameter_temporal", 0.0);
25  param.Register_double("clover_coefficient_spatial", 0.0);
26  param.Register_double("clover_coefficient_temporal", 0.0);
27  param.Register_int_vector("boundary_condition", std::vector<int>());
28 
29  param.Register_string("verbose_level", "NULL");
30  }
31 
32 
33 #ifdef USE_PARAMETERS_FACTORY
34  bool init_param = ParametersFactory::Register("", append_entry);
35 #endif
36 }
37 //- end
38 
39 //- parameters class
41 //- end
42 
43 //====================================================================
45 {
46  const std::string str_vlevel = params.get_string("verbose_level");
47 
48  m_vl = vout.set_verbose_level(str_vlevel);
49 
50  //- fetch and check input parameters
51  double kappa_s, kappa_t, cSW_s, cSW_t;
52  std::vector<int> bc;
53 
54  int err = 0;
55  err += params.fetch_double("hopping_parameter_spatial", kappa_s);
56  err += params.fetch_double("hopping_parameter_temporal", kappa_t);
57  err += params.fetch_double("clover_coefficient_spatial", cSW_s);
58  err += params.fetch_double("clover_coefficient_temporal", cSW_t);
59  err += params.fetch_int_vector("boundary_condition", bc);
60 
61  if (err) {
62  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
63  exit(EXIT_FAILURE);
64  }
65 
66 
67  set_parameters(kappa_s, kappa_t, cSW_s, cSW_t, bc);
68 }
69 
70 
71 //====================================================================
72 void Fopr_CloverTerm_General::set_parameters(double kappa_s, double kappa_t,
73  double cSW_s, double cSW_t,
74  std::vector<int> bc)
75 {
76  //- print input parameters
77  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
78  vout.general(m_vl, " kappa_s = %12.8f\n", kappa_s);
79  vout.general(m_vl, " kappa_t = %12.8f\n", kappa_t);
80  vout.general(m_vl, " cSW_s = %12.8f\n", cSW_s);
81  vout.general(m_vl, " cSW_t = %12.8f\n", cSW_t);
82  for (int mu = 0; mu < m_Ndim; ++mu) {
83  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
84  }
85 
86  //- range check
87  // NB. kappa,cSW == 0 is allowed.
88  assert(bc.size() == m_Ndim);
89 
90  //- store values
91  m_kappa_s = kappa_s;
92  m_kappa_t = kappa_t;
93  m_cSW_s = cSW_s;
94  m_cSW_t = cSW_t;
95 
96  // m_boundary.resize(m_Ndim); // already resized in init.
97  for (int mu = 0; mu < m_Ndim; ++mu) {
98  m_boundary[mu] = bc[mu];
99  }
100 }
101 
102 
103 //====================================================================
105 {
106  m_U = (Field_G *)U;
107  set_csw();
108 }
109 
110 
111 //====================================================================
112 void Fopr_CloverTerm_General::init(std::string repr)
113 {
115  m_Ndim = CommonParameters::Ndim();
118  m_NinF = 2 * m_Nc * m_Nd;
119 
120  m_U = 0;
121 
122  m_repr = repr;
123 
124  m_boundary.resize(m_Ndim);
125  m_SG.resize(m_Ndim * m_Ndim);
126 
127  unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(m_repr));
128 
129  m_GM5 = gmset->get_GM(gmset->GAMMA5);
130 
131  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
132  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
133  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
134  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
135  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
136  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
137 
138  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
139  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
140  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
141  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
142  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
143  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
144 
145  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
146  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
147  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
148  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
149  // these 4 gamma matrices are actually not used.
150 }
151 
152 
153 //====================================================================
155 {
156  // nothing to do.
157 }
158 
159 
160 //====================================================================
162 {
163  assert(v.nvol() == f.nvol());
164  assert(v.nex() == f.nex());
165  assert(v.nin() == f.nin());
166 
167  Field_F vt(f.nvol(), f.nex());
168 
169  mult_GM(vt, m_GM5, (Field_F)f);
170  v = (Field)vt;
171 }
172 
173 
174 //====================================================================
176  const int mu, const int nu)
177 {
178  assert(mu != nu);
179  mult_iGM(v, m_SG[sg_index(mu, nu)], w);
180 }
181 
182 
183 //====================================================================
185 {
186  mult_csw(v, f);
187 }
188 
189 
190 //====================================================================
192 {
193  const int Nc = CommonParameters::Nc();
194  const int Nd = CommonParameters::Nd();
195  const int Nvol = w.nvol();
196 
197  const double kappa_cSW_s = m_kappa_s * m_cSW_s;
198  const double kappa_cSW_t = m_kappa_t * m_cSW_t;
199 
200  Field_F wt(Nvol, 1), vt(Nvol, 1);
201 
202  vt.set(0.0);
203 
204  mult_iGM(wt, m_SG[sg_index(1, 2)], (Field_F)w);
205  multadd_Field_Gn(vt, 0, m_Bx, 0, wt, 0, kappa_cSW_s);
206 
207  mult_iGM(wt, m_SG[sg_index(2, 0)], (Field_F)w);
208  multadd_Field_Gn(vt, 0, m_By, 0, wt, 0, kappa_cSW_s);
209 
210  mult_iGM(wt, m_SG[sg_index(0, 1)], (Field_F)w);
211  multadd_Field_Gn(vt, 0, m_Bz, 0, wt, 0, kappa_cSW_s);
212 
213  mult_iGM(wt, m_SG[sg_index(3, 0)], (Field_F)w);
214  multadd_Field_Gn(vt, 0, m_Ex, 0, wt, 0, kappa_cSW_t);
215 
216  mult_iGM(wt, m_SG[sg_index(3, 1)], (Field_F)w);
217  multadd_Field_Gn(vt, 0, m_Ey, 0, wt, 0, kappa_cSW_t);
218 
219  mult_iGM(wt, m_SG[sg_index(3, 2)], (Field_F)w);
220  multadd_Field_Gn(vt, 0, m_Ez, 0, wt, 0, kappa_cSW_t);
221 
222  v = (Field)vt;
223 }
224 
225 
226 //====================================================================
228 {
229  set_fieldstrength(m_Bx, 1, 2);
230  set_fieldstrength(m_By, 2, 0);
231  set_fieldstrength(m_Bz, 0, 1);
232  set_fieldstrength(m_Ex, 3, 0);
233  set_fieldstrength(m_Ey, 3, 1);
234  set_fieldstrength(m_Ez, 3, 2);
235 }
236 
237 
238 //====================================================================
240  const int mu, const int nu)
241 {
242  const int Nvol = CommonParameters::Nvol();
243 
244  Staples staple;
245 
246  Field_G Cup(Nvol, 1), Cdn(Nvol, 1);
247  Field_G Umu(Nvol, 1);
248  Field_G v(Nvol, 1), v2(Nvol, 1);
249 
250  staple.upper(Cup, *m_U, mu, nu);
251  staple.lower(Cdn, *m_U, mu, nu);
252  Umu.setpart_ex(0, *m_U, mu);
253 
254  mult_Field_Gnd(Fst, 0, Umu, 0, Cup, 0);
255  multadd_Field_Gnd(Fst, 0, Umu, 0, Cdn, 0, -1.0);
256 
257  mult_Field_Gdn(v, 0, Cup, 0, Umu, 0);
258  multadd_Field_Gdn(v, 0, Cdn, 0, Umu, 0, -1.0);
259 
260  m_shift.forward(v2, v, mu);
261 
262  axpy(Fst, 1.0, v2); // Fst += v2;
263 
264  ah_Field_G(Fst, 0);
265  scal(Fst, 0.25); // Fst *= 0.25;
266 }
267 
268 
269 //====================================================================
271 {
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 Lvol = CommonParameters::Lvol();
277 
278  double flop_site
279  = static_cast<double>(m_Nc * m_Nd * (2 + 12 + 48 * m_Nc));
280  double flop = flop_site * static_cast<double>(Lvol);
281 
282  return flop;
283 }
284 
285 
286 //====================================================================
287 //============================================================END=====
void Register_int_vector(const string &, const std::vector< int > &)
Definition: parameters.cpp:344
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
double flop_count()
this returns the number of floating point operations.
BridgeIO vout
Definition: bridgeIO.cpp:278
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
Staple construction.
Definition: staples.h:40
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 general(const char *format,...)
Definition: bridgeIO.cpp:65
Container of Field-type object.
Definition: field.h:39
int nvol() const
Definition: field.h:116
Class for parameters.
Definition: parameters.h:38
static int Lvol()
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)
Wilson-type fermion field.
Definition: field_F.h:37
int nin() const
Definition: field.h:115
void ah_Field_G(Field_G &w, const int ex)
std::vector< GammaMatrix > m_SG
SU(N) gauge field.
Definition: field_G.h:38
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 mult_Field_Gnd(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
void mult_gm5(Field &v, const Field &w)
Bridge::VerboseLevel m_vl
Definition: fopr.h:113
void set_config(Field *U)
setting pointer to the gauge configuration.
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void mult_csw(Field &, const Field &)
int nex() const
Definition: field.h:117
void set_parameters(const Parameters &params)
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 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:48
const Field_G * m_U
pointer to gauge configuration.
void mult_sigmaF(Field &, const Field &)
void mult_GM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication
void lower(Field_G &, const Field_G &, const int mu, const int nu)
constructs lower staple in mu-nu plane.
Definition: staples.cpp:152
static bool Register(const std::string &realm, const creator_callback &cb)
Field_G m_Ez
field strength.
void Register_double(const string &, const double)
Definition: parameters.cpp:323
static const std::string class_name
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:87
void upper(Field_G &, const Field_G &, const int mu, const int nu)
constructs upper staple in mu-nu plane.
Definition: staples.cpp:128
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:28
int fetch_int_vector(const string &key, std::vector< int > &val) const
Definition: parameters.cpp:176
void forward(Field &, const Field &, const int mu)