Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
topologicalCharge.cpp
Go to the documentation of this file.
1 
14 #include "topologicalCharge.h"
15 
16 const std::string TopologicalCharge::class_name = "TopologicalCharge";
17 
18 //====================================================================
20 {
21  m_filename_output = params.get_string("filename_output");
22  if (m_filename_output.empty()) {
23  m_filename_output = "stdout";
24  }
25 
26  const string str_vlevel = params.get_string("verbose_level");
27  m_vl = vout.set_verbose_level(str_vlevel);
28 
29  //- fetch and check input parameters
30  double c_plaq, c_rect;
31  int max_mom;
32 
33  int err = 0;
34  err += params.fetch_double("c_plaq", c_plaq);
35  err += params.fetch_double("c_rect", c_rect);
36  err += params.fetch_int("max_momentum", max_mom);
37 
38  if (err) {
39  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
40  exit(EXIT_FAILURE);
41  }
42 
43 
44  set_parameters(c_plaq, c_rect, max_mom);
45 }
46 
47 
48 //====================================================================
49 void TopologicalCharge::set_parameters(const double c_plaq, const double c_rect, const int max_mom)
50 {
51  //- print input parameters
52  vout.general(m_vl, "Topological Charge measurement:\n");
53  vout.general(m_vl, " c_plaq = %12.6f\n", c_plaq);
54  vout.general(m_vl, " c_rect = %12.6f\n", c_rect);
55  vout.general(m_vl, " max_momentum = %d\n", max_mom);
56 
57  //- range check
58  // NB. beta,c_plaq,c_rect == 0 is allowed.
59 
60  //- store values
61  m_c_plaq = c_plaq;
62  m_c_rect = c_rect;
63  m_max_mom = max_mom;
64 }
65 
66 
67 //====================================================================
69 {
70  const int Ndim = CommonParameters::Ndim();
71 
72  static const double eps = CommonParameters::epsilon_criterion();
73  static const double PI = 4.0 * atan(1.0);
74  static const double PI2 = PI * PI;
75 
76 
77  //--- 1x1 part ---
78  double Q_1x1 = 0.0;
79 
80  {
81  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
82  std::vector<Field_G> Fmunu_1x1(6);
83 
84  int i_munu = 0;
85  for (int mu = 0; mu < Ndim; ++mu) {
86  for (int nu = mu + 1; nu < Ndim; ++nu) {
87  m_field_strength.construct_Fmunu_1x1(Fmunu_1x1[i_munu], mu, nu, U);
88 
89  ++i_munu;
90  }
91  }
92 
93  // (mu,nu, rho,sigma) = (1,2, 3,4)
94  Q_1x1 += m_field_strength.contract(Fmunu_1x1[0], Fmunu_1x1[5]);
95 
96  // (mu,nu, rho,sigma) = (1,3, 2,4)
97  Q_1x1 -= m_field_strength.contract(Fmunu_1x1[1], Fmunu_1x1[4]);
98 
99  // (mu,nu, rho,sigma) = (1,4, 2,3)
100  Q_1x1 += m_field_strength.contract(Fmunu_1x1[2], Fmunu_1x1[3]);
101 
102  // #degeneracy of (mu,nu, rho,sigma) is 8
103  Q_1x1 *= 8.0;
104 
105  // overall factor
106  Q_1x1 /= (32.0 * PI2);
107  }
108  //----------------
109 
110 
111  //--- 1x2 part ---
112  double Q_1x2 = 0.0;
113 
114  {
115  // NB. skip this part, if m_c_rect = 0.0
116  if (fabs(m_c_rect) > eps) {
117  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
118  std::vector<Field_G> Fmunu_1x2(6);
119 
120  int i_munu = 0;
121  for (int mu = 0; mu < Ndim; ++mu) {
122  for (int nu = mu + 1; nu < Ndim; ++nu) {
123  m_field_strength.construct_Fmunu_1x2(Fmunu_1x2[i_munu], mu, nu, U);
124 
125  ++i_munu;
126  }
127  }
128 
129  Q_1x2 += m_field_strength.contract(Fmunu_1x2[0], Fmunu_1x2[5]);
130  Q_1x2 -= m_field_strength.contract(Fmunu_1x2[1], Fmunu_1x2[4]);
131  Q_1x2 += m_field_strength.contract(Fmunu_1x2[2], Fmunu_1x2[3]);
132  Q_1x2 *= 8.0;
133  // extra factor "2" for 1x2
134  Q_1x2 *= 2.0;
135  Q_1x2 /= (32.0 * PI2);
136  }
137  }
138  //----------------
139 
140 
141  const double Q_topo = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
142 
143 
144  //- output
145  std::ostream& log_file_previous = vout.getStream();
146  std::ofstream log_file;
147 
148  if (m_filename_output != "stdout") {
149  log_file.open(m_filename_output.c_str(), std::ios::app);
150  vout.init(log_file);
151  }
152 
153  vout.general(m_vl, " Q_1x1 = %20.16e\n", Q_1x1);
154  if (fabs(m_c_rect) > eps) {
155  vout.general(m_vl, " Q_1x2 = %20.16e\n", Q_1x2);
156  }
157  vout.general(m_vl, " Q_topo = %20.16e\n", Q_topo);
158 
159  if (m_filename_output != "stdout") {
160  log_file.close();
161  vout.init(log_file_previous);
162  }
163 
164 
165  return Q_topo;
166 }
167 
168 
169 //====================================================================
171 {
172  assert(m_flag_field_set == true);
173 
174  static const double PI = 4.0 * atan(1.0);
175  static const double PI2 = PI * PI;
176  // #degeneracy of (mu,nu, rho,sigma) is 8
177  static const double factor1 = 8.0 / (32.0 * PI2);
178  // extra factor "2" for 1x2
179  static const double factor2 = 16.0 / (32.0 * PI2);
180 
181  //--- Field strength by one plaquette ---
182  double Q_plaq = 0.0;
183 
187  Q_plaq *= factor1;
188 
189  //--- 1x1 part ---
190  double Q_1x1 = 0.0;
191 
192  // (mu,nu, rho,sigma) = (1,2, 3,4)
194  // (mu,nu, rho,sigma) = (1,3, 2,4)
196  // (mu,nu, rho,sigma) = (1,4, 2,3)
198  Q_1x1 *= factor1;
199  //----------------
200 
201  //--- 1x2 part ---
202  double Q_1x2 = 0.0;
203 
207  Q_1x2 *= factor2;
208  //----------------
209 
210  m_c_rect = -1.0 / 12.0;
211  m_c_plaq = 1.0 - 8 * m_c_rect;
212  const double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
213 
214  m_c_rect = 1.0 / 8.0;
215  const double Q_rect = m_c_rect * Q_1x2;
216 
217  //- output
218  std::ostream& log_file_previous = vout.getStream();
219  std::ofstream log_file;
220 
221  if (m_filename_output != "stdout") {
222  log_file.open(m_filename_output.c_str(), std::ios::app);
223  vout.init(log_file);
224  }
225 
226  vout.general(m_vl, " Q_clover_plaq = %.8f %.16e\n", tt, Q_1x1);
227  vout.general(m_vl, " Q_clover_rect = %.8f %.16e\n", tt, Q_rect);
228  vout.general(m_vl, " Q_clover_imp = %.8f %.16e\n", tt, Q_imp);
229  vout.general(m_vl, " Q_plaq = %.8f %.16e\n", tt, Q_plaq);
230 
231  if (m_filename_output != "stdout") {
232  log_file.close();
233  vout.init(log_file_previous);
234  }
235 }
236 
237 
238 //====================================================================
240 {
241  assert(m_flag_field_set == true);
242 
243  static const double PI = 4.0 * atan(1.0);
244  static const double PI2 = PI * PI;
245  static const double factor1 = 8.0 / (32.0 * PI2);
246  static const double factor2 = 16.0 / (32.0 * PI2);
247 
248  static const double l_c_rect = 1.0 / 8.0;
249  m_c_rect = -1.0 / 12.0;
250  m_c_plaq = 1.0 - 8 * m_c_rect;
251 
252  const int Lt = CommonParameters::Lt();
253 
254  std::vector<double> corr_scr(Lt);
255 
256  //--- Field strength by one plaquette ---
257  std::vector<double> corr_plaq(Lt, 0.0);
258 
260  for (int t = 0; t < Lt; ++t) {
261  corr_plaq[t] += corr_scr[t];
262  }
264  for (int t = 0; t < Lt; ++t) {
265  corr_plaq[t] -= corr_scr[t];
266  }
268  for (int t = 0; t < Lt; ++t) {
269  corr_plaq[t] += corr_scr[t];
270  }
271  // double Q_plaq = 0.0;
272  for (int t = 0; t < Lt; ++t) {
273  corr_plaq[t] *= factor1;
274  // Q_plaq += corr_plaq[t];
275  }
276 
277  //--- 1x1 part ---
278  std::vector<double> corr_1x1(Lt, 0.0);
279 
280  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
281  // (mu,nu, rho,sigma) = (1,2, 3,4)
283  for (int t = 0; t < Lt; ++t) {
284  corr_1x1[t] += corr_scr[t];
285  }
286  // (mu,nu, rho,sigma) = (1,3, 2,4)
288  for (int t = 0; t < Lt; ++t) {
289  corr_1x1[t] -= corr_scr[t];
290  }
291  // (mu,nu, rho,sigma) = (1,4, 2,3)
293  for (int t = 0; t < Lt; ++t) {
294  corr_1x1[t] += corr_scr[t];
295  }
296  // double Q_1x1 = 0.0;
297  for (int t = 0; t < Lt; ++t) {
298  corr_1x1[t] *= factor1;
299  // Q_1x1 += corr_1x1[t];
300  }
301 
302  //--- 1x2 part ---
303  std::vector<double> corr_1x2(Lt, 0.0);
304 
305  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
307  for (int t = 0; t < Lt; ++t) {
308  corr_1x2[t] += corr_scr[t];
309  }
311  for (int t = 0; t < Lt; ++t) {
312  corr_1x2[t] -= corr_scr[t];
313  }
315  for (int t = 0; t < Lt; ++t) {
316  corr_1x2[t] += corr_scr[t];
317  }
318  // double Q_1x2 = 0.0;
319  for (int t = 0; t < Lt; ++t) {
320  corr_1x2[t] *= factor2;
321  // Q_1x2 += corr_1x2[t];
322  }
323  //----------------
324 
325  //- output
326  std::ostream& log_file_previous = vout.getStream();
327  std::ofstream log_file;
328 
329  if (m_filename_output != "stdout") {
330  log_file.open(m_filename_output.c_str(), std::ios::app);
331  vout.init(log_file);
332  }
333 
334  for (int t = 0; t < Lt; ++t) {
335  vout.general(m_vl, " Q_clover_plaq_t = %.8f %d %.16e\n", tt, t, corr_1x1[t]);
336 
337  double scr = m_c_plaq * corr_1x1[t] + m_c_rect * corr_1x2[t];
338  vout.general(m_vl, " Q_clover_imp_t = %.8f %d %.16e\n", tt, t, scr);
339 
340  scr = l_c_rect * corr_1x2[t];
341  vout.general(m_vl, " Q_clover_rect_t = %.8f %d %.16e\n", tt, t, scr);
342  vout.general(m_vl, " Q_plaq_t = %.8f %d %.16e\n", tt, t, corr_plaq[t]);
343  }
344 
345  /*
346  vout.general(m_vl, " Q_clover_plaq_sumt = %.8f %.16e\n", tt, Q_1x1);
347  const double Q_rect = l_c_rect * Q_1x2;
348  vout.general(m_vl, " Q_clover_rect_sumt = %.8f %.16e\n", tt, Q_rect);
349  const double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
350  vout.general(m_vl, " Q_clover_imp_sumt = %.8f %.16e\n", tt, Q_imp);
351  vout.general(m_vl, " Q_plaq_sumt = %.8f %.16e\n", tt, Q_plaq);
352  */
353  if (m_filename_output != "stdout") {
354  log_file.close();
355  vout.init(log_file_previous);
356  }
357 }
358 
359 
360 //====================================================================
362 {
363  assert(m_flag_field_set == 1);
364  static const double PI = 4.0 * atan(1.0);
365  static const double PI2 = PI * PI;
366  static const double factor1 = 8.0 / (32.0 * PI2);
367  static const double factor2 = 16.0 / (32.0 * PI2);
368  static const double l_c_rect = 1.0 / 8.0;
369  m_c_rect = -1.0 / 12.0;
370  m_c_plaq = 1.0 - 8 * m_c_rect;
371 
372  const int Lt = CommonParameters::Lt();
373 
374  const int Np = (2 * m_max_mom + 1);
375  vector<int> source_position(4, 0);
376  vector<int> momentum_sink(3);
377 
378  for (int ipx = 0; ipx < m_max_mom + 1; ipx++) {
379  for (int ipy = 0; ipy < Np; ipy++) {
380  for (int ipz = 0; ipz < Np; ipz++) {
381  momentum_sink[0] = ipx;
382  momentum_sink[1] = ipy - m_max_mom;
383  momentum_sink[2] = ipz - m_max_mom;
384 
385  std::vector<double> corr_plaq(Lt, 0);
386  std::vector<double> corr_1x1(Lt, 0);
387  std::vector<double> corr_1x2(Lt, 0);
388  std::vector<double> corr_scr(Lt);
389 
390  //--- Field strength by one plaquette ---
391  m_field_strength.contract_at_t(corr_scr, m_Fmunu_plaq[0], m_Fmunu_plaq[5], momentum_sink, source_position);
392  for (int t = 0; t < Lt; ++t) {
393  corr_plaq[t] += corr_scr[t];
394  }
395  m_field_strength.contract_at_t(corr_scr, m_Fmunu_plaq[1], m_Fmunu_plaq[4], momentum_sink, source_position);
396  for (int t = 0; t < Lt; ++t) {
397  corr_plaq[t] -= corr_scr[t];
398  }
399  m_field_strength.contract_at_t(corr_scr, m_Fmunu_plaq[2], m_Fmunu_plaq[3], momentum_sink, source_position);
400  for (int t = 0; t < Lt; ++t) {
401  corr_plaq[t] += corr_scr[t];
402  }
403  // double Q_plaq = 0.0;
404  for (int t = 0; t < Lt; ++t) {
405  corr_plaq[t] *= factor1;
406  // Q_plaq += corr_plaq[t];
407  }
408 
409  //--- 1x1 part ---
410  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
411  // (mu,nu, rho,sigma) = (1,2, 3,4)
412  m_field_strength.contract_at_t(corr_scr, m_Fmunu_1x1[0], m_Fmunu_1x1[5], momentum_sink, source_position);
413  for (int t = 0; t < Lt; ++t) {
414  corr_1x1[t] += corr_scr[t];
415  }
416  // (mu,nu, rho,sigma) = (1,3, 2,4)
417  m_field_strength.contract_at_t(corr_scr, m_Fmunu_1x1[1], m_Fmunu_1x1[4], momentum_sink, source_position);
418  for (int t = 0; t < Lt; ++t) {
419  corr_1x1[t] -= corr_scr[t];
420  }
421  // (mu,nu, rho,sigma) = (1,4, 2,3)
422  m_field_strength.contract_at_t(corr_scr, m_Fmunu_1x1[2], m_Fmunu_1x1[3], momentum_sink, source_position);
423  for (int t = 0; t < Lt; ++t) {
424  corr_1x1[t] += corr_scr[t];
425  }
426  // double Q_1x1 = 0.0;
427  for (int t = 0; t < Lt; ++t) {
428  corr_1x1[t] *= factor1;
429  // Q_1x1 += corr_1x1[t];
430  }
431 
432  //--- 1x2 part ---
433  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
434  m_field_strength.contract_at_t(corr_scr, m_Fmunu_1x2[0], m_Fmunu_1x2[5], momentum_sink, source_position);
435  for (int t = 0; t < Lt; ++t) {
436  corr_1x2[t] += corr_scr[t];
437  }
438  m_field_strength.contract_at_t(corr_scr, m_Fmunu_1x2[1], m_Fmunu_1x2[4], momentum_sink, source_position);
439  for (int t = 0; t < Lt; ++t) {
440  corr_1x2[t] -= corr_scr[t];
441  }
442  m_field_strength.contract_at_t(corr_scr, m_Fmunu_1x2[2], m_Fmunu_1x2[3], momentum_sink, source_position);
443  for (int t = 0; t < Lt; ++t) {
444  corr_1x2[t] += corr_scr[t];
445  }
446  // double Q_1x2 = 0.0;
447  for (int t = 0; t < Lt; ++t) {
448  corr_1x2[t] *= factor2;
449  // Q_1x2 += corr_1x2[t];
450  }
451  //----------------
452 
453  //- output
454  std::ostream& log_file_previous = vout.getStream();
455  std::ofstream log_file;
456 
457  if (m_filename_output != "stdout") {
458  log_file.open(m_filename_output.c_str(), std::ios::app);
459  vout.init(log_file);
460  }
461 
462  for (int t = 0; t < Lt; ++t) {
463  vout.general(m_vl, " Q_clover_plaq_t_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_1x1[t]);
464  double scr = m_c_plaq * corr_1x1[t] + m_c_rect * corr_1x2[t];
465  vout.general(m_vl, " Q_clover_imp_t_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
466  scr = l_c_rect * corr_1x2[t];
467  vout.general(m_vl, " Q_clover_rect_t_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
468  vout.general(m_vl, " Q_plaq_t_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_plaq[t]);
469  }
470 
471  /*
472  vout.general(m_vl, " Q_clover_plaq_sumt_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_1x1);
473  double Q_rect = l_c_rect * Q_1x2;
474  vout.general(m_vl, " Q_clover_rect_sumt_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_rect);
475  double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
476  vout.general(m_vl, " Q_clover_imp_sumt_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_imp);
477  vout.general(m_vl, " Q_plaq_sumt = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_plaq);
478  */
479 
480  if (m_filename_output != "stdout") {
481  log_file.close();
482  vout.init(log_file_previous);
483  }
484  }
485  }
486  }
487 }
488 
489 
490 //====================================================================
492 {
493  assert(m_flag_field_set == true);
494 
495  static const double PI = 4.0 * atan(1.0);
496  static const double PI2 = PI * PI;
497  static const double factor1 = 8.0 / (32.0 * PI2);
498  static const double factor2 = 16.0 / (32.0 * PI2);
499 
500  static const double l_c_rect = 1.0 / 8.0;
501  m_c_rect = -1.0 / 12.0;
502  m_c_plaq = 1.0 - 8 * m_c_rect;
503 
504  const int Lx = CommonParameters::Lx();
505 
506  std::vector<double> corr_scr(Lx);
507 
508  //--- Field strength by one plaquette ---
509  std::vector<double> corr_plaq(Lx, 0.0);
510 
512  for (int x = 0; x < Lx; ++x) {
513  corr_plaq[x] += corr_scr[x];
514  }
516  for (int x = 0; x < Lx; ++x) {
517  corr_plaq[x] -= corr_scr[x];
518  }
520  for (int x = 0; x < Lx; ++x) {
521  corr_plaq[x] += corr_scr[x];
522  }
523  // double Q_plaq = 0.0;
524  for (int x = 0; x < Lx; ++x) {
525  corr_plaq[x] *= factor1;
526  // Q_plaq += corr_plaq[x];
527  }
528 
529  //--- 1x1 part ---
530  std::vector<double> corr_1x1(Lx, 0.0);
531 
532  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
533  // (mu,nu, rho,sigma) = (1,2, 3,4)
535  for (int x = 0; x < Lx; ++x) {
536  corr_1x1[x] += corr_scr[x];
537  }
538  // (mu,nu, rho,sigma) = (1,3, 2,4)
540  for (int x = 0; x < Lx; ++x) {
541  corr_1x1[x] -= corr_scr[x];
542  }
543  // (mu,nu, rho,sigma) = (1,4, 2,3)
545  for (int x = 0; x < Lx; ++x) {
546  corr_1x1[x] += corr_scr[x];
547  }
548  // double Q_1x1 = 0.0;
549  for (int x = 0; x < Lx; ++x) {
550  corr_1x1[x] *= factor1;
551  // Q_1x1 += corr_1x1[x];
552  }
553 
554  //--- 1x2 part ---
555  std::vector<double> corr_1x2(Lx, 0.0);
556 
557  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
559  for (int x = 0; x < Lx; ++x) {
560  corr_1x2[x] += corr_scr[x];
561  }
563  for (int x = 0; x < Lx; ++x) {
564  corr_1x2[x] -= corr_scr[x];
565  }
567  for (int x = 0; x < Lx; ++x) {
568  corr_1x2[x] += corr_scr[x];
569  }
570  // double Q_1x2 = 0.0;
571  for (int x = 0; x < Lx; ++x) {
572  corr_1x2[x] *= factor2;
573  // Q_1x2 += corr_1x2[x];
574  }
575  //----------------
576 
577  //- output
578  std::ostream& log_file_previous = vout.getStream();
579  std::ofstream log_file;
580 
581  if (m_filename_output != "stdout") {
582  log_file.open(m_filename_output.c_str(), std::ios::app);
583  vout.init(log_file);
584  }
585 
586  for (int x = 0; x < Lx; ++x) {
587  vout.general(m_vl, " Q_clover_plaq_x = %.8f %d %.16e\n", tt, x, corr_1x1[x]);
588 
589  double scr = m_c_plaq * corr_1x1[x] + m_c_rect * corr_1x2[x];
590  vout.general(m_vl, " Q_clover_imp_x = %.8f %d %.16e\n", tt, x, scr);
591 
592  scr = l_c_rect * corr_1x2[x];
593  vout.general(m_vl, " Q_clover_rect_x = %.8f %d %.16e\n", tt, x, scr);
594  vout.general(m_vl, " Q_plaq_x = %.8f %d %.16e\n", tt, x, corr_plaq[x]);
595  }
596 
597  /*
598  vout.general(m_vl, " Q_clover_plaq_sumx = %.8f %.16e\n", tt, Q_1x1);
599  const double Q_rect = l_c_rect * Q_1x2;
600  vout.general(m_vl, " Q_clover_rect_sumx = %.8f %.16e\n", tt, Q_rect);
601  const double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
602  vout.general(m_vl, " Q_clover_imp_sumx = %.8f %.16e\n", tt, Q_imp);
603  vout.general(m_vl, " Q_plaq_sumx = %.8f %.16e\n", tt, Q_plaq);
604  */
605 
606  if (m_filename_output != "stdout") {
607  log_file.close();
608  vout.init(log_file_previous);
609  }
610 }
611 
612 
613 //====================================================================
615 {
616  assert(m_flag_field_set == 1);
617  static const double PI = 4.0 * atan(1.0);
618  static const double PI2 = PI * PI;
619  static const double factor1 = 8.0 / (32.0 * PI2);
620  static const double factor2 = 16.0 / (32.0 * PI2);
621  static const double l_c_rect = 1.0 / 8.0;
622  m_c_rect = -1.0 / 12.0;
623  m_c_plaq = 1.0 - 8 * m_c_rect;
624 
625  const int Lx = CommonParameters::Lx();
626 
627  const int Np = (2 * m_max_mom + 1);
628  vector<int> source_position(4, 0);
629  vector<int> momentum_sink(3);
630 
631  for (int ipx = 0; ipx < m_max_mom + 1; ipx++) {
632  for (int ipy = 0; ipy < Np; ipy++) {
633  for (int ipz = 0; ipz < Np; ipz++) {
634  momentum_sink[0] = ipx;
635  momentum_sink[1] = ipy - m_max_mom;
636  momentum_sink[2] = ipz - m_max_mom;
637 
638  std::vector<double> corr_plaq(Lx, 0);
639  std::vector<double> corr_1x1(Lx, 0);
640  std::vector<double> corr_1x2(Lx, 0);
641  std::vector<double> corr_scr(Lx);
642 
643  //--- Field strength by one plaquette ---
644  m_field_strength.contract_at_x(corr_scr, m_Fmunu_plaq[0], m_Fmunu_plaq[5], momentum_sink, source_position);
645  for (int t = 0; t < Lx; ++t) {
646  corr_plaq[t] += corr_scr[t];
647  }
648  m_field_strength.contract_at_x(corr_scr, m_Fmunu_plaq[1], m_Fmunu_plaq[4], momentum_sink, source_position);
649  for (int t = 0; t < Lx; ++t) {
650  corr_plaq[t] -= corr_scr[t];
651  }
652  m_field_strength.contract_at_x(corr_scr, m_Fmunu_plaq[2], m_Fmunu_plaq[3], momentum_sink, source_position);
653  for (int t = 0; t < Lx; ++t) {
654  corr_plaq[t] += corr_scr[t];
655  }
656  // double Q_plaq = 0.0;
657  for (int t = 0; t < Lx; ++t) {
658  corr_plaq[t] *= factor1;
659  // Q_plaq += corr_plaq[t];
660  }
661 
662  //--- 1x1 part ---
663  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
664  // (mu,nu, rho,sigma) = (1,2, 3,4)
665  m_field_strength.contract_at_x(corr_scr, m_Fmunu_1x1[0], m_Fmunu_1x1[5], momentum_sink, source_position);
666  for (int t = 0; t < Lx; ++t) {
667  corr_1x1[t] += corr_scr[t];
668  }
669  // (mu,nu, rho,sigma) = (1,3, 2,4)
670  m_field_strength.contract_at_x(corr_scr, m_Fmunu_1x1[1], m_Fmunu_1x1[4], momentum_sink, source_position);
671  for (int t = 0; t < Lx; ++t) {
672  corr_1x1[t] -= corr_scr[t];
673  }
674  // (mu,nu, rho,sigma) = (1,4, 2,3)
675  m_field_strength.contract_at_x(corr_scr, m_Fmunu_1x1[2], m_Fmunu_1x1[3], momentum_sink, source_position);
676  for (int t = 0; t < Lx; ++t) {
677  corr_1x1[t] += corr_scr[t];
678  }
679  // double Q_1x1 = 0.0;
680  for (int t = 0; t < Lx; ++t) {
681  corr_1x1[t] *= factor1;
682  // Q_1x1 += corr_1x1[t];
683  }
684 
685  //--- 1x2 part ---
686  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
687  m_field_strength.contract_at_x(corr_scr, m_Fmunu_1x2[0], m_Fmunu_1x2[5], momentum_sink, source_position);
688  for (int t = 0; t < Lx; ++t) {
689  corr_1x2[t] += corr_scr[t];
690  }
691  m_field_strength.contract_at_x(corr_scr, m_Fmunu_1x2[1], m_Fmunu_1x2[4], momentum_sink, source_position);
692  for (int t = 0; t < Lx; ++t) {
693  corr_1x2[t] -= corr_scr[t];
694  }
695  m_field_strength.contract_at_x(corr_scr, m_Fmunu_1x2[2], m_Fmunu_1x2[3], momentum_sink, source_position);
696  for (int t = 0; t < Lx; ++t) {
697  corr_1x2[t] += corr_scr[t];
698  }
699  // double Q_1x2 = 0.0;
700  for (int t = 0; t < Lx; ++t) {
701  corr_1x2[t] *= factor2;
702  // Q_1x2 += corr_1x2[t];
703  }
704  //----------------
705 
706  //- output
707  std::ostream& log_file_previous = vout.getStream();
708  std::ofstream log_file;
709 
710  if (m_filename_output != "stdout") {
711  log_file.open(m_filename_output.c_str(), std::ios::app);
712  vout.init(log_file);
713  }
714 
715  for (int t = 0; t < Lx; ++t) {
716  vout.general(m_vl, " Q_clover_plaq_x_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_1x1[t]);
717  double scr = m_c_plaq * corr_1x1[t] + m_c_rect * corr_1x2[t];
718  vout.general(m_vl, " Q_clover_imp_x_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
719  scr = l_c_rect * corr_1x2[t];
720  vout.general(m_vl, " Q_clover_rect_x_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
721  vout.general(m_vl, " Q_plaq_x_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_plaq[t]);
722  }
723 
724  /*
725  vout.general(m_vl, " Q_clover_plaq_sumx_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_1x1);
726  double Q_rect = l_c_rect * Q_1x2;
727  vout.general(m_vl, " Q_clover_rect_sumx_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_rect);
728  double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
729  vout.general(m_vl, " Q_clover_imp_sumx_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_imp);
730  vout.general(m_vl, " Q_plaq_sumx = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_plaq);
731  */
732 
733  if (m_filename_output != "stdout") {
734  log_file.close();
735  vout.init(log_file_previous);
736  }
737  }
738  }
739  }
740 }
741 
742 
743 //====================================================================
745 {
746  assert(m_flag_field_set == true);
747 
748  static const double PI = 4.0 * atan(1.0);
749  static const double PI2 = PI * PI;
750  static const double factor1 = 8.0 / (32.0 * PI2);
751  static const double factor2 = 16.0 / (32.0 * PI2);
752 
753  static const double l_c_rect = 1.0 / 8.0;
754  m_c_rect = -1.0 / 12.0;
755  m_c_plaq = 1.0 - 8 * m_c_rect;
756 
757  const int Ly = CommonParameters::Ly();
758 
759  std::vector<double> corr_scr(Ly);
760 
761  //--- Field strength by one plaquette ---
762  std::vector<double> corr_plaq(Ly, 0.0);
763 
765  for (int y = 0; y < Ly; ++y) {
766  corr_plaq[y] += corr_scr[y];
767  }
769  for (int y = 0; y < Ly; ++y) {
770  corr_plaq[y] -= corr_scr[y];
771  }
773  for (int y = 0; y < Ly; ++y) {
774  corr_plaq[y] += corr_scr[y];
775  }
776  // double Q_plaq = 0.0;
777  for (int y = 0; y < Ly; ++y) {
778  corr_plaq[y] *= factor1;
779  // Q_plaq += corr_plaq[y];
780  }
781 
782  //--- 1x1 part ---
783  std::vector<double> corr_1x1(Ly, 0.0);
784 
785  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
786  // (mu,nu, rho,sigma) = (1,2, 3,4)
788  for (int y = 0; y < Ly; ++y) {
789  corr_1x1[y] += corr_scr[y];
790  }
791  // (mu,nu, rho,sigma) = (1,3, 2,4)
793  for (int y = 0; y < Ly; ++y) {
794  corr_1x1[y] -= corr_scr[y];
795  }
796  // (mu,nu, rho,sigma) = (1,4, 2,3)
798  for (int y = 0; y < Ly; ++y) {
799  corr_1x1[y] += corr_scr[y];
800  }
801  // double Q_1x1 = 0.0;
802  for (int y = 0; y < Ly; ++y) {
803  corr_1x1[y] *= factor1;
804  // Q_1x1 += corr_1x1[y];
805  }
806 
807  //--- 1x2 part ---
808  std::vector<double> corr_1x2(Ly, 0.0);
809 
810  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
812  for (int y = 0; y < Ly; ++y) {
813  corr_1x2[y] += corr_scr[y];
814  }
816  for (int y = 0; y < Ly; ++y) {
817  corr_1x2[y] -= corr_scr[y];
818  }
820  for (int y = 0; y < Ly; ++y) {
821  corr_1x2[y] += corr_scr[y];
822  }
823  // double Q_1x2 = 0.0;
824  for (int y = 0; y < Ly; ++y) {
825  corr_1x2[y] *= factor2;
826  // Q_1x2 += corr_1x2[y];
827  }
828  //----------------
829 
830  //- output
831  std::ostream& log_file_previous = vout.getStream();
832  std::ofstream log_file;
833 
834  if (m_filename_output != "stdout") {
835  log_file.open(m_filename_output.c_str(), std::ios::app);
836  vout.init(log_file);
837  }
838 
839  for (int y = 0; y < Ly; ++y) {
840  vout.general(m_vl, " Q_clover_plaq_y = %.8f %d %.16e\n", tt, y, corr_1x1[y]);
841 
842  double scr = m_c_plaq * corr_1x1[y] + m_c_rect * corr_1x2[y];
843  vout.general(m_vl, " Q_clover_imp_y = %.8f %d %.16e\n", tt, y, scr);
844 
845  scr = l_c_rect * corr_1x2[y];
846  vout.general(m_vl, " Q_clover_rect_y = %.8f %d %.16e\n", tt, y, scr);
847  vout.general(m_vl, " Q_plaq_y = %.8f %d %.16e\n", tt, y, corr_plaq[y]);
848  }
849 
850  /*
851  vout.general(m_vl, " Q_clover_plaq_sumy = %.8f %.16e\n", tt, Q_1x1);
852  const double Q_rect = l_c_rect * Q_1x2;
853  vout.general(m_vl, " Q_clover_rect_sumy = %.8f %.16e\n", tt, Q_rect);
854  const double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
855  vout.general(m_vl, " Q_clover_imp_sumy = %.8f %.16e\n", tt, Q_imp);
856  vout.general(m_vl, " Q_plaq_sumy = %.8f %.16e\n", tt, Q_plaq);
857  */
858 
859  if (m_filename_output != "stdout") {
860  log_file.close();
861  vout.init(log_file_previous);
862  }
863 }
864 
865 
866 //====================================================================
868 {
869  assert(m_flag_field_set == 1);
870  static const double PI = 4.0 * atan(1.0);
871  static const double PI2 = PI * PI;
872  static const double factor1 = 8.0 / (32.0 * PI2);
873  static const double factor2 = 16.0 / (32.0 * PI2);
874  static const double l_c_rect = 1.0 / 8.0;
875  m_c_rect = -1.0 / 12.0;
876  m_c_plaq = 1.0 - 8 * m_c_rect;
877 
878  const int Ly = CommonParameters::Ly();
879 
880  const int Np = (2 * m_max_mom + 1);
881  vector<int> source_position(4, 0);
882  vector<int> momentum_sink(3);
883 
884  for (int ipx = 0; ipx < m_max_mom + 1; ipx++) {
885  for (int ipy = 0; ipy < Np; ipy++) {
886  for (int ipz = 0; ipz < Np; ipz++) {
887  momentum_sink[0] = ipx;
888  momentum_sink[1] = ipy - m_max_mom;
889  momentum_sink[2] = ipz - m_max_mom;
890 
891  std::vector<double> corr_plaq(Ly, 0);
892  std::vector<double> corr_1x1(Ly, 0);
893  std::vector<double> corr_1x2(Ly, 0);
894  std::vector<double> corr_scr(Ly);
895 
896  //--- Field strength by one plaquette ---
897  m_field_strength.contract_at_y(corr_scr, m_Fmunu_plaq[0], m_Fmunu_plaq[5], momentum_sink, source_position);
898  for (int t = 0; t < Ly; ++t) {
899  corr_plaq[t] += corr_scr[t];
900  }
901  m_field_strength.contract_at_y(corr_scr, m_Fmunu_plaq[1], m_Fmunu_plaq[4], momentum_sink, source_position);
902  for (int t = 0; t < Ly; ++t) {
903  corr_plaq[t] -= corr_scr[t];
904  }
905  m_field_strength.contract_at_y(corr_scr, m_Fmunu_plaq[2], m_Fmunu_plaq[3], momentum_sink, source_position);
906  for (int t = 0; t < Ly; ++t) {
907  corr_plaq[t] += corr_scr[t];
908  }
909  // double Q_plaq = 0.0;
910  for (int t = 0; t < Ly; ++t) {
911  corr_plaq[t] *= factor1;
912  // Q_plaq += corr_plaq[t];
913  }
914 
915  //--- 1x1 part ---
916  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
917  // (mu,nu, rho,sigma) = (1,2, 3,4)
918  m_field_strength.contract_at_y(corr_scr, m_Fmunu_1x1[0], m_Fmunu_1x1[5], momentum_sink, source_position);
919  for (int t = 0; t < Ly; ++t) {
920  corr_1x1[t] += corr_scr[t];
921  }
922  // (mu,nu, rho,sigma) = (1,3, 2,4)
923  m_field_strength.contract_at_y(corr_scr, m_Fmunu_1x1[1], m_Fmunu_1x1[4], momentum_sink, source_position);
924  for (int t = 0; t < Ly; ++t) {
925  corr_1x1[t] -= corr_scr[t];
926  }
927  // (mu,nu, rho,sigma) = (1,4, 2,3)
928  m_field_strength.contract_at_y(corr_scr, m_Fmunu_1x1[2], m_Fmunu_1x1[3], momentum_sink, source_position);
929  for (int t = 0; t < Ly; ++t) {
930  corr_1x1[t] += corr_scr[t];
931  }
932  // double Q_1x1 = 0.0;
933  for (int t = 0; t < Ly; ++t) {
934  corr_1x1[t] *= factor1;
935  // Q_1x1 += corr_1x1[t];
936  }
937 
938  //--- 1x2 part ---
939  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
940  m_field_strength.contract_at_y(corr_scr, m_Fmunu_1x2[0], m_Fmunu_1x2[5], momentum_sink, source_position);
941  for (int t = 0; t < Ly; ++t) {
942  corr_1x2[t] += corr_scr[t];
943  }
944  m_field_strength.contract_at_y(corr_scr, m_Fmunu_1x2[1], m_Fmunu_1x2[4], momentum_sink, source_position);
945  for (int t = 0; t < Ly; ++t) {
946  corr_1x2[t] -= corr_scr[t];
947  }
948  m_field_strength.contract_at_y(corr_scr, m_Fmunu_1x2[2], m_Fmunu_1x2[3], momentum_sink, source_position);
949  for (int t = 0; t < Ly; ++t) {
950  corr_1x2[t] += corr_scr[t];
951  }
952  // double Q_1x2 = 0.0;
953  for (int t = 0; t < Ly; ++t) {
954  corr_1x2[t] *= factor2;
955  // Q_1x2 += corr_1x2[t];
956  }
957  //----------------
958 
959  //- output
960  std::ostream& log_file_previous = vout.getStream();
961  std::ofstream log_file;
962 
963  if (m_filename_output != "stdout") {
964  log_file.open(m_filename_output.c_str(), std::ios::app);
965  vout.init(log_file);
966  }
967 
968  for (int t = 0; t < Ly; ++t) {
969  vout.general(m_vl, " Q_clover_plaq_y_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_1x1[t]);
970  double scr = m_c_plaq * corr_1x1[t] + m_c_rect * corr_1x2[t];
971  vout.general(m_vl, " Q_clover_imp_y_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
972  scr = l_c_rect * corr_1x2[t];
973  vout.general(m_vl, " Q_clover_rect_y_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
974  vout.general(m_vl, " Q_plaq_y_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_plaq[t]);
975  }
976 
977  /*
978  vout.general(m_vl, " Q_clover_plaq_sumy_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_1x1);
979  double Q_rect = l_c_rect * Q_1x2;
980  vout.general(m_vl, " Q_clover_rect_sumy_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_rect);
981  double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
982  vout.general(m_vl, " Q_clover_imp_sumy_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_imp);
983  vout.general(m_vl, " Q_plaq_sumy = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_plaq);
984  */
985 
986  if (m_filename_output != "stdout") {
987  log_file.close();
988  vout.init(log_file_previous);
989  }
990  }
991  }
992  }
993 }
994 
995 
996 //====================================================================
998 {
999  assert(m_flag_field_set == true);
1000 
1001  static const double PI = 4.0 * atan(1.0);
1002  static const double PI2 = PI * PI;
1003  static const double factor1 = 8.0 / (32.0 * PI2);
1004  static const double factor2 = 16.0 / (32.0 * PI2);
1005 
1006  static const double l_c_rect = 1.0 / 8.0;
1007  m_c_rect = -1.0 / 12.0;
1008  m_c_plaq = 1.0 - 8 * m_c_rect;
1009 
1010  const int Lz = CommonParameters::Lz();
1011 
1012  std::vector<double> corr_scr(Lz);
1013 
1014  //--- Field strength by one plaquette ---
1015  std::vector<double> corr_plaq(Lz, 0.0);
1016 
1018  for (int z = 0; z < Lz; ++z) {
1019  corr_plaq[z] += corr_scr[z];
1020  }
1022  for (int z = 0; z < Lz; ++z) {
1023  corr_plaq[z] -= corr_scr[z];
1024  }
1026  for (int z = 0; z < Lz; ++z) {
1027  corr_plaq[z] += corr_scr[z];
1028  }
1029  // double Q_plaq = 0.0;
1030  for (int z = 0; z < Lz; ++z) {
1031  corr_plaq[z] *= factor1;
1032  // Q_plaq += corr_plaq[z];
1033  }
1034 
1035  //--- 1x1 part ---
1036  std::vector<double> corr_1x1(Lz, 0.0);
1037 
1038  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
1039  // (mu,nu, rho,sigma) = (1,2, 3,4)
1041  for (int z = 0; z < Lz; ++z) {
1042  corr_1x1[z] += corr_scr[z];
1043  }
1044  // (mu,nu, rho,sigma) = (1,3, 2,4)
1046  for (int z = 0; z < Lz; ++z) {
1047  corr_1x1[z] -= corr_scr[z];
1048  }
1049  // (mu,nu, rho,sigma) = (1,4, 2,3)
1051  for (int z = 0; z < Lz; ++z) {
1052  corr_1x1[z] += corr_scr[z];
1053  }
1054  // double Q_1x1 = 0.0;
1055  for (int z = 0; z < Lz; ++z) {
1056  corr_1x1[z] *= factor1;
1057  // Q_1x1 += corr_1x1[z];
1058  }
1059 
1060  //--- 1x2 part ---
1061  std::vector<double> corr_1x2(Lz, 0.0);
1062 
1063  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
1065  for (int z = 0; z < Lz; ++z) {
1066  corr_1x2[z] += corr_scr[z];
1067  }
1069  for (int z = 0; z < Lz; ++z) {
1070  corr_1x2[z] -= corr_scr[z];
1071  }
1073  for (int z = 0; z < Lz; ++z) {
1074  corr_1x2[z] += corr_scr[z];
1075  }
1076  // double Q_1x2 = 0.0;
1077  for (int z = 0; z < Lz; ++z) {
1078  corr_1x2[z] *= factor2;
1079  // Q_1x2 += corr_1x2[z];
1080  }
1081  //----------------
1082 
1083  //- output
1084  std::ostream& log_file_previous = vout.getStream();
1085  std::ofstream log_file;
1086 
1087  if (m_filename_output != "stdout") {
1088  log_file.open(m_filename_output.c_str(), std::ios::app);
1089  vout.init(log_file);
1090  }
1091 
1092  for (int z = 0; z < Lz; ++z) {
1093  vout.general(m_vl, " Q_clover_plaq_z = %.8f %d %.16e\n", tt, z, corr_1x1[z]);
1094 
1095  double scr = m_c_plaq * corr_1x1[z] + m_c_rect * corr_1x2[z];
1096  vout.general(m_vl, " Q_clover_imp_z = %.8f %d %.16e\n", tt, z, scr);
1097 
1098  scr = l_c_rect * corr_1x2[z];
1099  vout.general(m_vl, " Q_clover_rect_z = %.8f %d %.16e\n", tt, z, scr);
1100  vout.general(m_vl, " Q_plaq_z = %.8f %d %.16e\n", tt, z, corr_plaq[z]);
1101  }
1102 
1103  /*
1104  vout.general(m_vl, " Q_clover_plaq_sumz = %.8f %.16e\n", tt, Q_1x1);
1105  const double Q_rect = l_c_rect * Q_1x2;
1106  vout.general(m_vl, " Q_clover_rect_sumz = %.8f %.16e\n", tt, Q_rect);
1107  const double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
1108  vout.general(m_vl, " Q_clover_imp_sumz = %.8f %.16e\n", tt, Q_imp);
1109  vout.general(m_vl, " Q_plaq_sumz = %.8f %.16e\n", tt, Q_plaq);
1110  */
1111 
1112  if (m_filename_output != "stdout") {
1113  log_file.close();
1114  vout.init(log_file_previous);
1115  }
1116 }
1117 
1118 
1119 //====================================================================
1121 {
1122  assert(m_flag_field_set == 1);
1123  static const double PI = 4.0 * atan(1.0);
1124  static const double PI2 = PI * PI;
1125  static const double factor1 = 8.0 / (32.0 * PI2);
1126  static const double factor2 = 16.0 / (32.0 * PI2);
1127  static const double l_c_rect = 1.0 / 8.0;
1128  m_c_rect = -1.0 / 12.0;
1129  m_c_plaq = 1.0 - 8 * m_c_rect;
1130 
1131  const int Lz = CommonParameters::Lz();
1132 
1133  const int Np = (2 * m_max_mom + 1);
1134  vector<int> source_position(4, 0);
1135  vector<int> momentum_sink(3);
1136 
1137  for (int ipx = 0; ipx < m_max_mom + 1; ipx++) {
1138  for (int ipy = 0; ipy < Np; ipy++) {
1139  for (int ipz = 0; ipz < Np; ipz++) {
1140  momentum_sink[0] = ipx;
1141  momentum_sink[1] = ipy - m_max_mom;
1142  momentum_sink[2] = ipz - m_max_mom;
1143 
1144  std::vector<double> corr_plaq(Lz, 0);
1145  std::vector<double> corr_1x1(Lz, 0);
1146  std::vector<double> corr_1x2(Lz, 0);
1147  std::vector<double> corr_scr(Lz);
1148 
1149  //--- Field strength by one plaquette ---
1150  m_field_strength.contract_at_z(corr_scr, m_Fmunu_plaq[0], m_Fmunu_plaq[5], momentum_sink, source_position);
1151  for (int t = 0; t < Lz; ++t) {
1152  corr_plaq[t] += corr_scr[t];
1153  }
1154  m_field_strength.contract_at_z(corr_scr, m_Fmunu_plaq[1], m_Fmunu_plaq[4], momentum_sink, source_position);
1155  for (int t = 0; t < Lz; ++t) {
1156  corr_plaq[t] -= corr_scr[t];
1157  }
1158  m_field_strength.contract_at_z(corr_scr, m_Fmunu_plaq[2], m_Fmunu_plaq[3], momentum_sink, source_position);
1159  for (int t = 0; t < Lz; ++t) {
1160  corr_plaq[t] += corr_scr[t];
1161  }
1162  // double Q_plaq = 0.0;
1163  for (int t = 0; t < Lz; ++t) {
1164  corr_plaq[t] *= factor1;
1165  // Q_plaq += corr_plaq[t];
1166  }
1167 
1168  //--- 1x1 part ---
1169  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
1170  // (mu,nu, rho,sigma) = (1,2, 3,4)
1171  m_field_strength.contract_at_z(corr_scr, m_Fmunu_1x1[0], m_Fmunu_1x1[5], momentum_sink, source_position);
1172  for (int t = 0; t < Lz; ++t) {
1173  corr_1x1[t] += corr_scr[t];
1174  }
1175  // (mu,nu, rho,sigma) = (1,3, 2,4)
1176  m_field_strength.contract_at_z(corr_scr, m_Fmunu_1x1[1], m_Fmunu_1x1[4], momentum_sink, source_position);
1177  for (int t = 0; t < Lz; ++t) {
1178  corr_1x1[t] -= corr_scr[t];
1179  }
1180  // (mu,nu, rho,sigma) = (1,4, 2,3)
1181  m_field_strength.contract_at_z(corr_scr, m_Fmunu_1x1[2], m_Fmunu_1x1[3], momentum_sink, source_position);
1182  for (int t = 0; t < Lz; ++t) {
1183  corr_1x1[t] += corr_scr[t];
1184  }
1185  // double Q_1x1 = 0.0;
1186  for (int t = 0; t < Lz; ++t) {
1187  corr_1x1[t] *= factor1;
1188  // Q_1x1 += corr_1x1[t];
1189  }
1190 
1191  //--- 1x2 part ---
1192  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
1193  m_field_strength.contract_at_z(corr_scr, m_Fmunu_1x2[0], m_Fmunu_1x2[5], momentum_sink, source_position);
1194  for (int t = 0; t < Lz; ++t) {
1195  corr_1x2[t] += corr_scr[t];
1196  }
1197  m_field_strength.contract_at_z(corr_scr, m_Fmunu_1x2[1], m_Fmunu_1x2[4], momentum_sink, source_position);
1198  for (int t = 0; t < Lz; ++t) {
1199  corr_1x2[t] -= corr_scr[t];
1200  }
1201  m_field_strength.contract_at_z(corr_scr, m_Fmunu_1x2[2], m_Fmunu_1x2[3], momentum_sink, source_position);
1202  for (int t = 0; t < Lz; ++t) {
1203  corr_1x2[t] += corr_scr[t];
1204  }
1205  // double Q_1x2 = 0.0;
1206  for (int t = 0; t < Lz; ++t) {
1207  corr_1x2[t] *= factor2;
1208  // Q_1x2 += corr_1x2[t];
1209  }
1210  //----------------
1211 
1212  //- output
1213  std::ostream& log_file_previous = vout.getStream();
1214  std::ofstream log_file;
1215 
1216  if (m_filename_output != "stdout") {
1217  log_file.open(m_filename_output.c_str(), std::ios::app);
1218  vout.init(log_file);
1219  }
1220 
1221  for (int t = 0; t < Lz; ++t) {
1222  vout.general(m_vl, " Q_clover_plaq_z_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_1x1[t]);
1223  double scr = m_c_plaq * corr_1x1[t] + m_c_rect * corr_1x2[t];
1224  vout.general(m_vl, " Q_clover_imp_z_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
1225  scr = l_c_rect * corr_1x2[t];
1226  vout.general(m_vl, " Q_clover_rect_z_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, scr);
1227  vout.general(m_vl, " Q_plaq_z_FT = %d %d %d %.8f %d %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, t, corr_plaq[t]);
1228  }
1229 
1230  /*
1231  vout.general(m_vl, " Q_clover_plaq_sumz_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_1x1);
1232  double Q_rect = l_c_rect * Q_1x2;
1233  vout.general(m_vl, " Q_clover_rect_sumz_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_rect);
1234  double Q_imp = m_c_plaq * Q_1x1 + m_c_rect * Q_1x2;
1235  vout.general(m_vl, " Q_clover_imp_sumz_FT = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_imp);
1236  vout.general(m_vl, " Q_plaq_sumz = %d %d %d %.8f %.16e\n", momentum_sink[0], momentum_sink[1], momentum_sink[2], tt, Q_plaq);
1237  */
1238 
1239  if (m_filename_output != "stdout") {
1240  log_file.close();
1241  vout.init(log_file_previous);
1242  }
1243  }
1244  }
1245  }
1246 }
1247 
1248 
1249 //====================================================================
1250 
1251 /*
1252 double TopologicalCharge::contract_epsilon_tensor(const Field_G& Fmunu_1, const Field_G& Fmunu_2)
1253 {
1254  const int Nvol = CommonParameters::Nvol();
1255 
1256  double Q_topo = 0.0;
1257  for (int site = 0; site < Nvol; ++site) {
1258  Q_topo += ReTr(Fmunu_1.mat(site) * Fmunu_2.mat(site));
1259  }
1260  const double result = Communicator::reduce_sum(Q_topo);
1261 
1262  return result;
1263 }
1264 */
1265 
1266 
1267 //====================================================================
1269 {
1270  const int Ndim = CommonParameters::Ndim();
1271 
1272  // NB. #(mu,nu)=6 i.e. (1,2),(1,3),(1,4),(2,3),(2,4),(3,4)
1273  m_Fmunu_plaq.resize(6);
1274  m_Fmunu_1x1.resize(6);
1275  m_Fmunu_1x2.resize(6);
1276 
1277  int i_munu = 0;
1278  for (int mu = 0; mu < Ndim; ++mu) {
1279  for (int nu = mu + 1; nu < Ndim; ++nu) {
1283  ++i_munu;
1284  }
1285  }
1286  m_flag_field_set = true;
1287 }
1288 
1289 
1290 //====================================================================
1291 //============================================================END=====
void contract_at_y(std::vector< double > &corr_global, const Field_G &Fmunu_1, const Field_G &Fmunu_2)
Calculate corr[y]= . Intended to be used to calculate correlations function of the topological charge...
void construct_Fmunu_1x2(Field_G &Fmunu, const int mu, const int nu, const Field_G &U)
Constructs the anti-Hermitian field strength with eight 1x2 rectangular clover leaves.
BridgeIO vout
Definition: bridgeIO.cpp:503
std::string m_filename_output
static double epsilon_criterion()
std::vector< Field_G > m_Fmunu_1x2
void contract_at_z(std::vector< double > &corr_global, const Field_G &Fmunu_1, const Field_G &Fmunu_2)
Calculate corr[z]= . Intended to be used to calculate correlations function of the topological charge...
static const std::string class_name
void general(const char *format,...)
Definition: bridgeIO.cpp:197
std::vector< Field_G > m_Fmunu_1x1
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
double measure(const Field_G &U)
main function to measure Topological Charge. The field strength is constructed inside the function...
void init(const std::string &filename)
Definition: bridgeIO.cpp:51
void measure_topological_density_z(const double tt)
Measure topological charge density corr[z]= in z direction using the stored m_Fmunu and print out th...
Class for parameters.
Definition: parameters.h:46
void construct_Fmunu_1x1_traceless(Field_G &Fmunu, const int mu, const int nu, const Field_G &U)
Constructs the anti-Hermitian traceless field strength with four 1x1 plquette clover leaves...
void measure_topological_charge(const double tt)
void set_field_strength(const Field_G &U)
Construct the anti-Hermitian traceless field strength by the link U. Should be called before measuri...
std::vector< Field_G > m_Fmunu_plaq
void measure_topological_density_z_FT(const double tt)
Measure Fourier transformation of topological charge density corr[z]= using the stored m_Fmunu and p...
void measure_topological_density_y(const double tt)
Measure topological charge density corr[y]= in y direction using the stored m_Fmunu and print out th...
SU(N) gauge field.
Definition: field_G.h:38
void contract_at_t(std::vector< double > &corr_global, const Field_G &Fmunu_1, const Field_G &Fmunu_2)
Calculate corr[t]= . Intended to be used to calculate correlations function of the topological charge...
int fetch_int(const string &key, int &value) const
Definition: parameters.cpp:346
void construct_Fmunu_1x1(Field_G &Fmunu, const int mu, const int nu, const Field_G &U)
Constructs the anti-Hermitian field strength with four 1x1 plquette clover leaves.
void measure_topological_density_x_FT(const double tt)
Measure Fourier transformation of topological charge density corr[x]= using the stored m_Fmunu and p...
void construct_Fmunu_plaq_traceless(Field_G &Fmunu, const int mu, const int nu, const Field_G &U)
Constructs the anti-Hermitian traceless field strength with an imaginary part of the plaquette...
int m_max_mom
maximum of momentum for Fourier transformation: p_x=[0,max_mom], p_y=[-max_mom,max_mom], p_z=[-max_mom,max_mom]
void measure_topological_density_y_FT(const double tt)
Measure Fourier transformation of topological charge density corr[y]= using the stored m_Fmunu and p...
FieldStrength m_field_strength
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
Bridge::VerboseLevel m_vl
void measure_topological_density_x(const double tt)
Measure topological charge density corr[x]= in x direction using the stored m_Fmunu and print out th...
void measure_topological_density_t(const double tt)
Measure topological charge density corr[t]= in temporal direction using the stored m_Fmunu and print...
std::ostream & getStream()
Definition: bridgeIO.cpp:391
virtual void set_parameters(const Parameters &params)
setting parameters.
void construct_Fmunu_1x2_traceless(Field_G &Fmunu, const int mu, const int nu, const Field_G &U)
Constructs the anti-Hermitian traceless field strength with eight 1x2 rectangular clover leaves...
string get_string(const string &key) const
Definition: parameters.cpp:221
double contract(const Field_G &Fmunu_1, const Field_G &Fmunu_2)
Calculate and returns its value. Intended to be used for the topological charge and energy momentum ...
void contract_at_x(std::vector< double > &corr_global, const Field_G &Fmunu_1, const Field_G &Fmunu_2)
Calculate corr[x]= . Intended to be used to calculate correlations function of the topological charge...
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void measure_topological_density_t_FT(const double tt)
Measure Fourier transformation of topological charge density corr[t]= using the stored m_Fmunu and p...