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