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