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