Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  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 
34  int err = 0;
35  err += params.fetch_double("alpha1", alpha1);
36  err += params.fetch_double("alpha2", alpha2);
37  err += params.fetch_double("alpha3", alpha3);
38 
39  if (err) {
40  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
41  exit(EXIT_FAILURE);
42  }
43 
44 
45  set_parameters(alpha1, alpha2, alpha3);
46 }
47 
48 
49 //====================================================================
50 void ForceSmear_HYP::set_parameters(const double alpha1, const double alpha2, const double alpha3)
51 {
52  //- print input parameters
53  vout.general(m_vl, "Force of %s:\n", class_name.c_str());
54  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
55  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
56  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
57 
58  //- range check
59  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
60 
61  //- store values
62  m_alpha1 = alpha1;
63  m_alpha2 = alpha2;
64  m_alpha3 = alpha3;
65 }
66 
67 
68 //====================================================================
70 {
73 
74  m_U.resize(m_Ndim);
75 
76  m_v1.resize(size1());
77  m_v2.resize(size2());
78 
79  m_Sigma3.resize(size2());
80  m_Sigma2.resize(size1b());
81 
82  m_iTheta3.resize(m_Ndim);
83  m_iTheta2.resize(size2());
84  m_iTheta1.resize(size1b());
85 }
86 
87 
88 //====================================================================
89 void ForceSmear_HYP::force_udiv(Field_G& Sigma, const Field_G& Sigmap, const Field_G& U)
90 {
91  assert(U.nvol() == m_Nvol);
92  assert(U.nex() == m_Ndim);
93  assert(Sigmap.nvol() == m_Nvol);
94  assert(Sigmap.nex() == m_Ndim);
95 
96  for (int mu = 0; mu < m_Ndim; ++mu) {
97  m_U[mu].setpart_ex(0, U, mu);
98  }
99 
100  // vout.general(m_vl, " smearing step-1\n");
101  smear_step1();
102  // vout.general(m_vl, " smearing step-2\n");
103  smear_step2();
104 
105  Sigma.set(0.0);
106 
107  // vout.general(m_vl, " smeared force step-3\n");
108  force_step3(Sigma, Sigmap);
109 
110  // vout.general(m_vl, " smeared force step-2\n");
111  force_step2(Sigma);
112 
113  // vout.general(m_vl, " smeared force step-1\n");
114  force_step1(Sigma);
115 
116  // vout.general(m_vl, " smeared force finished\n");
117 }
118 
119 
120 //====================================================================
121 void ForceSmear_HYP::force_step3(Field_G& Sigma, const Field_G& Sigmap)
122 {
123  for (int mu = 0; mu < m_Ndim; ++mu) {
124  Field_G C;
125  C.set(0.0);
126 
127  for (int nu = 0; nu < m_Ndim; ++nu) {
128  if (nu == mu) continue;
129 
130  Field_G c_tmp;
131  staple(c_tmp, m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)], mu, nu);
132  C.addpart_ex(0, c_tmp, 0);
133  }
134  scal(C, m_alpha1 / 6.0); // C *= m_alpha1 / 6.0;
135 
136  Field_G Sigmap_tmp;
137  Sigmap_tmp.setpart_ex(0, Sigmap, mu);
138 
139  Field_G Xi;
141  m_alpha1, Sigmap_tmp, C, m_U[mu]);
142  Sigma.addpart_ex(mu, Xi, 0);
143  }
144 
145  for (int mu = 0; mu < m_Ndim; ++mu) {
146  for (int nu = 0; nu < m_Ndim; ++nu) {
147  if (nu == mu) continue;
148 
149  force_each(m_Sigma3[idx2(mu, nu)],
150  m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)],
151  m_iTheta3[mu], m_iTheta3[nu], mu, nu);
152 
153  scal(m_Sigma3[idx2(mu, nu)], m_alpha1 / 6.0); // m_Sigma3[idx2(mu, nu)] *= m_alpha1 / 6.0;
154  }
155  }
156 }
157 
158 
159 //====================================================================
161 {
162  for (int mu = 0; mu < m_Ndim; ++mu) {
163  for (int nu = 0; nu < m_Ndim; ++nu) {
164  if (nu == mu) continue;
165 
166  Field_G C;
167  C.set(0.0);
168 
169  for (int rho = 0; rho < m_Ndim; ++rho) {
170  if ((rho == mu) || (rho == nu)) continue;
171 
172  Field_G c_tmp;
173  staple(c_tmp, m_v1[idx1(mu, nu, rho)],
174  m_v1[idx1(rho, nu, mu)], mu, rho);
175  C.addpart_ex(0, c_tmp, 0);
176  }
177  scal(C, m_alpha2 / 4.0); // C *= m_alpha2 / 4.0;
178 
179  Field_G Xi;
180  m_proj->force_recursive(Xi, m_iTheta2[idx2(mu, nu)],
181  m_alpha2, m_Sigma3[idx2(mu, nu)], C, m_U[mu]);
182  Sigma.addpart_ex(mu, Xi, 0);
183  }
184  }
185 
186  for (int mu = 0; mu < m_Ndim; ++mu) {
187  for (int nu = 0; nu < m_Ndim; ++nu) {
188  if (nu == mu) continue;
189  for (int rho = 0; rho < m_Ndim; ++rho) {
190  if ((rho == mu) || (rho == nu)) continue;
191  force_each(m_Sigma2[idx1b(mu, nu, rho)],
192  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)],
193  m_iTheta2[idx2(mu, nu)], m_iTheta2[idx2(rho, nu)], mu, rho);
194  scal(m_Sigma2[idx1b(mu, nu, rho)], m_alpha2 / 4.0); // m_Sigma2[idx1b(mu, nu, rho)] *= m_alpha2 / 4.0;
195  }
196  }
197  }
198 }
199 
200 
201 //====================================================================
203 {
204  for (int mu = 0; mu < m_Ndim; ++mu) {
205  for (int nu = 0; nu < m_Ndim; ++nu) {
206  if (nu == mu) continue;
207  for (int rho = 0; rho < m_Ndim; ++rho) {
208  if ((rho == mu) || (rho == nu)) continue;
209 
210  int sig = 6 - mu - nu - rho;
211 
212  Field_G C;
213  staple(C, m_U[mu], m_U[sig], mu, sig);
214 
215  scal(C, m_alpha3 / 2.0); // C *= m_alpha3 / 2.0;
216 
217  Field_G Xi;
218  m_proj->force_recursive(Xi, m_iTheta1[idx1b(mu, nu, rho)],
219  m_alpha3, m_Sigma2[idx1b(mu, nu, rho)], C, m_U[mu]);
220  Sigma.addpart_ex(mu, Xi, 0);
221  }
222  }
223  }
224 
225  for (int mu = 0; mu < m_Ndim; ++mu) {
226  for (int nu = 0; nu < m_Ndim; ++nu) {
227  if (nu == mu) continue;
228 
229  for (int rho = 0; rho < m_Ndim; ++rho) {
230  if ((rho == mu) || (rho == nu)) continue;
231 
232  int sig = 6 - mu - nu - rho;
233 
234  Field_G Sigma_tmp;
235  force_each(Sigma_tmp, m_U[mu], m_U[sig],
236  m_iTheta1[idx1b(mu, nu, rho)], m_iTheta1[idx1b(sig, nu, rho)],
237  mu, sig);
238  scal(Sigma_tmp, m_alpha3 / 2.0); // Sigma_tmp *= m_alpha3 / 2.0;
239  Sigma.addpart_ex(mu, Sigma_tmp, 0);
240  }
241  }
242  }
243 }
244 
245 
246 //====================================================================
248  const Field_G& V_mu, const Field_G& V_nu,
249  const Field_G& iTheta_mu,
250  const Field_G& iTheta_nu,
251  const int mu, const int nu)
252 {
253  Sigma_mu.set(0.0);
254 
255  Field_G vt1;
256  m_shift.backward(vt1, V_nu, mu);
257 
258  Field_G vt2;
259  m_shift.backward(vt2, V_mu, nu);
260 
261  Field_G vt3;
262  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
263  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, iTheta_nu, 0, 1.0);
264 
265  mult_Field_Gdn(vt3, 0, iTheta_mu, 0, V_nu, 0);
266  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
267  m_shift.forward(vt3, vt2, nu);
268  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
269 
270  mult_Field_Gdn(vt3, 0, V_mu, 0, iTheta_nu, 0);
271  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
272  m_shift.forward(vt3, vt2, nu);
273  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
274 
275  m_shift.backward(vt1, iTheta_nu, mu);
276  m_shift.backward(vt2, V_mu, nu);
277  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
278  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
279 
280  mult_Field_Gdd(vt2, 0, vt1, 0, V_mu, 0);
281  mult_Field_Gnn(vt3, 0, vt2, 0, V_nu, 0);
282  m_shift.forward(vt2, vt3, nu);
283  axpy(Sigma_mu, 1.0, vt2); // Sigma_mu += vt2;
284 
285  m_shift.backward(vt1, V_nu, mu);
286  m_shift.backward(vt2, iTheta_mu, nu);
287  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
288  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
289 }
290 
291 
292 //====================================================================
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 = nu + 1; rho < m_Ndim; ++rho) {
300  if (rho == mu) continue;
301 
302  int sig = 6 - mu - nu - rho;
303 
304  Field_G c1;
305  staple(c1, m_U[mu], m_U[sig], mu, sig);
306  scal(c1, m_alpha3 / 2.0); // c1 *= m_alpha3 / 2.0;
307  m_proj->project(m_v1[idx1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
308  }
309  }
310  }
311 }
312 
313 
314 //====================================================================
316 {
317  for (int mu = 0; mu < m_Ndim; ++mu) {
318  for (int nu = 0; nu < m_Ndim; ++nu) {
319  if (nu == mu) continue;
320 
321  Field_G c2;
322  c2.set(0.0);
323 
324  for (int rho = 0; rho < m_Ndim; ++rho) {
325  if ((rho != mu) && (rho != nu)) {
326  Field_G u_tmp;
327  staple(u_tmp,
328  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)], mu, rho);
329  c2.addpart_ex(0, u_tmp, 0);
330  }
331  }
332  scal(c2, m_alpha2 / 4.0); // c2 *= m_alpha2 / 4.0;
333  m_proj->project(m_v2[idx2(mu, nu)], m_alpha2, c2, m_U[mu]);
334  }
335  }
336 }
337 
338 
339 //====================================================================
341  const Field_G& u_mu, const Field_G& u_nu,
342  const int mu, const int nu)
343 {
344  //- upper direction
345  Field_G v1;
346 
347  m_shift.backward(v1, u_mu, nu);
348 
349  Field_G v2;
350  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
351 
352  m_shift.backward(v1, u_nu, mu);
353  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
354 
355  //- lower direction
356  m_shift.backward(v2, u_nu, mu);
357  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
358  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
359  m_shift.forward(v1, v2, nu);
360  c.addpart_ex(0, v1, 0);
361 }
362 
363 
364 //====================================================================
365 //============================================================END=====
Projection * m_proj
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
BridgeIO vout
Definition: bridgeIO.cpp:503
void set_parameters(const Parameters &params)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void general(const char *format,...)
Definition: bridgeIO.cpp:197
std::vector< Field_G > m_U
void force_step3(Field_G &, const Field_G &)
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
void force_each(Field_G &, const Field_G &, const Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
int nvol() const
Definition: field.h:127
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_iTheta2
Class for parameters.
Definition: parameters.h:46
ShiftField_lex m_shift
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
std::vector< Field_G > m_v2
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 mult_Field_Gdd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
static const std::string class_name
int idx2(const int mu, int nu)
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:128
int idx1b(const int mu, int nu, int rho)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
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
void force_udiv(Field_G &Sigma, const Field_G &Sigma_p, const Field_G &U)
std::vector< Field_G > m_iTheta1
int idx1(const int mu, const int nu, const int rho)
std::vector< Field_G > m_v1
std::vector< Field_G > m_Sigma2
void force_step1(Field_G &)
void force_step2(Field_G &)
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
std::vector< Field_G > m_iTheta3
string get_string(const string &key) const
Definition: parameters.cpp:221
void staple(Field_G &, const Field_G &, const Field_G &, const int mu, const int nu)
std::vector< Field_G > m_Sigma3
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)