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