Bridge++  Version 1.4.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 
17 
18 #ifdef USE_FACTORY
19 namespace {
20  ForceSmear *create_object(Projection *proj)
21  {
22  return new ForceSmear_HYP(proj);
23  }
24 
25 
26  bool init = ForceSmear::Factory::Register("HYP", create_object);
27 }
28 #endif
29 
30 
31 
32 const std::string ForceSmear_HYP::class_name = "ForceSmear_HYP";
33 
34 //====================================================================
36 {
37  const string str_vlevel = params.get_string("verbose_level");
38 
39  m_vl = vout.set_verbose_level(str_vlevel);
40 
41  //- fetch and check input parameters
42  double alpha1, alpha2, alpha3;
43 
44  int err = 0;
45  err += params.fetch_double("alpha1", alpha1);
46  err += params.fetch_double("alpha2", alpha2);
47  err += params.fetch_double("alpha3", alpha3);
48 
49  if (err) {
50  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
51  exit(EXIT_FAILURE);
52  }
53 
54 
55  set_parameters(alpha1, alpha2, alpha3);
56 }
57 
58 
59 //====================================================================
60 void ForceSmear_HYP::set_parameters(double alpha1, double alpha2, double alpha3)
61 {
62  //- print input parameters
63  vout.general(m_vl, "Force of %s:\n", class_name.c_str());
64  vout.general(m_vl, " alpha1 = %10.6F\n", alpha1);
65  vout.general(m_vl, " alpha2 = %10.6F\n", alpha2);
66  vout.general(m_vl, " alpha3 = %10.6F\n", alpha3);
67 
68  //- range check
69  // NB. alpha1,alpha2,alpha3 == 0 is allowed.
70 
71  //- store values
72  m_alpha1 = alpha1;
73  m_alpha2 = alpha2;
74  m_alpha3 = alpha3;
75 }
76 
77 
78 //====================================================================
80 {
83 
84  m_U.resize(m_Ndim);
85 
86  m_v1.resize(size1());
87  m_v2.resize(size2());
88 
89  m_Sigma3.resize(size2());
90  m_Sigma2.resize(size1b());
91 
92  m_iTheta3.resize(m_Ndim);
93  m_iTheta2.resize(size2());
94  m_iTheta1.resize(size1b());
95 }
96 
97 
98 //====================================================================
99 void ForceSmear_HYP::force_udiv(Field_G& Sigma, const Field_G& Sigmap, const Field_G& U)
100 {
101  assert(U.nvol() == m_Nvol);
102  assert(U.nex() == m_Ndim);
103  assert(Sigmap.nvol() == m_Nvol);
104  assert(Sigmap.nex() == m_Ndim);
105 
106  for (int mu = 0; mu < m_Ndim; ++mu) {
107  m_U[mu].setpart_ex(0, U, mu);
108  }
109 
110  // vout.general(m_vl, " smearing step-1\n");
111  smear_step1();
112  // vout.general(m_vl, " smearing step-2\n");
113  smear_step2();
114 
115  Sigma.set(0.0);
116 
117  // vout.general(m_vl, " smeared force step-3\n");
118  force_step3(Sigma, Sigmap);
119 
120  // vout.general(m_vl, " smeared force step-2\n");
121  force_step2(Sigma);
122 
123  // vout.general(m_vl, " smeared force step-1\n");
124  force_step1(Sigma);
125 
126  // vout.general(m_vl, " smeared force finished\n");
127 }
128 
129 
130 //====================================================================
131 void ForceSmear_HYP::force_step3(Field_G& Sigma, const Field_G& Sigmap)
132 {
133  Field_G Sigmap_tmp(m_Nvol, 1), C(m_Nvol, 1), c_tmp(m_Nvol, 1);
134  Field_G Xi(m_Nvol, 1);
135 
136  for (int mu = 0; mu < m_Ndim; ++mu) {
137  C.set(0.0);
138 
139  for (int nu = 0; nu < m_Ndim; ++nu) {
140  if (nu == mu) continue;
141  staple(c_tmp, m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)], mu, nu);
142  C.addpart_ex(0, c_tmp, 0);
143  }
144  scal(C, m_alpha1 / 6.0); // C *= m_alpha1 / 6.0;
145 
146  Sigmap_tmp.setpart_ex(0, Sigmap, mu);
148  m_alpha1, Sigmap_tmp, C, m_U[mu]);
149  Sigma.addpart_ex(mu, Xi, 0);
150  }
151 
152  for (int mu = 0; mu < m_Ndim; ++mu) {
153  for (int nu = 0; nu < m_Ndim; ++nu) {
154  if (nu == mu) continue;
155 
156  force_each(m_Sigma3[idx2(mu, nu)],
157  m_v2[idx2(mu, nu)], m_v2[idx2(nu, mu)],
158  m_iTheta3[mu], m_iTheta3[nu], mu, nu);
159 
160  scal(m_Sigma3[idx2(mu, nu)], m_alpha1 / 6.0); // m_Sigma3[idx2(mu, nu)] *= m_alpha1 / 6.0;
161  }
162  }
163 }
164 
165 
166 //====================================================================
168 {
169  Field_G C(m_Nvol, 1), c_tmp(m_Nvol, 1), Xi(m_Nvol, 1);
170 
171  for (int mu = 0; mu < m_Ndim; ++mu) {
172  for (int nu = 0; nu < m_Ndim; ++nu) {
173  if (nu == mu) continue;
174 
175  C.set(0.0);
176 
177  for (int rho = 0; rho < m_Ndim; ++rho) {
178  if ((rho == mu) || (rho == nu)) continue;
179  staple(c_tmp, m_v1[idx1(mu, nu, rho)],
180  m_v1[idx1(rho, nu, mu)], mu, rho);
181  C.addpart_ex(0, c_tmp, 0);
182  }
183  scal(C, m_alpha2 / 4.0); // C *= m_alpha2 / 4.0;
184 
185  m_proj->force_recursive(Xi, m_iTheta2[idx2(mu, nu)],
186  m_alpha2, m_Sigma3[idx2(mu, nu)], C, m_U[mu]);
187  Sigma.addpart_ex(mu, Xi, 0);
188  }
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  for (int rho = 0; rho < m_Ndim; ++rho) {
195  if ((rho == mu) || (rho == nu)) continue;
196  force_each(m_Sigma2[idx1b(mu, nu, rho)],
197  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)],
198  m_iTheta2[idx2(mu, nu)], m_iTheta2[idx2(rho, nu)], mu, rho);
199  scal(m_Sigma2[idx1b(mu, nu, rho)], m_alpha2 / 4.0); // m_Sigma2[idx1b(mu, nu, rho)] *= m_alpha2 / 4.0;
200  }
201  }
202  }
203 }
204 
205 
206 //====================================================================
208 {
209  Field_G Sigma_tmp(m_Nvol, 1), C(m_Nvol, 1), Xi(m_Nvol, 1);
210 
211  for (int mu = 0; mu < m_Ndim; ++mu) {
212  for (int nu = 0; nu < m_Ndim; ++nu) {
213  if (nu == mu) continue;
214  for (int rho = 0; rho < m_Ndim; ++rho) {
215  if ((rho == mu) || (rho == nu)) continue;
216 
217  int sig = 6 - mu - nu - rho;
218  staple(C, m_U[mu], m_U[sig], mu, sig);
219 
220  scal(C, m_alpha3 / 2.0); // C *= m_alpha3 / 2.0;
221 
222  m_proj->force_recursive(Xi, m_iTheta1[idx1b(mu, nu, rho)],
223  m_alpha3, m_Sigma2[idx1b(mu, nu, rho)], C, m_U[mu]);
224  Sigma.addpart_ex(mu, Xi, 0);
225  }
226  }
227  }
228 
229  for (int mu = 0; mu < m_Ndim; ++mu) {
230  for (int nu = 0; nu < m_Ndim; ++nu) {
231  if (nu == mu) continue;
232  for (int rho = 0; rho < m_Ndim; ++rho) {
233  if ((rho == mu) || (rho == nu)) continue;
234  int sig = 6 - mu - nu - rho;
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  int mu, int nu)
252 {
253  Field_G vt1(m_Nvol, 1), vt2(m_Nvol, 1), vt3(m_Nvol, 1);
254 
255  Sigma_mu.set(0.0);
256 
257  m_shift.backward(vt1, V_nu, mu);
258  m_shift.backward(vt2, V_mu, nu);
259  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
260  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, iTheta_nu, 0, 1.0);
261 
262  mult_Field_Gdn(vt3, 0, iTheta_mu, 0, V_nu, 0);
263  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
264  m_shift.forward(vt3, vt2, nu);
265  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
266 
267  mult_Field_Gdn(vt3, 0, V_mu, 0, iTheta_nu, 0);
268  mult_Field_Gdn(vt2, 0, vt1, 0, vt3, 0);
269  m_shift.forward(vt3, vt2, nu);
270  axpy(Sigma_mu, 1.0, vt3); // Sigma_mu += vt3;
271 
272  m_shift.backward(vt1, iTheta_nu, mu);
273  m_shift.backward(vt2, V_mu, nu);
274  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
275  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
276 
277  mult_Field_Gdd(vt2, 0, vt1, 0, V_mu, 0);
278  mult_Field_Gnn(vt3, 0, vt2, 0, V_nu, 0);
279  m_shift.forward(vt2, vt3, nu);
280  axpy(Sigma_mu, 1.0, vt2); // Sigma_mu += vt2;
281 
282  m_shift.backward(vt1, V_nu, mu);
283  m_shift.backward(vt2, iTheta_mu, nu);
284  mult_Field_Gnd(vt3, 0, vt1, 0, vt2, 0);
285  multadd_Field_Gnd(Sigma_mu, 0, vt3, 0, V_nu, 0, 1.0);
286 }
287 
288 
289 //====================================================================
291 {
292  Field_G c1(m_Nvol, 1);
293 
294  for (int mu = 0; mu < m_Ndim; ++mu) {
295  for (int nu = 0; nu < m_Ndim; ++nu) {
296  if (nu == mu) continue;
297  for (int rho = nu + 1; rho < m_Ndim; ++rho) {
298  if (rho == mu) continue;
299  int sig = 6 - mu - nu - rho;
300  staple(c1, m_U[mu], m_U[sig], mu, sig);
301  scal(c1, m_alpha3 / 2.0); // c1 *= m_alpha3 / 2.0;
302  m_proj->project(m_v1[idx1(mu, nu, rho)], m_alpha3, c1, m_U[mu]);
303  }
304  }
305  }
306 }
307 
308 
309 //====================================================================
311 {
312  Field_G c2(m_Nvol, 1), u_tmp(m_Nvol, 1);
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 
318  c2.set(0.0);
319 
320  for (int rho = 0; rho < m_Ndim; ++rho) {
321  if ((rho != mu) && (rho != nu)) {
322  staple(u_tmp,
323  m_v1[idx1(mu, nu, rho)], m_v1[idx1(rho, nu, mu)], mu, rho);
324  c2.addpart_ex(0, u_tmp, 0);
325  }
326  }
327  scal(c2, m_alpha2 / 4.0); // c2 *= m_alpha2 / 4.0;
328  m_proj->project(m_v2[idx2(mu, nu)], m_alpha2, c2, m_U[mu]);
329  }
330  }
331 }
332 
333 
334 //====================================================================
336  const Field_G& u_mu, const Field_G& u_nu,
337  int mu, int nu)
338 {
339  Field_G v1(m_Nvol, 1), v2(m_Nvol, 1);
340 
341  //- upper direction
342  m_shift.backward(v1, u_mu, nu);
343  mult_Field_Gnn(v2, 0, u_nu, 0, v1, 0);
344 
345  m_shift.backward(v1, u_nu, mu);
346  mult_Field_Gnd(c, 0, v2, 0, v1, 0);
347 
348  //- lower direction
349  m_shift.backward(v2, u_nu, mu);
350  mult_Field_Gnn(v1, 0, u_mu, 0, v2, 0);
351  mult_Field_Gdn(v2, 0, u_nu, 0, v1, 0);
352  m_shift.forward(v1, v2, nu);
353  c.addpart_ex(0, v1, 0);
354 }
355 
356 
357 //====================================================================
358 //============================================================END=====
Projection * m_proj
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
BridgeIO vout
Definition: bridgeIO.cpp:495
void set_parameters(const Parameters &params)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
int idx2(int mu, int nu)
void general(const char *format,...)
Definition: bridgeIO.cpp:195
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:211
int nvol() const
Definition: field.h:116
void mult_Field_Gdn(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_iTheta2
Class for parameters.
Definition: parameters.h:46
void force_each(Field_G &, const Field_G &, const Field_G &, const Field_G &, const Field_G &, int mu, int nu)
ShiftField_lex m_shift
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:193
void staple(Field_G &, const Field_G &, const Field_G &, int mu, int nu)
std::vector< Field_G > m_v2
Base class for force calculation of smeared operators.
Definition: forceSmear.h:34
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_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
void backward(Field &, const Field &, const int mu)
int nex() const
Definition: field.h:117
Recursive calculation of HYP smeared fermion force.
int idx1(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:168
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
int idx1b(int mu, int nu, int rho)
void force_udiv(Field_G &Sigma, const Field_G &Sigma_p, const Field_G &U)
base class for projection operator into gauge group.
Definition: projection.h:31
std::vector< Field_G > m_iTheta1
std::vector< Field_G > m_v1
virtual void project(Field_G &v, double alpha, const Field_G &C, const Field_G &U)=0
projection V = P[alpha, C, U]
std::vector< Field_G > m_Sigma2
void force_step1(Field_G &)
void force_step2(Field_G &)
std::vector< Field_G > m_iTheta3
string get_string(const string &key) const
Definition: parameters.cpp:116
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)