Bridge++  Ver. 1.2.x
 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_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::valarray<double>());
41  param.Register_double_vector("phipr", std::valarray<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  valarray<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  abort();
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 //====================================================================
145 {
146  Field_G Sigma(Sigmap.nvol(), Sigmap.nex());
147 
148  force_udiv(Sigma, Sigmap, U);
149  return Sigma;
150 }
151 
152 
153 //====================================================================
154 void ForceSmear_HYP_SF::force_udiv(Field_G& Sigma, const Field_G& Sigmap, const Field_G& U)
155 {
156  assert(U.nvol() == m_Nvol);
157  assert(U.nex() == m_Ndim);
158  assert(Sigmap.nvol() == m_Nvol);
159  assert(Sigmap.nex() == m_Ndim);
160 
161  for (int mu = 0; mu < m_Ndim; ++mu) {
162  m_U[mu].setpart_ex(0, U, mu);
163  if (mu != 3) set_wk.set_boundary_wk(m_U[mu]);
164  }
165 
166  // vout.general(m_vl," smearing step-1\n");
167  smear_step1();
168  // vout.general(m_vl," smearing step-2\n");
169  smear_step2();
170 
171  Sigma = 0.0;
172 
173  // vout.general(m_vl," smeared force step-3\n");
174  force_step3(Sigma, Sigmap);
175  // vout.general(m_vl," smeared force step-2\n");
176  force_step2(Sigma);
177  // vout.general(m_vl," smeared force step-1\n");
178  force_step1(Sigma);
179  // vout.general(m_vl," smeared force finished\n");
180 }
181 
182 
183 //====================================================================
184 
196 void ForceSmear_HYP_SF::force_step3(Field_G& Sigma, const Field_G& Sigmap)
197 {
198  Field_G Sigmap_tmp(m_Nvol, 1), C(m_Nvol, 1), c_tmp(m_Nvol, 1);
199  Field_G Xi(m_Nvol, 1);
200 
201  for (int mu = 0; mu < m_Ndim; ++mu) {
202  C = 0.0;
203  for (int nu = 0; nu < m_Ndim; ++nu) {
204  if (nu == mu) continue;
205  staple(c_tmp, m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)], mu, nu);
206  C.addpart_ex(0, c_tmp, 0);
207  }
208  C *= m_alpha1 / 6.0;
209 
210  Sigmap_tmp.setpart_ex(0, Sigmap, mu);
212  m_alpha1, Sigmap_tmp, C, m_U[mu]);
213  Sigma.addpart_ex(mu, Xi, 0);
214  }
215 
216  for (int mu = 0; mu < m_Ndim; ++mu) {
217  for (int nu = 0; nu < m_Ndim; ++nu) {
218  if (nu == mu) continue;
219 
220  force_each(m_Sigma3[idx2(mu, nu)],
221  m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)],
222  m_iTheta3[mu], m_iTheta3[nu], mu, nu);
223 
224  m_Sigma3[idx2(mu, nu)] *= m_alpha1 / 6.0;
225  if (mu != 3) set_wk.set_boundary_zero(m_Sigma3[idx2(mu, nu)]);
226  }
227  }
228 }
229 
230 
231 //====================================================================
232 
244 {
245  Field_G C(m_Nvol, 1), c_tmp(m_Nvol, 1), Xi(m_Nvol, 1);
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 
251  C = 0.0;
252  for (int rho = 0; rho < m_Ndim; ++rho) {
253  if ((rho == mu) || (rho == nu)) continue;
254  staple(c_tmp, m_v1[idx1(mu, nu, rho)],
255  m_v1[idx1(rho, nu, mu)], mu, rho);
256  C.addpart_ex(0, c_tmp, 0);
257  }
258  C *= m_alpha2 / 4.0;
259 
260  m_proj->force_recursive(Xi, m_iTheta2[idx2(mu, nu)],
261  m_alpha2, m_Sigma3[idx2(mu, nu)], C, m_U[mu]);
262  Sigma.addpart_ex(mu, Xi, 0);
263  }
264  }
265 
266  for (int mu = 0; mu < m_Ndim; ++mu) {
267  for (int nu = 0; nu < m_Ndim; ++nu) {
268  if (nu == mu) continue;
269  for (int rho = 0; rho < m_Ndim; ++rho) {
270  if ((rho == mu) || (rho == nu)) continue;
271  force_each(m_Sigma2[idx1b(mu, nu, rho)],
272  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)],
273  m_iTheta2[idx2(mu, nu)], m_iTheta2[idx2(rho, nu)], mu, rho);
274  m_Sigma2[idx1b(mu, nu, rho)] *= m_alpha2 / 4.0;
275  if (mu != 3) set_wk.set_boundary_zero(m_Sigma2[idx1b(mu, nu, rho)]);
276  }
277  }
278  }
279 }
280 
281 
282 //====================================================================
283 
294 {
295  Field_G Sigma_tmp(m_Nvol, 1), C(m_Nvol, 1), Xi(m_Nvol, 1);
296 
297  for (int mu = 0; mu < m_Ndim; ++mu) {
298  for (int nu = 0; nu < m_Ndim; ++nu) {
299  if (nu == mu) continue;
300  for (int rho = 0; rho < m_Ndim; ++rho) {
301  if ((rho == mu) || (rho == nu)) continue;
302 
303  int sig = 6 - mu - nu - rho;
304  staple(C, m_U[mu], m_U[sig], mu, sig);
305  C *= m_alpha3 / 2.0;
306 
307  m_proj->force_recursive(Xi, m_iTheta1[idx1b(mu, nu, rho)],
308  m_alpha3, m_Sigma2[idx1b(mu, nu, rho)], C, m_U[mu]);
309  Sigma.addpart_ex(mu, Xi, 0);
310  }
311  }
312  }
313 
314  for (int mu = 0; mu < m_Ndim; ++mu) {
315  for (int nu = 0; nu < m_Ndim; ++nu) {
316  if (nu == mu) continue;
317  for (int rho = 0; rho < m_Ndim; ++rho) {
318  if ((rho == mu) || (rho == nu)) continue;
319  int sig = 6 - mu - nu - rho;
320  force_each(Sigma_tmp, m_U[mu], m_U[sig],
321  m_iTheta1[idx1b(mu, nu, rho)], m_iTheta1[idx1b(sig, nu, rho)],
322  mu, sig);
323  Sigma_tmp *= m_alpha3 / 2.0;
324  Sigma.addpart_ex(mu, Sigma_tmp, 0);
325  }
326  }
327  }
328 
330 }
331 
332 
333 //====================================================================
334 
347  const Field_G& V_mu, const Field_G& V_nu,
348  const Field_G& iTheta_mu,
349  const Field_G& iTheta_nu,
350  int mu, int nu)
351 {
352  Field_G vt1(m_Nvol, 1), vt2(m_Nvol, 1), vt3(m_Nvol, 1);
353 
354  Sigma_mu = 0.0;
355 
356  //- The 1st block
357  m_shift.backward(vt1, V_nu, mu);
358  if (mu == 3) set_wk.set_boundary_wkpr(vt1);
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, iTheta_nu, 0, 1.0);
363 
364  //- The 2nd block
365  mult_Field_Gdn(vt3, 0, iTheta_mu, 0, V_nu, 0);
366  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
367  m_shift.forward(vt3, vt2, nu);
368  Sigma_mu += vt3;
369 
370  //- The 3rd block
371  mult_Field_Gdn(vt3, 0, V_mu, 0, iTheta_nu, 0);
372  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
373  m_shift.forward(vt3, vt2, nu);
374  Sigma_mu += vt3;
375 
376  //- The 4th block
377  m_shift.backward(vt1, iTheta_nu, mu);
378  m_shift.backward(vt2, V_mu, nu);
379  if (nu == 3) set_wk.set_boundary_wkpr(vt2);
380  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
381  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
382 
383  //- The 5th block
384  mult_Field_Gdd(vt2, 0, vt1, 0, V_mu, 0);
385  mult_Field_Gnn(vt3, 0, vt2, 0, V_nu, 0);
386  m_shift.forward(vt2, vt3, nu);
387  Sigma_mu += vt2;
388 
389  //- The 6th block
390  m_shift.backward(vt1, V_nu, mu);
391  if (mu == 3) set_wk.set_boundary_wkpr(vt1);
392  m_shift.backward(vt2, iTheta_mu, nu);
393  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
394  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
395 }
396 
397 
398 //====================================================================
400 {
401  Field_G c1(m_Nvol, 1);
402 
403  for (int mu = 0; mu < m_Ndim; ++mu) {
404  for (int nu = 0; nu < m_Ndim; ++nu) {
405  if (nu == mu) continue;
406  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
407  if (rho == mu) continue;
408  int sig = 6 - mu - nu - rho;
409  staple(c1, m_U[mu], m_U[sig], mu, sig);
410  c1 *= m_alpha3 / 2.0;
411  m_proj->project(m_v1[idx1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
412  if (mu != 3) set_wk.set_boundary_wk(m_v1[idx1(mu, nu, rho)]);
413  }
414  }
415  }
416 }
417 
418 
419 //====================================================================
421 {
422  Field_G c2(m_Nvol, 1), u_tmp(m_Nvol, 1);
423 
424  for (int mu = 0; mu < m_Ndim; ++mu) {
425  for (int nu = 0; nu < m_Ndim; ++nu) {
426  if (nu == mu) continue;
427  c2 = 0.0;
428  for (int rho = 0; rho < m_Ndim; ++rho) {
429  if ((rho != mu) && (rho != nu)) {
430  staple(u_tmp, m_v1[idx1(mu, nu, rho)],
431  m_v1[idx1(rho, nu, mu)], mu, rho);
432  c2.addpart_ex(0, u_tmp, 0);
433  }
434  }
435  c2 *= m_alpha2 / 4.0;
436  m_proj->project(m_v2[idx2(mu, nu)], m_alpha2, c2, m_U[mu]);
437  if (mu != 3) set_wk.set_boundary_wk(m_v2[idx2(mu, nu)]);
438  }
439  }
440 }
441 
442 
443 //====================================================================
445  const Field_G& u_mu, const Field_G& u_nu,
446  int mu, int nu)
447 {
448  Field_G v1(m_Nvol, 1), v2(m_Nvol, 1);
449 
450  // upper direction
451  m_shift.backward(v1, u_mu, nu);
452  if (nu == 3) set_wk.set_boundary_wkpr(v1);
453  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
454 
455  m_shift.backward(v1, u_nu, mu);
456  if (mu == 3) set_wk.set_boundary_wkpr(v1);
457  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
458 
459  // lower direction
460  m_shift.backward(v2, u_nu, mu);
461  if (mu == 3) set_wk.set_boundary_wkpr(v2);
462  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
463  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
464  m_shift.forward(v1, v2, nu);
465  c.addpart_ex(0, v1, 0);
466 }
467 
468 
469 //====================================================================
470 //============================================================END=====
std::valarray< Field_G > m_iTheta2
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:207
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:352
void force_udiv(Field_G &Sigma, const Field_G &Sigma_p, const Field_G &U)
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:38
std::valarray< Field_G > m_Sigma3
Container of Field-type object.
Definition: field.h:37
int nvol() const
Definition: field.h:101
std::valarray< Field_G > m_U
Class for parameters.
Definition: parameters.h:40
void force_step2(Field_G &)
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:162
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)
int fetch_double_vector(const string &key, std::valarray< double > &val) const
Definition: parameters.cpp:158
Base class for force calculation of smeared operators.
Definition: forceSmear.h:37
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:36
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
void mult_Field_Gnn(Field_G &w, const int ex, const Field_G &u1, const int ex1, const Field_G &u2, const int ex2)
int idx2(int mu, int nu)
void backward(Field &, const Field &, const int mu)
std::valarray< Field_G > m_Sigma2
ShiftField_lex m_shift
std::valarray< Field_G > m_iTheta3
int nex() const
Definition: field.h:102
std::valarray< Field_G > m_iTheta1
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 crucial(const char *format,...)
Definition: bridgeIO.cpp:26
base class for projection operator into gauge group.
Definition: projection.h:33
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::valarray< Field_G > m_v2
int idx1b(int mu, int nu, int rho)
void force_step3(Field_G &, const Field_G &)
void Register_double_vector(const string &, const std::valarray< double > &)
Definition: parameters.cpp:338
void Register_double(const string &, const double)
Definition: parameters.cpp:324
std::valarray< Field_G > m_v1
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:85
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:191
void forward(Field &, const Field &, const int mu)