Bridge++  Ver. 1.3.x
forceSmear_HYP_SF.cpp
Go to the documentation of this file.
1 
14 #include "forceSmear_HYP_SF.h"
15 
16 #ifdef USE_PARAMETERS_FACTORY
17 #include "parameters_factory.h"
18 #endif
19 
20 #ifdef USE_FACTORY
21 namespace {
22  ForceSmear *create_object(Projection *proj)
23  {
24  return new ForceSmear_HYP_SF(proj);
25  }
26 
27 
28  bool init = ForceSmear::Factory::Register("HYP_SF", create_object);
29 }
30 #endif
31 
32 //- parameter entries
33 namespace {
34  void append_entry(Parameters& param)
35  {
36  param.Register_double("alpha1", 0.0);
37  param.Register_double("alpha2", 0.0);
38  param.Register_double("alpha3", 0.0);
39 
40  param.Register_double_vector("phi", std::vector<double>());
41  param.Register_double_vector("phipr", std::vector<double>());
42 
43  param.Register_string("verbose_level", "NULL");
44  }
45 
46 
47 #ifdef USE_PARAMETERS_FACTORY
48  bool init_param = ParametersFactory::Register("ForceSmear.HYP_SF", append_entry);
49 #endif
50 }
51 //- end
52 
53 //- parameters class
55 //- end
56 
57 const std::string ForceSmear_HYP_SF::class_name = "ForceSmear_HYP_SF";
58 
59 //====================================================================
61 {
62  const string str_vlevel = params.get_string("verbose_level");
63 
64  m_vl = vout.set_verbose_level(str_vlevel);
65 
66  //- fetch and check input parameters
67  double alpha1, alpha2, alpha3;
68  std::vector<double> phi, phipr;
69 
70  int err = 0;
71  err += params.fetch_double("alpha1", alpha1);
72  err += params.fetch_double("alpha2", alpha2);
73  err += params.fetch_double("alpha3", alpha3);
74  err += params.fetch_double_vector("phi", phi);
75  err += params.fetch_double_vector("phipr", phipr);
76 
77  if (err) {
78  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
79  exit(EXIT_FAILURE);
80  }
81 
82 
83  set_parameters(alpha1, alpha2, alpha3, &phi[0], &phipr[0]);
84 }
85 
86 
87 //====================================================================
88 void ForceSmear_HYP_SF::set_parameters(double alpha1, double alpha2, double alpha3,
89  double *phi, double *phipr)
90 {
91  //- print input parameters
92  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
93  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
94  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
95  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
96 
97  vout.general(m_vl, " phi1 = %12.6f\n", phi[0]);
98  vout.general(m_vl, " phi2 = %12.6f\n", phi[1]);
99  vout.general(m_vl, " phi3 = %12.6f\n", phi[2]);
100  vout.general(m_vl, " phipr1= %12.6f\n", phipr[0]);
101  vout.general(m_vl, " phipr2= %12.6f\n", phipr[1]);
102  vout.general(m_vl, " phipr3= %12.6f\n", phipr[2]);
103 
104  //- range check
105  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
106  // NB. phi,phipr == 0 is allowed.
107 
108  //- store values
109  m_alpha1 = alpha1;
110  m_alpha2 = alpha2;
111  m_alpha3 = alpha3;
112 
113  for (int i = 0; i < 3; ++i) {
114  m_phi[i] = phi[i];
115  m_phipr[i] = phipr[i];
116  }
117 
118  //- propagate parameters
120 }
121 
122 
123 //====================================================================
125 {
128 
129  m_U.resize(m_Ndim);
130 
131  m_v1.resize(size1());
132  m_v2.resize(size2());
133 
134  m_Sigma3.resize(size2());
135  m_Sigma2.resize(size1b());
136 
137  m_iTheta3.resize(m_Ndim);
138  m_iTheta2.resize(size2());
139  m_iTheta1.resize(size1b());
140 }
141 
142 
143 //====================================================================
144 
145 /*
146 Field ForceSmear_HYP_SF::force_udiv(const Field_G& Sigmap, const Field_G& U)
147 {
148  Field_G Sigma(Sigmap.nvol(), Sigmap.nex());
149 
150  force_udiv(Sigma, Sigmap, U);
151 
152  return Sigma;
153 }
154 */
155 
156 //====================================================================
157 void ForceSmear_HYP_SF::force_udiv(Field_G& Sigma, const Field_G& Sigmap, const Field_G& U)
158 {
159  assert(U.nvol() == m_Nvol);
160  assert(U.nex() == m_Ndim);
161  assert(Sigmap.nvol() == m_Nvol);
162  assert(Sigmap.nex() == m_Ndim);
163 
164  for (int mu = 0; mu < m_Ndim; ++mu) {
165  m_U[mu].setpart_ex(0, U, mu);
166  if (mu != 3) set_wk.set_boundary_wk(m_U[mu]);
167  }
168 
169  // vout.general(m_vl," smearing step-1\n");
170  smear_step1();
171  // vout.general(m_vl," smearing step-2\n");
172  smear_step2();
173 
174  Sigma.set(0.0);
175 
176  // vout.general(m_vl," smeared force step-3\n");
177  force_step3(Sigma, Sigmap);
178 
179  // vout.general(m_vl," smeared force step-2\n");
180  force_step2(Sigma);
181 
182  // vout.general(m_vl," smeared force step-1\n");
183  force_step1(Sigma);
184 
185  // vout.general(m_vl," smeared force finished\n");
186 }
187 
188 
189 //====================================================================
190 
202 void ForceSmear_HYP_SF::force_step3(Field_G& Sigma, const Field_G& Sigmap)
203 {
204  Field_G Sigmap_tmp(m_Nvol, 1), C(m_Nvol, 1), c_tmp(m_Nvol, 1);
205  Field_G Xi(m_Nvol, 1);
206 
207  for (int mu = 0; mu < m_Ndim; ++mu) {
208  C.set(0.0);
209  for (int nu = 0; nu < m_Ndim; ++nu) {
210  if (nu == mu) continue;
211  staple(c_tmp, m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)], mu, nu);
212  C.addpart_ex(0, c_tmp, 0);
213  }
214  scal(C, m_alpha1 / 6.0); // C *= m_alpha1 / 6.0;
215 
216  Sigmap_tmp.setpart_ex(0, Sigmap, mu);
218  m_alpha1, Sigmap_tmp, C, m_U[mu]);
219  Sigma.addpart_ex(mu, Xi, 0);
220  }
221 
222  for (int mu = 0; mu < m_Ndim; ++mu) {
223  for (int nu = 0; nu < m_Ndim; ++nu) {
224  if (nu == mu) continue;
225 
226  force_each(m_Sigma3[idx2(mu, nu)],
227  m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)],
228  m_iTheta3[mu], m_iTheta3[nu], mu, nu);
229 
230  scal(m_Sigma3[idx2(mu, nu)], m_alpha1 / 6.0); // m_Sigma3[idx2(mu, nu)] *= m_alpha1 / 6.0;
231  if (mu != 3) set_wk.set_boundary_zero(m_Sigma3[idx2(mu, nu)]);
232  }
233  }
234 }
235 
236 
237 //====================================================================
238 
250 {
251  Field_G C(m_Nvol, 1), c_tmp(m_Nvol, 1), Xi(m_Nvol, 1);
252 
253  for (int mu = 0; mu < m_Ndim; ++mu) {
254  for (int nu = 0; nu < m_Ndim; ++nu) {
255  if (nu == mu) continue;
256 
257  C.set(0.0);
258 
259  for (int rho = 0; rho < m_Ndim; ++rho) {
260  if ((rho == mu) || (rho == nu)) continue;
261  staple(c_tmp, m_v1[idx1(mu, nu, rho)],
262  m_v1[idx1(rho, nu, mu)], mu, rho);
263  C.addpart_ex(0, c_tmp, 0);
264  }
265  scal(C, m_alpha2 / 4.0); // C *= m_alpha2 / 4.0;
266 
267  m_proj->force_recursive(Xi, m_iTheta2[idx2(mu, nu)],
268  m_alpha2, m_Sigma3[idx2(mu, nu)], C, m_U[mu]);
269  Sigma.addpart_ex(mu, Xi, 0);
270  }
271  }
272 
273  for (int mu = 0; mu < m_Ndim; ++mu) {
274  for (int nu = 0; nu < m_Ndim; ++nu) {
275  if (nu == mu) continue;
276  for (int rho = 0; rho < m_Ndim; ++rho) {
277  if ((rho == mu) || (rho == nu)) continue;
278  force_each(m_Sigma2[idx1b(mu, nu, rho)],
279  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)],
280  m_iTheta2[idx2(mu, nu)], m_iTheta2[idx2(rho, nu)], mu, rho);
281  scal(m_Sigma2[idx1b(mu, nu, rho)], m_alpha2 / 4.0); // m_Sigma2[idx1b(mu, nu, rho)] *= m_alpha2 / 4.0;
282  if (mu != 3) set_wk.set_boundary_zero(m_Sigma2[idx1b(mu, nu, rho)]);
283  }
284  }
285  }
286 }
287 
288 
289 //====================================================================
290 
301 {
302  Field_G Sigma_tmp(m_Nvol, 1), C(m_Nvol, 1), Xi(m_Nvol, 1);
303 
304  for (int mu = 0; mu < m_Ndim; ++mu) {
305  for (int nu = 0; nu < m_Ndim; ++nu) {
306  if (nu == mu) continue;
307  for (int rho = 0; rho < m_Ndim; ++rho) {
308  if ((rho == mu) || (rho == nu)) continue;
309 
310  int sig = 6 - mu - nu - rho;
311  staple(C, m_U[mu], m_U[sig], mu, sig);
312  scal(C, m_alpha3 / 2.0); // C *= m_alpha3 / 2.0;
313 
314  m_proj->force_recursive(Xi, m_iTheta1[idx1b(mu, nu, rho)],
315  m_alpha3, m_Sigma2[idx1b(mu, nu, rho)], C, m_U[mu]);
316  Sigma.addpart_ex(mu, Xi, 0);
317  }
318  }
319  }
320 
321  for (int mu = 0; mu < m_Ndim; ++mu) {
322  for (int nu = 0; nu < m_Ndim; ++nu) {
323  if (nu == mu) continue;
324  for (int rho = 0; rho < m_Ndim; ++rho) {
325  if ((rho == mu) || (rho == nu)) continue;
326  int sig = 6 - mu - nu - rho;
327  force_each(Sigma_tmp, m_U[mu], m_U[sig],
328  m_iTheta1[idx1b(mu, nu, rho)], m_iTheta1[idx1b(sig, nu, rho)],
329  mu, sig);
330  scal(Sigma_tmp, m_alpha3 / 2.0); // Sigma_tmp *= m_alpha3 / 2.0;
331  Sigma.addpart_ex(mu, Sigma_tmp, 0);
332  }
333  }
334  }
335 
337 }
338 
339 
340 //====================================================================
341 
354  const Field_G& V_mu, const Field_G& V_nu,
355  const Field_G& iTheta_mu,
356  const Field_G& iTheta_nu,
357  int mu, int nu)
358 {
359  Field_G vt1(m_Nvol, 1), vt2(m_Nvol, 1), vt3(m_Nvol, 1);
360 
361  Sigma_mu.set(0.0);
362 
363  //- The 1st block
364  m_shift.backward(vt1, V_nu, mu);
365  if (mu == 3) set_wk.set_boundary_wkpr(vt1);
366  m_shift.backward(vt2, V_mu, nu);
367  if (nu == 3) set_wk.set_boundary_wkpr(vt2);
368  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
369  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, iTheta_nu, 0, 1.0);
370 
371  //- The 2nd block
372  mult_Field_Gdn(vt3, 0, iTheta_mu, 0, V_nu, 0);
373  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
374  m_shift.forward(vt3, vt2, nu);
375  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
376 
377  //- The 3rd block
378  mult_Field_Gdn(vt3, 0, V_mu, 0, iTheta_nu, 0);
379  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
380  m_shift.forward(vt3, vt2, nu);
381  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
382 
383  //- The 4th block
384  m_shift.backward(vt1, iTheta_nu, mu);
385  m_shift.backward(vt2, V_mu, nu);
386  if (nu == 3) set_wk.set_boundary_wkpr(vt2);
387  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
388  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
389 
390  //- The 5th block
391  mult_Field_Gdd(vt2, 0, vt1, 0, V_mu, 0);
392  mult_Field_Gnn(vt3, 0, vt2, 0, V_nu, 0);
393  m_shift.forward(vt2, vt3, nu);
394  axpy(Sigma_mu, 1.0, vt2); // Sigma_mu += vt2;
395 
396  //- The 6th block
397  m_shift.backward(vt1, V_nu, mu);
398  if (mu == 3) set_wk.set_boundary_wkpr(vt1);
399  m_shift.backward(vt2, iTheta_mu, nu);
400  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
401  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
402 }
403 
404 
405 //====================================================================
407 {
408  Field_G c1(m_Nvol, 1);
409 
410  for (int mu = 0; mu < m_Ndim; ++mu) {
411  for (int nu = 0; nu < m_Ndim; ++nu) {
412  if (nu == mu) continue;
413  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
414  if (rho == mu) continue;
415  int sig = 6 - mu - nu - rho;
416  staple(c1, m_U[mu], m_U[sig], mu, sig);
417  scal(c1, m_alpha3 / 2.0); // c1 *= m_alpha3 / 2.0;
418  m_proj->project(m_v1[idx1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
419  if (mu != 3) set_wk.set_boundary_wk(m_v1[idx1(mu, nu, rho)]);
420  }
421  }
422  }
423 }
424 
425 
426 //====================================================================
428 {
429  Field_G c2(m_Nvol, 1), u_tmp(m_Nvol, 1);
430 
431  for (int mu = 0; mu < m_Ndim; ++mu) {
432  for (int nu = 0; nu < m_Ndim; ++nu) {
433  if (nu == mu) continue;
434 
435  c2.set(0.0);
436 
437  for (int rho = 0; rho < m_Ndim; ++rho) {
438  if ((rho != mu) && (rho != nu)) {
439  staple(u_tmp, m_v1[idx1(mu, nu, rho)],
440  m_v1[idx1(rho, nu, mu)], mu, rho);
441  c2.addpart_ex(0, u_tmp, 0);
442  }
443  }
444  scal(c2, m_alpha2 / 4.0); // c2 *= m_alpha2 / 4.0;
445  m_proj->project(m_v2[idx2(mu, nu)], m_alpha2, c2, m_U[mu]);
446  if (mu != 3) set_wk.set_boundary_wk(m_v2[idx2(mu, nu)]);
447  }
448  }
449 }
450 
451 
452 //====================================================================
454  const Field_G& u_mu, const Field_G& u_nu,
455  int mu, int nu)
456 {
457  Field_G v1(m_Nvol, 1), v2(m_Nvol, 1);
458 
459  // upper direction
460  m_shift.backward(v1, u_mu, nu);
461  if (nu == 3) set_wk.set_boundary_wkpr(v1);
462  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
463 
464  m_shift.backward(v1, u_nu, mu);
465  if (mu == 3) set_wk.set_boundary_wkpr(v1);
466  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
467 
468  // lower direction
469  m_shift.backward(v2, u_nu, mu);
470  if (mu == 3) set_wk.set_boundary_wkpr(v2);
471  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
472  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
473  m_shift.forward(v1, v2, nu);
474  c.addpart_ex(0, v1, 0);
475 }
476 
477 
478 //====================================================================
479 //============================================================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:101
BridgeIO vout
Definition: bridgeIO.cpp:278
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:76
void Register_string(const string &, const string &)
Definition: parameters.cpp:351
void force_udiv(Field_G &Sigma, const Field_G &Sigma_p, const Field_G &U)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:155
void mult_Field_Gdn(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
double m_phi[3]
SF boundary condition at t=0.
void general(const char *format,...)
Definition: bridgeIO.cpp:65
int nvol() const
Definition: field.h:116
std::vector< Field_G > m_iTheta2
std::vector< Field_G > m_Sigma2
Class for parameters.
Definition: parameters.h:38
void force_step2(Field_G &)
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:189
void set_parameters(const Parameters &params)
void mult_Field_Gdd(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
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:125
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 mult_Field_Gnd(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:50
std::vector< Field_G > m_iTheta3
void mult_Field_Gnn(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_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 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
std::vector< Field_G > m_Sigma3
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
std::vector< Field_G > m_v2
base class for projection operator into gauge group.
Definition: projection.h:31
void set_parameters(const Parameters_Field_G_SF &params)
Set the parameter with Parameters_Field_G_SF class.
Definition: field_G_SF.cpp:268
void staple(Field_G &, const Field_G &, const Field_G &, int mu, int nu)
static bool Register(const std::string &realm, const creator_callback &cb)
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
void Register_double_vector(const string &, const std::vector< double > &)
Definition: parameters.cpp:337
int idx1b(int mu, int nu, int rho)
int fetch_double_vector(const string &key, std::vector< double > &val) const
Definition: parameters.cpp:158
void force_step3(Field_G &, const Field_G &)
void Register_double(const string &, const double)
Definition: parameters.cpp:323
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]
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:87
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:28
void forward(Field &, const Field &, const int mu)
std::vector< Field_G > m_iTheta1