Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
forceSmear_HYP_SF.cpp
Go to the documentation of this file.
1 
14 #include "forceSmear_HYP_SF.h"
15 
16 
17 #ifdef USE_FACTORY
18 namespace {
19  ForceSmear *create_object(Projection *proj)
20  {
21  return new ForceSmear_HYP_SF(proj);
22  }
23 
24 
25  bool init = ForceSmear::Factory::Register("HYP_SF", create_object);
26 }
27 #endif
28 
29 
30 
31 const std::string ForceSmear_HYP_SF::class_name = "ForceSmear_HYP_SF";
32 
33 //====================================================================
35 {
36  const string str_vlevel = params.get_string("verbose_level");
37 
38  m_vl = vout.set_verbose_level(str_vlevel);
39 
40  //- fetch and check input parameters
41  double alpha1, alpha2, alpha3;
42  std::vector<double> phi, phipr;
43 
44  int err = 0;
45  err += params.fetch_double("alpha1", alpha1);
46  err += params.fetch_double("alpha2", alpha2);
47  err += params.fetch_double("alpha3", alpha3);
48  err += params.fetch_double_vector("phi", phi);
49  err += params.fetch_double_vector("phipr", phipr);
50 
51  if (err) {
52  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
53  exit(EXIT_FAILURE);
54  }
55 
56 
57  set_parameters(alpha1, alpha2, alpha3, &phi[0], &phipr[0]);
58 }
59 
60 
61 //====================================================================
62 void ForceSmear_HYP_SF::set_parameters(double alpha1, double alpha2, double alpha3,
63  double *phi, double *phipr)
64 {
65  //- print input parameters
66  vout.general(m_vl, "%s:\n", class_name.c_str());
67  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
68  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
69  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
70 
71  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
72  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
73  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
74  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
75  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
76  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
77 
78  //- range check
79  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
80  // NB. phi,phipr == 0 is allowed.
81 
82  //- store values
83  m_alpha1 = alpha1;
84  m_alpha2 = alpha2;
85  m_alpha3 = alpha3;
86 
87  for (int i = 0; i < 3; ++i) {
88  m_phi[i] = phi[i];
89  m_phipr[i] = phipr[i];
90  }
91 
92  //- propagate parameters
94 }
95 
96 
97 //====================================================================
99 {
102 
103  m_U.resize(m_Ndim);
104 
105  m_v1.resize(size1());
106  m_v2.resize(size2());
107 
108  m_Sigma3.resize(size2());
109  m_Sigma2.resize(size1b());
110 
111  m_iTheta3.resize(m_Ndim);
112  m_iTheta2.resize(size2());
113  m_iTheta1.resize(size1b());
114 }
115 
116 
117 //====================================================================
118 
119 /*
120 Field ForceSmear_HYP_SF::force_udiv(const Field_G& Sigmap, const Field_G& U)
121 {
122  Field_G Sigma(Sigmap.nvol(), Sigmap.nex());
123 
124  force_udiv(Sigma, Sigmap, U);
125 
126  return Sigma;
127 }
128 */
129 
130 //====================================================================
131 void ForceSmear_HYP_SF::force_udiv(Field_G& Sigma, const Field_G& Sigmap, const Field_G& U)
132 {
133  assert(U.nvol() == m_Nvol);
134  assert(U.nex() == m_Ndim);
135  assert(Sigmap.nvol() == m_Nvol);
136  assert(Sigmap.nex() == m_Ndim);
137 
138  for (int mu = 0; mu < m_Ndim; ++mu) {
139  m_U[mu].setpart_ex(0, U, mu);
140  if (mu != 3) set_wk.set_boundary_wk(m_U[mu]);
141  }
142 
143  // vout.general(m_vl," smearing step-1\n");
144  smear_step1();
145  // vout.general(m_vl," smearing step-2\n");
146  smear_step2();
147 
148  Sigma.set(0.0);
149 
150  // vout.general(m_vl," smeared force step-3\n");
151  force_step3(Sigma, Sigmap);
152 
153  // vout.general(m_vl," smeared force step-2\n");
154  force_step2(Sigma);
155 
156  // vout.general(m_vl," smeared force step-1\n");
157  force_step1(Sigma);
158 
159  // vout.general(m_vl," smeared force finished\n");
160 }
161 
162 
163 //====================================================================
164 
176 void ForceSmear_HYP_SF::force_step3(Field_G& Sigma, const Field_G& Sigmap)
177 {
178  Field_G Sigmap_tmp(m_Nvol, 1), C(m_Nvol, 1), c_tmp(m_Nvol, 1);
179  Field_G Xi(m_Nvol, 1);
180 
181  for (int mu = 0; mu < m_Ndim; ++mu) {
182  C.set(0.0);
183  for (int nu = 0; nu < m_Ndim; ++nu) {
184  if (nu == mu) continue;
185  staple(c_tmp, m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)], mu, nu);
186  C.addpart_ex(0, c_tmp, 0);
187  }
188  scal(C, m_alpha1 / 6.0); // C *= m_alpha1 / 6.0;
189 
190  Sigmap_tmp.setpart_ex(0, Sigmap, mu);
192  m_alpha1, Sigmap_tmp, C, m_U[mu]);
193  Sigma.addpart_ex(mu, Xi, 0);
194  }
195 
196  for (int mu = 0; mu < m_Ndim; ++mu) {
197  for (int nu = 0; nu < m_Ndim; ++nu) {
198  if (nu == mu) continue;
199 
200  force_each(m_Sigma3[idx2(mu, nu)],
201  m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)],
202  m_iTheta3[mu], m_iTheta3[nu], mu, nu);
203 
204  scal(m_Sigma3[idx2(mu, nu)], m_alpha1 / 6.0); // m_Sigma3[idx2(mu, nu)] *= m_alpha1 / 6.0;
205  if (mu != 3) set_wk.set_boundary_zero(m_Sigma3[idx2(mu, nu)]);
206  }
207  }
208 }
209 
210 
211 //====================================================================
212 
224 {
225  Field_G C(m_Nvol, 1), c_tmp(m_Nvol, 1), Xi(m_Nvol, 1);
226 
227  for (int mu = 0; mu < m_Ndim; ++mu) {
228  for (int nu = 0; nu < m_Ndim; ++nu) {
229  if (nu == mu) continue;
230 
231  C.set(0.0);
232 
233  for (int rho = 0; rho < m_Ndim; ++rho) {
234  if ((rho == mu) || (rho == nu)) continue;
235  staple(c_tmp, m_v1[idx1(mu, nu, rho)],
236  m_v1[idx1(rho, nu, mu)], mu, rho);
237  C.addpart_ex(0, c_tmp, 0);
238  }
239  scal(C, m_alpha2 / 4.0); // C *= m_alpha2 / 4.0;
240 
241  m_proj->force_recursive(Xi, m_iTheta2[idx2(mu, nu)],
242  m_alpha2, m_Sigma3[idx2(mu, nu)], C, m_U[mu]);
243  Sigma.addpart_ex(mu, Xi, 0);
244  }
245  }
246 
247  for (int mu = 0; mu < m_Ndim; ++mu) {
248  for (int nu = 0; nu < m_Ndim; ++nu) {
249  if (nu == mu) continue;
250  for (int rho = 0; rho < m_Ndim; ++rho) {
251  if ((rho == mu) || (rho == nu)) continue;
252  force_each(m_Sigma2[idx1b(mu, nu, rho)],
253  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)],
254  m_iTheta2[idx2(mu, nu)], m_iTheta2[idx2(rho, nu)], mu, rho);
255  scal(m_Sigma2[idx1b(mu, nu, rho)], m_alpha2 / 4.0); // m_Sigma2[idx1b(mu, nu, rho)] *= m_alpha2 / 4.0;
256  if (mu != 3) set_wk.set_boundary_zero(m_Sigma2[idx1b(mu, nu, rho)]);
257  }
258  }
259  }
260 }
261 
262 
263 //====================================================================
264 
275 {
276  Field_G Sigma_tmp(m_Nvol, 1), C(m_Nvol, 1), Xi(m_Nvol, 1);
277 
278  for (int mu = 0; mu < m_Ndim; ++mu) {
279  for (int nu = 0; nu < m_Ndim; ++nu) {
280  if (nu == mu) continue;
281  for (int rho = 0; rho < m_Ndim; ++rho) {
282  if ((rho == mu) || (rho == nu)) continue;
283 
284  int sig = 6 - mu - nu - rho;
285  staple(C, m_U[mu], m_U[sig], mu, sig);
286  scal(C, m_alpha3 / 2.0); // C *= m_alpha3 / 2.0;
287 
288  m_proj->force_recursive(Xi, m_iTheta1[idx1b(mu, nu, rho)],
289  m_alpha3, m_Sigma2[idx1b(mu, nu, rho)], C, m_U[mu]);
290  Sigma.addpart_ex(mu, Xi, 0);
291  }
292  }
293  }
294 
295  for (int mu = 0; mu < m_Ndim; ++mu) {
296  for (int nu = 0; nu < m_Ndim; ++nu) {
297  if (nu == mu) continue;
298  for (int rho = 0; rho < m_Ndim; ++rho) {
299  if ((rho == mu) || (rho == nu)) continue;
300  int sig = 6 - mu - nu - rho;
301  force_each(Sigma_tmp, m_U[mu], m_U[sig],
302  m_iTheta1[idx1b(mu, nu, rho)], m_iTheta1[idx1b(sig, nu, rho)],
303  mu, sig);
304  scal(Sigma_tmp, m_alpha3 / 2.0); // Sigma_tmp *= m_alpha3 / 2.0;
305  Sigma.addpart_ex(mu, Sigma_tmp, 0);
306  }
307  }
308  }
309 
311 }
312 
313 
314 //====================================================================
315 
328  const Field_G& V_mu, const Field_G& V_nu,
329  const Field_G& iTheta_mu,
330  const Field_G& iTheta_nu,
331  int mu, int nu)
332 {
333  Field_G vt1(m_Nvol, 1), vt2(m_Nvol, 1), vt3(m_Nvol, 1);
334 
335  Sigma_mu.set(0.0);
336 
337  //- The 1st block
338  m_shift.backward(vt1, V_nu, mu);
339  if (mu == 3) set_wk.set_boundary_wkpr(vt1);
340  m_shift.backward(vt2, V_mu, nu);
341  if (nu == 3) set_wk.set_boundary_wkpr(vt2);
342  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
343  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, iTheta_nu, 0, 1.0);
344 
345  //- The 2nd block
346  mult_Field_Gdn(vt3, 0, iTheta_mu, 0, V_nu, 0);
347  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
348  m_shift.forward(vt3, vt2, nu);
349  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
350 
351  //- The 3rd block
352  mult_Field_Gdn(vt3, 0, V_mu, 0, iTheta_nu, 0);
353  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
354  m_shift.forward(vt3, vt2, nu);
355  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
356 
357  //- The 4th block
358  m_shift.backward(vt1, iTheta_nu, mu);
359  m_shift.backward(vt2, V_mu, nu);
360  if (nu == 3) set_wk.set_boundary_wkpr(vt2);
361  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
362  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
363 
364  //- The 5th block
365  mult_Field_Gdd(vt2, 0, vt1, 0, V_mu, 0);
366  mult_Field_Gnn(vt3, 0, vt2, 0, V_nu, 0);
367  m_shift.forward(vt2, vt3, nu);
368  axpy(Sigma_mu, 1.0, vt2); // Sigma_mu += vt2;
369 
370  //- The 6th block
371  m_shift.backward(vt1, V_nu, mu);
372  if (mu == 3) set_wk.set_boundary_wkpr(vt1);
373  m_shift.backward(vt2, iTheta_mu, nu);
374  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
375  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
376 }
377 
378 
379 //====================================================================
381 {
382  Field_G c1(m_Nvol, 1);
383 
384  for (int mu = 0; mu < m_Ndim; ++mu) {
385  for (int nu = 0; nu < m_Ndim; ++nu) {
386  if (nu == mu) continue;
387  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
388  if (rho == mu) continue;
389  int sig = 6 - mu - nu - rho;
390  staple(c1, m_U[mu], m_U[sig], mu, sig);
391  scal(c1, m_alpha3 / 2.0); // c1 *= m_alpha3 / 2.0;
392  m_proj->project(m_v1[idx1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
393  if (mu != 3) set_wk.set_boundary_wk(m_v1[idx1(mu, nu, rho)]);
394  }
395  }
396  }
397 }
398 
399 
400 //====================================================================
402 {
403  Field_G c2(m_Nvol, 1), u_tmp(m_Nvol, 1);
404 
405  for (int mu = 0; mu < m_Ndim; ++mu) {
406  for (int nu = 0; nu < m_Ndim; ++nu) {
407  if (nu == mu) continue;
408 
409  c2.set(0.0);
410 
411  for (int rho = 0; rho < m_Ndim; ++rho) {
412  if ((rho != mu) && (rho != nu)) {
413  staple(u_tmp, m_v1[idx1(mu, nu, rho)],
414  m_v1[idx1(rho, nu, mu)], mu, rho);
415  c2.addpart_ex(0, u_tmp, 0);
416  }
417  }
418  scal(c2, m_alpha2 / 4.0); // c2 *= m_alpha2 / 4.0;
419  m_proj->project(m_v2[idx2(mu, nu)], m_alpha2, c2, m_U[mu]);
420  if (mu != 3) set_wk.set_boundary_wk(m_v2[idx2(mu, nu)]);
421  }
422  }
423 }
424 
425 
426 //====================================================================
428  const Field_G& u_mu, const Field_G& u_nu,
429  int mu, int nu)
430 {
431  Field_G v1(m_Nvol, 1), v2(m_Nvol, 1);
432 
433  // upper direction
434  m_shift.backward(v1, u_mu, nu);
435  if (nu == 3) set_wk.set_boundary_wkpr(v1);
436  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
437 
438  m_shift.backward(v1, u_nu, mu);
439  if (mu == 3) set_wk.set_boundary_wkpr(v1);
440  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
441 
442  // lower direction
443  m_shift.backward(v2, u_nu, mu);
444  if (mu == 3) set_wk.set_boundary_wkpr(v2);
445  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
446  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
447  m_shift.forward(v1, v2, nu);
448  c.addpart_ex(0, v1, 0);
449 }
450 
451 
452 //====================================================================
453 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
Bridge::VerboseLevel m_vl
Definition: forceSmear.h:56
static const std::string class_name
void set_boundary_zero()
Set the boundary matrix to 0 for SF bc.
Definition: field_G_SF.cpp:80
BridgeIO vout
Definition: bridgeIO.cpp:495
void set_boundary_wkpr(const Mat_SU_N &U)
Set the boundary spatial link at t=Nt-1 for SF bc.
Definition: field_G_SF.cpp:55
void force_udiv(Field_G &Sigma, const Field_G &Sigma_p, const Field_G &U)
int fetch_double_vector(const string &key, vector< double > &value) const
Definition: parameters.cpp:275
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
double m_phi[3]
SF boundary condition at t=0.
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)
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
int nvol() const
Definition: field.h:116
std::vector< Field_G > m_iTheta2
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
std::vector< Field_G > m_Sigma2
Class for parameters.
Definition: parameters.h:46
void force_step2(Field_G &)
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:193
void set_parameters(const Parameters &params)
Base class for force calculation of smeared operators.
Definition: forceSmear.h:34
void set_boundary_spatial_link_zero()
Set the boundary spatial link to 0 for SF bc.
Definition: field_G_SF.cpp:104
SU(N) gauge field.
Definition: field_G.h:38
virtual void force_recursive(Field_G &Xi, Field_G &iTheta, double alpha, const Field_G &Sigmap, const Field_G &C, const Field_G &U)=0
determination of fields for force calculation
void set_parameters(const std::vector< double > &phi, const std::vector< double > &phipr)
Set the parameter by giving vector objects.
Definition: field_G_SF.cpp:247
void mult_Field_Gdd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void set_boundary_wk(const Mat_SU_N &U)
Set the boundary spatial link at t=0 for SF bc.
Definition: field_G_SF.cpp:29
std::vector< Field_G > m_iTheta3
std::vector< Field_G > m_v1
int idx2(int mu, int nu)
void backward(Field &, const Field &, const int mu)
ShiftField_lex m_shift
int nex() const
Definition: field.h:117
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
std::vector< Field_G > m_Sigma3
Recursive calculation of HYP smeared fermion force with SF BC.
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
std::vector< Field_G > m_v2
base class for projection operator into gauge group.
Definition: projection.h:31
void staple(Field_G &, const Field_G &, const Field_G &, int mu, int nu)
void force_each(Field_G &, const Field_G &, const Field_G &, const Field_G &, const Field_G &, int mu, int nu)
std::vector< Field_G > m_U
int idx1b(int mu, int nu, int rho)
void force_step3(Field_G &, const Field_G &)
int idx1(int mu, int nu, int rho)
virtual void project(Field_G &v, double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]
string get_string(const string &key) const
Definition: parameters.cpp:116
double m_phipr[3]
SF boundary condition at t=Nt.
void force_step1(Field_G &)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
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)
std::vector< Field_G > m_iTheta1