CHROMA
sfcurrents_w.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Schroedinger functional application of PCAC
4  */
5 
7 #include "util/ferm/transf.h"
9 
10 namespace Chroma
11 {
12  //! Compute the kprop used in PCAC
13  /*! @ingroup schrfun */
14  Propagator SFKprop(const LatticePropagator& quark_prop_f,
15  Handle< FermState<LatticeFermion, multi1d<LatticeColorMatrix>,
16  multi1d<LatticeColorMatrix> > > state,
17  const SftMom& phases)
18  {
19  START_CODE();
20 
21  QDPIO::cout << __func__ << ": entering" << std::endl;
22 
23  // Decay direction
24  int j_decay = phases.getDir();
25  int jd = 1 << j_decay;
26 
27  // Need to downcast to the appropriate BC
28  const SchrFermBC& fermbc = dynamic_cast<const SchrFermBC&>(state->getBC());
29 
30  // Location of upper wall source
31  int tmax = fermbc.getDecayMax();
32 
33  // Grab the links from the state
34  const multi1d<LatticeColorMatrix>& u = state->getLinks();
35 
36  // Spin projectors
37  SpinMatrix P_plus = 0.5*(SpinMatrix(1.0) + (Gamma(jd) * SpinMatrix(1.0)));
38 
39  // Common to all currents
40  // Sum the forward propagator over time slices to get Kprop
41  Propagator kprop = sum(P_plus * (adj(u[j_decay]) * quark_prop_f), phases.getSet()[tmax]);
42 
43  QDPIO::cout << __func__ << ": exiting" << std::endl;
44 
45  return kprop;
46  }
47 
48 
49  //! Compute Z_V
50  /*! @ingroup schrfun */
51  void SFCurrentZV(XMLWriter& xml_out,
52  const std::string& xml_group,
53  const LatticePropagator& quark_prop_f,
54  const LatticePropagator& quark_prop_b,
56  Handle< FermState<LatticeFermion, multi1d<LatticeColorMatrix>,
57  multi1d<LatticeColorMatrix> > > state,
58  const SftMom& phases)
59  {
60  START_CODE();
61 
62  QDPIO::cout << __func__ << ": entering" << std::endl;
63 
64  // Length of lattice in decay direction
65  int length = phases.numSubsets();
66  int j_decay = phases.getDir();
67 
68  // Other useful stuff
69  int G5 = Ns*Ns-1;
70  int jd = 1 << j_decay;
71 
72  // Grab the links from the state
73  const multi1d<LatticeColorMatrix>& u = state->getLinks();
74 
75  // 3-space volume normalization
76  Real norm = 1.0 / Real(QDP::Layout::vol());
77  norm *= Real(QDP::Layout::lattSize()[j_decay]);
78 
79  // Common to all currents
80  // Sum the forward propagator over time slices to get Kprop
81  Propagator kprop = SFKprop(quark_prop_f, state, phases);
82  kprop *= Real(2)*norm;
83 
84  /* Construct f_1 */
85  Real f_1 = 0.5 * norm2(kprop);
86 
87  // Construct H'' = H' gamma_5 K, where H' is the propagator
88  // from the upper boundary.
89  LatticePropagator quark_prop_bg5k = quark_prop_b * Gamma(G5) * kprop;
90 
91  // Construct f_V
92  int n = G5 ^ jd;
93  LatticeReal r_tmp1 = real(trace(adj(quark_prop_bg5k) * (Gamma(n) * quark_prop_f)));
94  multi1d<Double> hrsum = sumMulti(r_tmp1, phases.getSet());
95 
96  multi1d<Real> vector_corr(length);
97  for(int t = 0; t < length; t++)
98  vector_corr[t] = norm * real(hrsum[t]);
99 
100  push(xml_out, xml_group);
101  write(xml_out, "f_1", f_1);
102  write(xml_out, "vector_corr", vector_corr);
103  pop(xml_out);
104 
105  QDPIO::cout << __func__ << ": exiting" << std::endl;
106 
107  END_CODE();
108  }
109 
110 
111  //! Compute Z_V
112  /*!
113  * @ingroup schrfun
114  *
115  * @return number of inverter iterations
116  */
117  int SFCurrentZA(XMLWriter& xml_out,
118  const std::string& xml_group,
119  const multi1d<Real>& pseudo_prop_f,
120  const multi1d<Real>& axial_prop_f,
121  const multi1d<Real>& pseudo_prop_b,
122  const multi1d<Real>& axial_prop_b,
123  const LatticePropagator& quark_prop_f,
124  const LatticePropagator& quark_prop_b,
126  Handle< FermState<LatticeFermion, multi1d<LatticeColorMatrix>,
127  multi1d<LatticeColorMatrix> > > state,
128  const SftMom& phases,
129  int x0, int y0)
130  {
131  START_CODE();
132 
133  QDPIO::cout << __func__ << ": entering" << std::endl;
134 
135  // Sanity checks
136  if ( x0 < y0 )
137  {
138  QDPIO::cerr << __func__ << ": Z_A computation requires x0 > y0: x0,y0="
139  << x0 << " " << y0 << std::endl;
140  QDP_abort(1);
141  }
142 
143  // Number of cg iterations
144  int ncg_had = 0;
145 
146  // Length of lattice in decay direction
147  int j_decay = phases.getDir();
148 
149  // Other useful stuff
150  int G5 = Ns*Ns-1;
151  int jd = 1 << j_decay;
152 
153  // 3-space volume normalization
154  Real norm = 1.0 / Real(QDP::Layout::vol());
155  norm *= Real(QDP::Layout::lattSize()[j_decay]);
156 
157  // Common to all currents
158  // Sum the forward propagator over time slices to get Kprop
159  Propagator kprop = SFKprop(quark_prop_f, state, phases);
160  kprop *= Real(2)*norm;
161 
162  /* Construct f_1 */
163  Real f_1 = 0.5 * norm2(kprop);
164 
165  // Construct H'' = H' gamma_5 K, where H' is the propagator
166  // from the upper boundary.
167  LatticePropagator quark_prop_bg5k = quark_prop_b * Gamma(G5) * kprop;
168 
169  /* Construct the ingredients for f^I_AA */
170  LatticeReal faa_tmp = zero;
171  LatticeReal fap_tmp = zero;
172  LatticeReal fpp_tmp = zero;
173  LatticeInteger t_coord = QDP::Layout::latticeCoordinate(j_decay);
174 
175  /* "right" A_0 insertion at x */
176  LatticeBoolean tmask = (t_coord == x0);
177  LatticePropagator quark_prop_s = zero; // sequential propagator
178 
179  for(int color_source = 0; color_source < Nc; ++color_source)
180  {
181  for(int spin_source = 0; spin_source < Ns; ++spin_source)
182  {
183  LatticeFermion chi;
184  PropToFerm(quark_prop_f, chi, color_source, spin_source);
185 
186  int n = jd ^ G5;
187  LatticeFermion psi = Gamma(n) * chi;
188  /* This gives multiplication with gamma_5 * gamma_0. */
189  /* Include the minus sign for multiplication with */
190  /* gamma_0 * gamma_5 below. */
191 
192  chi = where(tmask, LatticeFermion(-psi), LatticeFermion(zero));
193  psi = zero;
194  SystemSolverResults_t res = (*qprop)(psi, chi);
195  ncg_had += res.n_count;
196 
197  FermToProp(psi, quark_prop_s, color_source, spin_source);
198  }
199  }
200 
201  // "left" P insertion at y
202  LatticeReal r_tmp1 = -real(trace(adj(quark_prop_bg5k) * quark_prop_s));
203 
204  fap_tmp += where(t_coord == (y0+1), r_tmp1, LatticeReal(zero));
205  fap_tmp -= where(t_coord == (y0-1), r_tmp1, LatticeReal(zero));
206 
207  /* "left" A_0 insertion at y */
208  r_tmp1 = real(trace(adj(quark_prop_bg5k) * (Gamma(jd) * quark_prop_s)));
209  faa_tmp += where(t_coord == y0, r_tmp1, LatticeReal(zero));
210 
211  /* "right" A_0 insertion at y */
212  tmask = (t_coord == y0);
213  int n = jd ^ G5;
214  quark_prop_s = zero;
215  for(int color_source = 0; color_source < Nc; ++color_source)
216  {
217  for(int spin_source = 0; spin_source < Ns; ++spin_source)
218  {
219  LatticeFermion psi, chi;
220  PropToFerm(quark_prop_f, chi, color_source, spin_source);
221  psi = Gamma(n) * chi;
222  /* This gives multiplication with gamma_5 * gamma_0. */
223  /* Include the minus sign for multiplication with */
224  /* gamma_0 * gamma_5 below. */
225 
226  chi = where(tmask, LatticeFermion(-psi), LatticeFermion(zero));
227  psi = zero;
228  SystemSolverResults_t res = (*qprop)(psi, chi);
229  ncg_had += res.n_count;
230 
231  FermToProp(psi, quark_prop_s, color_source, spin_source);
232  }
233  }
234 
235  /* "left" P insertion at x */
236  r_tmp1 = real(trace(adj(quark_prop_bg5k) * quark_prop_s));
237  fap_tmp += where(t_coord == (x0+1), r_tmp1, LatticeReal(zero));
238  fap_tmp -= where(t_coord == (x0-1), r_tmp1, LatticeReal(zero));
239 
240  /* "left" A_0 insertion at x */
241  r_tmp1 = -real(trace(adj(quark_prop_bg5k) * (Gamma(jd) * quark_prop_s)));
242  faa_tmp += where(t_coord == x0, r_tmp1, LatticeReal(zero));
243 
244  /* "right" P insertion at x */
245  quark_prop_s = zero;
246  for(int color_source = 0; color_source < Nc; ++color_source)
247  {
248  for(int spin_source = 0; spin_source < Ns; ++spin_source)
249  {
250  LatticeFermion psi, chi;
251  PropToFerm(quark_prop_f, chi, color_source, spin_source);
252  psi = Gamma(G5) * chi;
253 
254  chi = where(t_coord == (x0+1), psi, LatticeFermion(zero));
255  chi -= where(t_coord == (x0-1), psi, LatticeFermion(zero));
256 
257  psi = zero;
258  SystemSolverResults_t res = (*qprop)(psi, chi);
259  ncg_had += res.n_count;
260 
261  FermToProp(psi, quark_prop_s, color_source, spin_source);
262  }
263  }
264 
265  /* "left" P insertion at y */
266  r_tmp1 = -real(trace(adj(quark_prop_bg5k) * quark_prop_s));
267  fpp_tmp += where(t_coord == (y0+1), r_tmp1, LatticeReal(zero));
268  fpp_tmp -= where(t_coord == (y0-1), r_tmp1, LatticeReal(zero));
269 
270  /* "left" A_0 insertion at y */
271  r_tmp1 = real(trace(adj(quark_prop_bg5k) * (Gamma(jd) * quark_prop_s)));
272  fap_tmp += where(t_coord == y0, r_tmp1, LatticeReal(zero));
273 
274  /* "right" P insertion at y */
275  quark_prop_s = zero;
276  for(int color_source = 0; color_source < Nc; ++color_source)
277  {
278  for(int spin_source = 0; spin_source < Ns; ++spin_source)
279  {
280  LatticeFermion psi, chi;
281  PropToFerm(quark_prop_f, chi, color_source, spin_source);
282  psi = Gamma(G5) * chi;
283 
284  chi = where(t_coord == (y0+1), psi, LatticeFermion(zero));
285  chi -= where(t_coord == (y0-1), psi, LatticeFermion(zero));
286  psi = zero;
287  SystemSolverResults_t res = (*qprop)(psi, chi);
288  ncg_had += res.n_count;
289 
290  FermToProp(psi, quark_prop_s, color_source, spin_source);
291  }
292  }
293 
294  /* "left" P insertion at x */
295  r_tmp1 = real(trace(adj(quark_prop_bg5k) * quark_prop_s));
296  fpp_tmp += where(t_coord == (x0+1), r_tmp1, LatticeReal(zero));
297  fpp_tmp -= where(t_coord == (x0-1), r_tmp1, LatticeReal(zero));
298 
299  /* "left" A_0 insertion at x */
300  r_tmp1 = -real(trace(adj(quark_prop_bg5k) * (Gamma(jd) * quark_prop_s)));
301  fap_tmp += where(t_coord == x0, r_tmp1, LatticeReal(zero));
302 
303  multi1d<Double> hrsum = sumMulti(faa_tmp, phases.getSet());
304  Real f_AA = (real(hrsum[x0]) + real(hrsum[y0])) * norm;
305 
306  hrsum = sumMulti(fap_tmp, phases.getSet());
307  Real f_AP_PA = real(hrsum[x0]);
308  f_AP_PA += real(hrsum[y0]);
309  f_AP_PA += real(hrsum[x0+1]);
310  f_AP_PA += real(hrsum[x0-1]);
311  f_AP_PA += real(hrsum[y0+1]);
312  f_AP_PA += real(hrsum[y0-1]);
313  f_AP_PA *= 0.5 * norm;
314 
315  hrsum = sumMulti(fpp_tmp, phases.getSet());
316  Real f_PP = real(hrsum[x0+1]);
317  f_PP += real(hrsum[x0-1]);
318  f_PP += real(hrsum[y0+1]);
319  f_PP += real(hrsum[y0-1]);
320  f_PP *= 0.25 * norm;
321 
322  Real fd_AA;
323  fd_AA = axial_prop_b[y0] * axial_prop_f[x0];
324  fd_AA -= axial_prop_b[x0] * axial_prop_f[y0];
325 
326  Real fd_AP_PA;
327  fd_AP_PA = pseudo_prop_b[y0+1] * axial_prop_f[x0];
328  fd_AP_PA -= pseudo_prop_b[y0-1] * axial_prop_f[x0];
329  fd_AP_PA += axial_prop_b[y0] * pseudo_prop_f[x0+1];
330  fd_AP_PA -= axial_prop_b[y0] * pseudo_prop_f[x0-1];
331  fd_AP_PA -= axial_prop_b[x0] * pseudo_prop_f[y0+1];
332  fd_AP_PA += axial_prop_b[x0] * pseudo_prop_f[y0-1];
333  fd_AP_PA -= pseudo_prop_b[x0+1] * axial_prop_f[y0];
334  fd_AP_PA += pseudo_prop_b[x0-1] * axial_prop_f[y0];
335  fd_AP_PA *= 0.5;
336 
337  Real fd_PP;
338  fd_PP = pseudo_prop_b[y0+1] * pseudo_prop_f[x0+1];
339  fd_PP -= pseudo_prop_b[y0+1] * pseudo_prop_f[x0-1];
340  fd_PP -= pseudo_prop_b[y0-1] * pseudo_prop_f[x0+1];
341  fd_PP += pseudo_prop_b[y0-1] * pseudo_prop_f[x0-1];
342  fd_PP -= pseudo_prop_b[x0+1] * pseudo_prop_f[y0+1];
343  fd_PP += pseudo_prop_b[x0+1] * pseudo_prop_f[y0-1];
344  fd_PP += pseudo_prop_b[x0-1] * pseudo_prop_f[y0+1];
345  fd_PP -= pseudo_prop_b[x0-1] * pseudo_prop_f[y0-1];
346  fd_PP *= 0.25;
347 
348  push(xml_out, xml_group);
349  write(xml_out, "f_1", f_1);
350  write(xml_out, "f_AA", f_AA);
351  write(xml_out, "f_AP_PA", f_AP_PA);
352  write(xml_out, "f_PP", f_PP);
353  write(xml_out, "fd_AA", fd_AA);
354  write(xml_out, "fd_AP_PA", fd_AP_PA);
355  write(xml_out, "fd_PP", fd_PP);
356  pop(xml_out);
357 
358  QDPIO::cout << __func__ << ": exiting" << std::endl;
359 
360  END_CODE();
361 
362  return ncg_had;
363  }
364 
365 } // namespace Chroma
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
Abstract class for all gauge action boundary conditions with Schroedinger BC.
virtual int getDecayMax() const =0
Ending slice in decay direction.
Fourier transform phase factor support.
Definition: sftmom.h:35
int numSubsets() const
Number of subsets - length in decay direction.
Definition: sftmom.h:63
int getDir() const
Decay direction.
Definition: sftmom.h:69
const Set & getSet() const
The set to be used in sumMulti.
Definition: sftmom.h:57
void PropToFerm(const LatticePropagatorF &b, LatticeFermionF &a, int color_index, int spin_index)
Extract a LatticeFermion from a LatticePropagator.
Definition: transf.cc:226
void FermToProp(const LatticeFermionF &a, LatticePropagatorF &b, int color_index, int spin_index)
Insert a LatticeFermion into a LatticePropagator.
Definition: transf.cc:98
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void SFCurrentZV(XMLWriter &xml_out, const std::string &xml_group, const LatticePropagator &quark_prop_f, const LatticePropagator &quark_prop_b, Handle< SystemSolver< LatticeFermion > > qprop, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const SftMom &phases)
Compute Z_V.
Definition: sfcurrents_w.cc:51
Propagator SFKprop(const LatticePropagator &quark_prop_f, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const SftMom &phases)
Compute the kprop used in PCAC.
Definition: sfcurrents_w.cc:14
int SFCurrentZA(XMLWriter &xml_out, const std::string &xml_group, const multi1d< Real > &pseudo_prop_f, const multi1d< Real > &axial_prop_f, const multi1d< Real > &pseudo_prop_b, const multi1d< Real > &axial_prop_b, const LatticePropagator &quark_prop_f, const LatticePropagator &quark_prop_b, Handle< SystemSolver< LatticeFermion > > qprop, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const SftMom &phases, int x0, int y0)
Compute Z_V.
unsigned n
Definition: ldumul_w.cc:36
int j_decay
Definition: meslate.cc:22
int t
Definition: meslate.cc:37
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
int G5
Definition: pbg5p_w.cc:57
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
Double sum
Definition: qtopcor.cc:37
int norm
Definition: qtopcor.cc:35
Fermion action boundary conditions.
Current renormalizations within Schroedinger functional.
Holds return info from SystemSolver call.
Definition: syssolver.h:17