Bridge++  Ver. 2.0.2
forceSmear_HYP.cpp
Go to the documentation of this file.
1 
14 #include "forceSmear_HYP.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = ForceSmear_HYP::register_factory();
19 }
20 #endif
21 
22 const std::string ForceSmear_HYP::class_name = "ForceSmear_HYP";
23 
24 //====================================================================
26 {
27  std::string vlevel;
28  if (!params.fetch_string("verbose_level", vlevel)) {
29  m_vl = vout.set_verbose_level(vlevel);
30  }
31 
32  //- fetch and check input parameters
33  double alpha1, alpha2, alpha3;
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 
40  if (err) {
41  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
42  exit(EXIT_FAILURE);
43  }
44 
45 
46  set_parameters(alpha1, alpha2, alpha3);
47 }
48 
49 
50 //====================================================================
52 {
53  params.set_double("alpha1", m_alpha1);
54  params.set_double("alpha2", m_alpha2);
55  params.set_double("alpha3", m_alpha3);
56 
57  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
58 }
59 
60 
61 //====================================================================
62 void ForceSmear_HYP::set_parameters(const double alpha1, const double alpha2, const double alpha3)
63 {
64  //- print input parameters
65  vout.general(m_vl, "Force of %s:\n", class_name.c_str());
66  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
67  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
68  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
69 
70  //- range check
71  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
72 
73  //- store values
74  m_alpha1 = alpha1;
75  m_alpha2 = alpha2;
76  m_alpha3 = alpha3;
77 }
78 
79 
80 //====================================================================
82 {
85 
86  m_U.resize(m_Ndim);
87 
88  m_v1.resize(size1());
89  m_v2.resize(size2());
90 
91  m_Sigma3.resize(size2());
92  m_Sigma2.resize(size1b());
93 
94  m_iTheta3.resize(m_Ndim);
95  m_iTheta2.resize(size2());
96  m_iTheta1.resize(size1b());
97 }
98 
99 
100 //====================================================================
101 void ForceSmear_HYP::force_udiv(Field_G& Sigma, const Field_G& Sigmap, const Field_G& U)
102 {
103  assert(U.nvol() == m_Nvol);
104  assert(U.nex() == m_Ndim);
105  assert(Sigmap.nvol() == m_Nvol);
106  assert(Sigmap.nex() == m_Ndim);
107 
108  for (int mu = 0; mu < m_Ndim; ++mu) {
109  m_U[mu].setpart_ex(0, U, mu);
110  }
111 
112  // vout.general(m_vl, " smearing step-1\n");
113  smear_step1();
114  // vout.general(m_vl, " smearing step-2\n");
115  smear_step2();
116 
117  Sigma.set(0.0);
118 
119  // vout.general(m_vl, " smeared force step-3\n");
120  force_step3(Sigma, Sigmap);
121 
122  // vout.general(m_vl, " smeared force step-2\n");
123  force_step2(Sigma);
124 
125  // vout.general(m_vl, " smeared force step-1\n");
126  force_step1(Sigma);
127 
128  // vout.general(m_vl, " smeared force finished\n");
129 }
130 
131 
132 //====================================================================
133 void ForceSmear_HYP::force_step3(Field_G& Sigma, const Field_G& Sigmap)
134 {
135  for (int mu = 0; mu < m_Ndim; ++mu) {
136  Field_G C;
137  C.set(0.0);
138 
139  for (int nu = 0; nu < m_Ndim; ++nu) {
140  if (nu == mu) continue;
141 
142  Field_G c_tmp;
143  staple(c_tmp, m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)], mu, nu);
144  C.addpart_ex(0, c_tmp, 0);
145  }
146  scal(C, m_alpha1 / 6.0); // C *= m_alpha1 / 6.0;
147 
148  Field_G Sigmap_tmp;
149  Sigmap_tmp.setpart_ex(0, Sigmap, mu);
150 
151  Field_G Xi;
153  m_alpha1, Sigmap_tmp, C, m_U[mu]);
154  Sigma.addpart_ex(mu, Xi, 0);
155  }
156 
157  for (int mu = 0; mu < m_Ndim; ++mu) {
158  for (int nu = 0; nu < m_Ndim; ++nu) {
159  if (nu == mu) continue;
160 
161  force_each(m_Sigma3[idx2(mu, nu)],
162  m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)],
163  m_iTheta3[mu], m_iTheta3[nu], mu, nu);
164 
165  scal(m_Sigma3[idx2(mu, nu)], m_alpha1 / 6.0); // m_Sigma3[idx2(mu, nu)] *= m_alpha1 / 6.0;
166  }
167  }
168 }
169 
170 
171 //====================================================================
173 {
174  for (int mu = 0; mu < m_Ndim; ++mu) {
175  for (int nu = 0; nu < m_Ndim; ++nu) {
176  if (nu == mu) continue;
177 
178  Field_G C;
179  C.set(0.0);
180 
181  for (int rho = 0; rho < m_Ndim; ++rho) {
182  if ((rho == mu) || (rho == nu)) continue;
183 
184  Field_G c_tmp;
185  staple(c_tmp, m_v1[idx1(mu, nu, rho)],
186  m_v1[idx1(rho, nu, mu)], mu, rho);
187  C.addpart_ex(0, c_tmp, 0);
188  }
189  scal(C, m_alpha2 / 4.0); // C *= m_alpha2 / 4.0;
190 
191  Field_G Xi;
192  m_proj->force_recursive(Xi, m_iTheta2[idx2(mu, nu)],
193  m_alpha2, m_Sigma3[idx2(mu, nu)], C, m_U[mu]);
194  Sigma.addpart_ex(mu, Xi, 0);
195  }
196  }
197 
198  for (int mu = 0; mu < m_Ndim; ++mu) {
199  for (int nu = 0; nu < m_Ndim; ++nu) {
200  if (nu == mu) continue;
201  for (int rho = 0; rho < m_Ndim; ++rho) {
202  if ((rho == mu) || (rho == nu)) continue;
203  force_each(m_Sigma2[idx1b(mu, nu, rho)],
204  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)],
205  m_iTheta2[idx2(mu, nu)], m_iTheta2[idx2(rho, nu)], mu, rho);
206  scal(m_Sigma2[idx1b(mu, nu, rho)], m_alpha2 / 4.0); // m_Sigma2[idx1b(mu, nu, rho)] *= m_alpha2 / 4.0;
207  }
208  }
209  }
210 }
211 
212 
213 //====================================================================
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  for (int rho = 0; rho < m_Ndim; ++rho) {
220  if ((rho == mu) || (rho == nu)) continue;
221 
222  int sig = 6 - mu - nu - rho;
223 
224  Field_G C;
225  staple(C, m_U[mu], m_U[sig], mu, sig);
226 
227  scal(C, m_alpha3 / 2.0); // C *= m_alpha3 / 2.0;
228 
229  Field_G Xi;
230  m_proj->force_recursive(Xi, m_iTheta1[idx1b(mu, nu, rho)],
231  m_alpha3, m_Sigma2[idx1b(mu, nu, rho)], C, m_U[mu]);
232  Sigma.addpart_ex(mu, Xi, 0);
233  }
234  }
235  }
236 
237  for (int mu = 0; mu < m_Ndim; ++mu) {
238  for (int nu = 0; nu < m_Ndim; ++nu) {
239  if (nu == mu) continue;
240 
241  for (int rho = 0; rho < m_Ndim; ++rho) {
242  if ((rho == mu) || (rho == nu)) continue;
243 
244  int sig = 6 - mu - nu - rho;
245 
246  Field_G Sigma_tmp;
247  force_each(Sigma_tmp, m_U[mu], m_U[sig],
248  m_iTheta1[idx1b(mu, nu, rho)], m_iTheta1[idx1b(sig, nu, rho)],
249  mu, sig);
250  scal(Sigma_tmp, m_alpha3 / 2.0); // Sigma_tmp *= m_alpha3 / 2.0;
251  Sigma.addpart_ex(mu, Sigma_tmp, 0);
252  }
253  }
254  }
255 }
256 
257 
258 //====================================================================
260  const Field_G& V_mu, const Field_G& V_nu,
261  const Field_G& iTheta_mu,
262  const Field_G& iTheta_nu,
263  const int mu, const int nu)
264 {
265  Sigma_mu.set(0.0);
266 
267  Field_G vt1;
268  m_shift.backward(vt1, V_nu, mu);
269 
270  Field_G vt2;
271  m_shift.backward(vt2, V_mu, nu);
272 
273  Field_G vt3;
274  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
275  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, iTheta_nu, 0, 1.0);
276 
277  mult_Field_Gdn(vt3, 0, iTheta_mu, 0, V_nu, 0);
278  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
279  m_shift.forward(vt3, vt2, nu);
280  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
281 
282  mult_Field_Gdn(vt3, 0, V_mu, 0, iTheta_nu, 0);
283  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
284  m_shift.forward(vt3, vt2, nu);
285  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
286 
287  m_shift.backward(vt1, iTheta_nu, mu);
288  m_shift.backward(vt2, V_mu, nu);
289  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
290  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
291 
292  mult_Field_Gdd(vt2, 0, vt1, 0, V_mu, 0);
293  mult_Field_Gnn(vt3, 0, vt2, 0, V_nu, 0);
294  m_shift.forward(vt2, vt3, nu);
295  axpy(Sigma_mu, 1.0, vt2); // Sigma_mu += vt2;
296 
297  m_shift.backward(vt1, V_nu, mu);
298  m_shift.backward(vt2, iTheta_mu, nu);
299  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
300  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
301 }
302 
303 
304 //====================================================================
306 {
307  for (int mu = 0; mu < m_Ndim; ++mu) {
308  for (int nu = 0; nu < m_Ndim; ++nu) {
309  if (nu == mu) continue;
310 
311  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
312  if (rho == mu) continue;
313 
314  int sig = 6 - mu - nu - rho;
315 
316  Field_G c1;
317  staple(c1, m_U[mu], m_U[sig], mu, sig);
318  scal(c1, m_alpha3 / 2.0); // c1 *= m_alpha3 / 2.0;
319  m_proj->project(m_v1[idx1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
320  }
321  }
322  }
323 }
324 
325 
326 //====================================================================
328 {
329  for (int mu = 0; mu < m_Ndim; ++mu) {
330  for (int nu = 0; nu < m_Ndim; ++nu) {
331  if (nu == mu) continue;
332 
333  Field_G c2;
334  c2.set(0.0);
335 
336  for (int rho = 0; rho < m_Ndim; ++rho) {
337  if ((rho != mu) && (rho != nu)) {
338  Field_G u_tmp;
339  staple(u_tmp,
340  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)], mu, rho);
341  c2.addpart_ex(0, u_tmp, 0);
342  }
343  }
344  scal(c2, m_alpha2 / 4.0); // c2 *= m_alpha2 / 4.0;
345  m_proj->project(m_v2[idx2(mu, nu)], m_alpha2, c2, m_U[mu]);
346  }
347  }
348 }
349 
350 
351 //====================================================================
353  const Field_G& u_mu, const Field_G& u_nu,
354  const int mu, const int nu)
355 {
356  //- upper direction
357  Field_G v1;
358 
359  m_shift.backward(v1, u_mu, nu);
360 
361  Field_G v2;
362  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
363 
364  m_shift.backward(v1, u_nu, mu);
365  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
366 
367  //- lower direction
368  m_shift.backward(v2, u_nu, mu);
369  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
370  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
371  m_shift.forward(v1, v2, nu);
372  c.addpart_ex(0, v1, 0);
373 }
374 
375 
376 //====================================================================
377 //============================================================END=====
ForceSmear_HYP::m_vl
Bridge::VerboseLevel m_vl
Definition: forceSmear_HYP.h:41
ForceSmear_HYP::force_udiv
void force_udiv(Field_G &Sigma, const Field_G &Sigma_p, const Field_G &U)
Definition: forceSmear_HYP.cpp:101
Field::setpart_ex
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:201
ForceSmear_HYP::smear_step2
void smear_step2()
Definition: forceSmear_HYP.cpp:327
mult_Field_Gdn
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:134
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
ShiftField_lex::forward
void forward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:79
ForceSmear_HYP::m_Ndim
int m_Ndim
Definition: forceSmear_HYP.h:43
ForceSmear_HYP::m_iTheta2
std::vector< Field_G > m_iTheta2
Definition: forceSmear_HYP.h:49
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
ForceSmear_HYP::smear_step1
void smear_step1()
Definition: forceSmear_HYP.cpp:305
Field::set
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
Parameters
Class for parameters.
Definition: parameters.h:46
ForceSmear_HYP::force_step1
void force_step1(Field_G &)
Definition: forceSmear_HYP.cpp:214
ForceSmear_HYP::m_iTheta3
std::vector< Field_G > m_iTheta3
Definition: forceSmear_HYP.h:49
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
ForceSmear_HYP::m_v1
std::vector< Field_G > m_v1
Definition: forceSmear_HYP.h:47
Field::nex
int nex() const
Definition: field.h:128
ForceSmear_HYP::force_step3
void force_step3(Field_G &, const Field_G &)
Definition: forceSmear_HYP.cpp:133
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
ForceSmear_HYP::idx2
int idx2(const int mu, int nu)
Definition: forceSmear_HYP.h:107
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
ForceSmear_HYP::size2
int size2()
Definition: forceSmear_HYP.h:123
ForceSmear_HYP::m_Sigma3
std::vector< Field_G > m_Sigma3
Definition: forceSmear_HYP.h:48
ForceSmear_HYP::class_name
static const std::string class_name
Definition: forceSmear_HYP.h:38
ForceSmear_HYP::get_parameters
void get_parameters(Parameters &params) const
Definition: forceSmear_HYP.cpp:51
ForceSmear_HYP::m_Nvol
int m_Nvol
Definition: forceSmear_HYP.h:43
ForceSmear_HYP::m_alpha3
double m_alpha3
Definition: forceSmear_HYP.h:44
ForceSmear_HYP::set_parameters
void set_parameters(const Parameters &params)
Definition: forceSmear_HYP.cpp:25
ForceSmear_HYP::m_v2
std::vector< Field_G > m_v2
Definition: forceSmear_HYP.h:47
ForceSmear_HYP::idx1
int idx1(const int mu, const int nu, const int rho)
Definition: forceSmear_HYP.h:91
Field::addpart_ex
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:208
ForceSmear_HYP::m_alpha1
double m_alpha1
Definition: forceSmear_HYP.h:44
ForceSmear_HYP::idx1b
int idx1b(const int mu, int nu, int rho)
Definition: forceSmear_HYP.h:99
ForceSmear_HYP::size1b
int size1b()
Definition: forceSmear_HYP.h:118
ForceSmear_HYP::force_step2
void force_step2(Field_G &)
Definition: forceSmear_HYP.cpp:172
Field::nvol
int nvol() const
Definition: field.h:127
ForceSmear_HYP::m_Sigma2
std::vector< Field_G > m_Sigma2
Definition: forceSmear_HYP.h:48
multadd_Field_Gnd
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)
Definition: field_G_imp.cpp:335
Projection::force_recursive
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
ForceSmear_HYP::init
void init()
Definition: forceSmear_HYP.cpp:81
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
mult_Field_Gnn
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:95
ShiftField_lex::backward
void backward(Field &, const Field &, const int mu)
Definition: shiftField_lex.cpp:59
ForceSmear_HYP::m_alpha2
double m_alpha2
Definition: forceSmear_HYP.h:44
mult_Field_Gdd
void mult_Field_Gdd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:212
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
ForceSmear_HYP::size1
int size1()
Definition: forceSmear_HYP.h:113
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
ForceSmear_HYP::m_iTheta1
std::vector< Field_G > m_iTheta1
Definition: forceSmear_HYP.h:49
ForceSmear_HYP::staple
void staple(Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
Definition: forceSmear_HYP.cpp:352
ForceSmear_HYP::m_U
std::vector< Field_G > m_U
Definition: forceSmear_HYP.h:46
Field_G
SU(N) gauge field.
Definition: field_G.h:38
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
ForceSmear_HYP::m_proj
Projection * m_proj
Definition: forceSmear_HYP.h:45
ForceSmear_HYP::m_shift
ShiftField_lex m_shift
Definition: forceSmear_HYP.h:50
mult_Field_Gnd
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Definition: field_G_imp.cpp:173
forceSmear_HYP.h
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154
Projection::project
virtual void project(Field_G &v, const double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]
ForceSmear_HYP::force_each
void force_each(Field_G &, const Field_G &, const Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
Definition: forceSmear_HYP.cpp:259