CHROMA
mesplq.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Plaquette measurement
3  */
4 
5 #include "chromabase.h"
6 #include "meas/glue/mesplq.h"
7 #include "meas/glue/polylp.h"
8 
9 
10 namespace Chroma
11 {
12 
13  // Primitive way for now to indicate the time direction
14  static int tDir() {return Nd-1;}
15 
16  //! Return the value of the average plaquette normalized to 1
17  /*!
18  * \ingroup glue
19  *
20  * \param u gauge field (Read)
21  * \param plane_plaq plane plaquette average (Write)
22  * \param link space-time average link (Write)
23  */
24 
25 
26  template<typename Q>
27  void MesPlq_t(const multi1d<Q>& u,
28  multi2d<Double>& plane_plaq, Double& link)
29  {
30  START_CODE();
31 
32  plane_plaq.resize(Nd,Nd);
33  link = zero;
34 
35  // Compute the average plaquettes
36  for(int mu=1; mu < Nd; ++mu)
37  {
38  for(int nu=0; nu < mu; ++nu)
39  {
40 #if 0
41  // This is the the longer way to write the 1-liner in the else clause
42 
43  /* tmp_0 = u(x+mu,nu)*u_dag(x+nu,mu) */
44  LatticeColorMatrix tmp_0 = shift(u[nu],FORWARD,mu) * adj(shift(u[mu],FORWARD,nu));
45 
46  /* tmp_1 = tmp_0*u_dag(x,nu)=u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu) */
47  LatticeColorMatrix tmp_1 = tmp_0 * adj(u[nu]);
48 
49  /* tmp = sum(tr(u(x,mu)*tmp_1=u(x,mu)*u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu))) */
50  Double tmp = sum(real(trace(u[mu]*tmp_1)));
51 
52 #else
53  // This is the the short way to write the clause in the above block
54 
55  /* tmp_0 = u(x+mu,nu)*u_dag(x+nu,mu) */
56  /* tmp_1 = tmp_0*u_dag(x,nu)=u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu) */
57  /* wplaq_tmp = tr(u(x,mu)*tmp_1=u(x,mu)*u(x+mu,nu)*u_dag(x+nu,mu)*u_dag(x,nu)) */
58  Double tmp =
59  sum(real(trace(u[mu]*shift(u[nu],FORWARD,mu)*adj(shift(u[mu],FORWARD,nu))*adj(u[nu]))));
60 #endif
61 
62  plane_plaq[mu][nu] = tmp;
63  }
64  }
65 
66  // Normalize the planes
67  for(int mu=1; mu < Nd; ++mu)
68  for(int nu=0; nu < mu; ++nu)
69  {
70  plane_plaq[mu][nu] /= Double(Layout::vol()*Nc);
71  plane_plaq[nu][mu] = plane_plaq[mu][nu];
72  }
73 
74  // Compute the average link
75  for(int mu=0; mu < Nd; ++mu)
76  link += sum(real(trace(u[mu])));
77 
78  link /= Double(Layout::vol()*Nd*Nc);
79 
80  END_CODE();
81  }
82 
83  void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
84  multi2d<Double>& plane_plaq, Double& link)
85  {
86  MesPlq_t(u,plane_plaq, link);
87  }
88 
89  void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
90  multi2d<Double>& plane_plaq, Double& link)
91  {
92  MesPlq_t(u,plane_plaq, link);
93  }
94 
95  //! Return the value of the average plaquette normalized to 1
96  /*!
97  * \ingroup glue
98  *
99  * \param u gauge field (Read)
100  * \param w_plaq plaquette average (Write)
101  * \param s_plaq space-like plaquette average (Write)
102  * \param t_plaq time-like plaquette average (Write)
103  * \param plane_plaq plane plaquette average (Write)
104  * \param link space-time average link (Write)
105  */
106  template<typename Q>
107  void MesPlq_t(const multi1d<Q>& u,
109  multi2d<Double>& plane_plaq,
110  Double& link)
111  {
112  START_CODE();
113 
114  // Compute plane plaquettes and link
115  MesPlq(u, plane_plaq, link);
116 
117  // Compute basic plaquettes
118  w_plaq = s_plaq = t_plaq = zero;
119 
120  for(int mu=1; mu < Nd; ++mu)
121  {
122  for(int nu=0; nu < mu; ++nu)
123  {
124  Double tmp = plane_plaq[mu][nu];
125 
126  w_plaq += tmp;
127 
128  if (mu == tDir() || nu == tDir())
129  t_plaq += tmp;
130  else
131  s_plaq += tmp;
132  }
133  }
134 
135  // Normalize
136  w_plaq *= 2.0 / Double(Nd*(Nd-1));
137 
138  if (Nd > 2)
139  s_plaq *= 2.0 / Double((Nd-1)*(Nd-2));
140 
141  t_plaq /= Double(Nd-1);
142 
143  END_CODE();
144  }
145 
146  void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
148  multi2d<Double>& plane_plaq,
149  Double& link)
150  {
151  MesPlq_t(u,w_plaq,s_plaq,t_plaq, plane_plaq, link);
152  }
153 
154  void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
156  multi2d<Double>& plane_plaq,
157  Double& link)
158  {
159  MesPlq_t(u,w_plaq,s_plaq,t_plaq, plane_plaq, link);
160  }
161 
162  //! Return the value of the average plaquette normalized to 1
163  /*!
164  * \ingroup glue
165  *
166  * \param u gauge field (Read)
167  * \param w_plaq plaquette average (Write)
168  * \param s_plaq space-like plaquette average (Write)
169  * \param t_plaq time-like plaquette average (Write)
170  * \param link space-time average link (Write)
171  */
172 
173  void MesPlq(const multi1d<LatticeColorMatrixF3>& u,
175  {
176  START_CODE();
177 
178  multi2d<Double> plane_plaq;
179 
180  MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);
181 
182  END_CODE();
183  }
184 
185  void MesPlq(const multi1d<LatticeColorMatrixD3>& u,
187  {
188  START_CODE();
189 
190  multi2d<Double> plane_plaq;
191 
192  MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);
193 
194  END_CODE();
195  }
196 
197  //! Print the value of the average plaquette normalized to 1
198  /*!
199  * \ingroup glue
200  *
201  * \param xml plaquette average (Write)
202  * \param xml_group xml file object ( Read )
203  * \param u gauge field (Read)
204  */
205  template<typename Q>
206  void MesPlq_t(XMLWriter& xml,
207  const std::string& xml_group,
208  const multi1d<Q>& u)
209  {
210  START_CODE();
211 
213  multi2d<Double> plane_plaq;
214  multi1d<DComplex> pollp;
215 
216  MesPlq(u, w_plaq, s_plaq, t_plaq, plane_plaq, link);
217  polylp(u, pollp);
218 
219  push(xml, xml_group);
220  write(xml, "w_plaq", w_plaq);
221  write(xml, "s_plaq", s_plaq);
222  write(xml, "t_plaq", t_plaq);
223 
224  if (Nd >= 2)
225  {
226  write(xml, "plane_01_plaq", plane_plaq[0][1]);
227  }
228 
229  if (Nd >= 3)
230  {
231  write(xml, "plane_02_plaq", plane_plaq[0][2]);
232  write(xml, "plane_12_plaq", plane_plaq[1][2]);
233  }
234 
235  if (Nd >= 4)
236  {
237  write(xml, "plane_03_plaq", plane_plaq[0][3]);
238  write(xml, "plane_13_plaq", plane_plaq[1][3]);
239  write(xml, "plane_23_plaq", plane_plaq[2][3]);
240  }
241 
242 // This is commented out because it is redundant and takes up space
243 // in what can be huge XML output files. However, if the info is
244 // really useful it is trivial to turn the output back on.
245 // push(xml, "PlanePlaq");
246 // for(int mu=0; mu < Nd-1; ++mu)
247 // {
248 // for(int nu=mu+1; nu < Nd; ++nu)
249 // {
250 // push(xml, "elem");
251 // write(xml, "mu", mu);
252 // write(xml, "nu", nu);
253 // write(xml, "plane_plaq", plane_plaq[mu][nu]);
254 // pop(xml); // elem
255 // }
256 // }
257 // pop(xml); // PlanePlaq
258 
259  write(xml, "link", link);
260  write(xml, "pollp", pollp);
261 
262  pop(xml); // xml_group
263 
264  END_CODE();
265  }
266 
267  void MesPlq(XMLWriter& xml,
268  const std::string& xml_group,
269  const multi1d<LatticeColorMatrixF3>& u)
270  {
271  MesPlq_t(xml, xml_group, u);
272  }
273 
274  void MesPlq(XMLWriter& xml,
275  const std::string& xml_group,
276  const multi1d<LatticeColorMatrixD3>& u)
277  {
278  MesPlq_t(xml, xml_group, u);
279  }
280 
281 } // end namespace Chroma
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
int nu
Definition: cool.cc:25
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void polylp(const multi1d< LatticeColorMatrixF3 > &u, DComplex &poly_loop, int mu)
Compute Polyakov loop.
Definition: polylp.cc:40
void MesPlq_t(const multi1d< Q > &u, multi2d< Double > &plane_plaq, Double &link)
Return the value of the average plaquette normalized to 1.
Definition: mesplq.cc:27
LatticeColorMatrix tmp_1
Definition: meslate.cc:50
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static int tDir()
Definition: coulgauge.cc:14
static multi1d< LatticeColorMatrix > u
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
START_CODE()
Double zero
Definition: invbicg.cc:106
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
Double link
Definition: pade_trln_w.cc:146
Double t_plaq
Definition: pade_trln_w.cc:145
Double w_plaq
Definition: pade_trln_w.cc:143
Double s_plaq
Definition: pade_trln_w.cc:144
Calculate the global normalized sum of the Polyakov loop.
#define FORWARD
Definition: primitives.h:82
Double sum
Definition: qtopcor.cc:37