Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
staple_eo.cpp
Go to the documentation of this file.
1 
14 #include "staple_eo.h"
15 
16 #ifdef USE_FACTORY_AUTOREGISTER
17 namespace {
18  bool init = Staple_eo::register_factory();
19 }
20 #endif
21 
22 const std::string Staple_eo::class_name = "Staple_eo";
23 
24 //====================================================================
26 {
27  m_filename_output = params.get_string("filename_output");
28  if (m_filename_output.empty()) {
29  m_filename_output = "stdout";
30  }
31 
32  const string str_vlevel = params.get_string("verbose_level");
33  m_vl = vout.set_verbose_level(str_vlevel);
34 }
35 
36 
37 //====================================================================
38 double Staple_eo::plaquette(const Field_G& U)
39 {
40  Field_G Ueo(U);
41  Index_eo index_eo;
42 
43  index_eo.convertField(Ueo, U);
44 
45  return (plaq_s(Ueo) + plaq_t(Ueo)) / 2;
46 }
47 
48 
49 //====================================================================
50 double Staple_eo::plaq_s(const Field_G& Ueo)
51 {
52  const int Nc = CommonParameters::Nc();
53  const int Ndim = CommonParameters::Ndim();
54  const int Ndim_spc = Ndim - 1;
55 
56  const int Nvol = CommonParameters::Nvol();
57  const int NPE = CommonParameters::NPE();
58 
60  double plaq = 0.0;
61 
62  upper(staple, Ueo, 0, 1);
63  for (int site = 0; site < Nvol; site++) {
64  plaq += ReTr(Ueo.mat(site, 0) * staple.mat_dag(site)); // P_xy
65  }
66 
67  upper(staple, Ueo, 1, 2);
68  for (int site = 0; site < Nvol; site++) {
69  plaq += ReTr(Ueo.mat(site, 1) * staple.mat_dag(site)); // P_yz
70  }
71 
72  upper(staple, Ueo, 2, 0);
73  for (int site = 0; site < Nvol; site++) {
74  plaq += ReTr(Ueo.mat(site, 2) * staple.mat_dag(site)); // P_zx
75  }
76 
77  plaq = Communicator::reduce_sum(plaq);
78 
79  return plaq / Nvol / NPE / Nc / Ndim_spc;
80 }
81 
82 
83 //====================================================================
84 double Staple_eo::plaq_t(const Field_G& Ueo)
85 {
86  const int Nc = CommonParameters::Nc();
87  const int Ndim = CommonParameters::Ndim();
88  const int Ndim_spc = Ndim - 1;
89 
90  const int Nvol = CommonParameters::Nvol();
91  const int NPE = CommonParameters::NPE();
92 
94  double plaq = 0.0;
95 
96  for (int nu = 0; nu < Ndim - 1; nu++) {
97  lower(staple, Ueo, 3, nu);
98  for (int site = 0; site < Nvol; site++) {
99  plaq += ReTr(Ueo.mat(site, 3) * staple.mat_dag(site)); // P_zx
100  }
101  }
102 
103  plaq = Communicator::reduce_sum(plaq);
104 
105  return plaq / Nvol / NPE / Nc / Ndim_spc;
106 }
107 
108 
109 //====================================================================
110 void Staple_eo::staple(Field_G& W, const Field_G& Ueo, const int mu)
111 {
112  const int Ndim = CommonParameters::Ndim();
113 
114  W.set(0.0);
115 
116  for (int nu = 0; nu < Ndim; nu++) {
117  if (nu != mu) {
118  Field_G u_tmp(W.nvol(), 1);
119 
120  upper(u_tmp, Ueo, mu, nu);
121  axpy(W, 1.0, u_tmp);
122 
123  lower(u_tmp, Ueo, mu, nu);
124  axpy(W, 1.0, u_tmp);
125  }
126  }
127 }
128 
129 
130 //====================================================================
131 void Staple_eo::upper(Field_G& c, const Field_G& Ueo, const int mu, const int nu)
132 {
133  // (1) mu (2)
134  // +-->--+
135  // nu | |
136  // i+ +
137 
138  Field_G Umu;
139 
140  Umu.setpart_ex(0, Ueo, mu);
141 
142  Field_G Unu;
143  Unu.setpart_ex(0, Ueo, nu);
144 
145  m_shift.backward(m_v, Unu, mu);
146  m_shift.backward(c, Umu, nu);
147 
148  mult_Field_Gnd(m_w, 0, c, 0, m_v, 0);
149  mult_Field_Gnn(c, 0, Unu, 0, m_w, 0);
150 }
151 
152 
153 //====================================================================
154 void Staple_eo::lower(Field_G& c, const Field_G& Ueo, const int mu, const int nu)
155 {
156  // + +
157  // nu | |
158  // i+-->--+
159  // (1) mu (2)
160 
161  Field_G Umu;
162 
163  Umu.setpart_ex(0, Ueo, mu);
164 
165  Field_G Unu;
166  Unu.setpart_ex(0, Ueo, nu);
167 
168  m_shift.backward(m_w, Unu, mu);
169  mult_Field_Gnn(m_v, 0, Umu, 0, m_w, 0);
170  mult_Field_Gdn(m_w, 0, Unu, 0, m_v, 0);
171  m_shift.forward(c, m_w, nu);
172 }
173 
174 
175 //====================================================================
176 //============================================================END=====
void backward(Field &, const Field &, const int mu)
BridgeIO vout
Definition: bridgeIO.cpp:503
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
static const std::string class_name
Definition: staple_eo.h:36
void lower(Field_G &, const Field_G &, const int, const int)
constructs lower staple in mu-nu plane.
Definition: staple_eo.cpp:154
double plaq_t(const Field_G &)
calculates temporal plaquette value.
Definition: staple_eo.cpp:84
std::string m_filename_output
Definition: staple_eo.h:39
int nvol() const
Definition: field.h:127
void mult_Field_Gdn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
void staple(Field_G &, const Field_G &, const int)
constructs staple in mu-direction (summing up nu-direction).
Definition: staple_eo.cpp:110
Class for parameters.
Definition: parameters.h:46
Even-odd site index.
Definition: index_eo.h:40
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
void upper(Field_G &, const Field_G &, const int, const int)
constructs upper staple in mu-nu plane.
Definition: staple_eo.cpp:131
void set_parameters(const Parameters &params)
setting parameters.
Definition: staple_eo.cpp:25
double plaquette(const Field_G &)
calculates plaquette value.
Definition: staple_eo.cpp:38
SU(N) gauge field.
Definition: field_G.h:38
Bridge::VerboseLevel m_vl
Definition: staple.h:36
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void mult_Field_Gnn(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)
Field_G m_v
Definition: staple_eo.h:41
Field_G m_w
Definition: staple_eo.h:41
double plaq_s(const Field_G &)
calculates spatial plaquette value.
Definition: staple_eo.cpp:50
void forward(Field &, const Field &, const int mu)
Mat_SU_N mat_dag(const int site, const int mn=0) const
Definition: field_G.h:127
ShiftField_eo m_shift
Definition: staple_eo.h:42
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:197
string get_string(const string &key) const
Definition: parameters.cpp:221
Mat_SU_N mat(const int site, const int mn=0) const
Definition: field_G.h:114
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
double ReTr(const Mat_SU_N &m)
Definition: mat_SU_N.h:488
void mult_Field_Gnd(Field_G &W, const int ex, const Field_G &U1, const int ex1, const Field_G &U2, const int ex2)