CHROMA
sfpcac_w.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Schroedinger functional application of PCAC
4  */
5 
10 #include "util/ferm/transf.h"
11 
13 
14 namespace Chroma
15 {
16  //! Schroedinger functional stuff
17  /*!
18  * @ingroup schrfun
19  *
20  * Compute correlation functions between axial current or pseudescalar
21  * density and boundary fields using Schroedinger BC.
22  *
23  * Also computed, on demand, are correlation functions between both
24  * boundaries with zero, one (std::vector current) and two (axial current or
25  * pseudoscalar density) insertions in the bulk. These currents are
26  * controlled by the ZVfactP and ZAfactP boolean flags.
27  *
28  * Compute quark propagators by using the qprop SystemSolver.
29  * The initial guess for the inverter is zero.
30  *
31  * The results are written to the xml file.
32  *
33  * For further details see the comments in the dependent subroutines.
34  *
35  * \param state gauge field state ( Read )
36  * \param qprop propagator solver ( Read )
37  * \param phases object holds list of momenta and Fourier phases ( Read )
38  * \param ZVfactP flag for doing Z_V measurements ( Read )
39  * \param ZAfactP flag for doing Z_A measurements ( Read )
40  * \param x0 time slices with axial current insertions ( Read )
41  * \param y0 time slices with axial current insertions ( Read )
42  * \param xml xml file object ( Write )
43  * \param xml_group std::string used for writing xml data ( Read )
44  */
46  Handle< FermState<LatticeFermion, multi1d<LatticeColorMatrix>,
47  multi1d<LatticeColorMatrix> > > state,
48  const SftMom& phases,
49  bool ZVfactP, bool ZAfactP,
50  int x0, int y0,
51  XMLWriter& xml_out,
52  const std::string& xml_group)
53  {
54  START_CODE();
55 
56  QDPIO::cout << __func__ << ": entering" << std::endl;
57 
58  if ( Ns != 4 )
59  {
60  QDPIO::cerr << __func__ << ": only supports 4 spin components" << std::endl;
61  QDP_abort(1);
62  }
63 
64  // Need to downcast to the appropriate BC
65  const SchrFermBC& fermbc = dynamic_cast<const SchrFermBC&>(state->getBC());
66 
67  // Outside group
68  push(xml_out, xml_group);
69 
70  // Length of lattice in decay direction
71  int length = phases.numSubsets();
72  int j_decay = phases.getDir();
73 
74  // Other useful stuff
75  int G5 = Ns*Ns-1;
76  int jd = 1 << j_decay;
77 
78  multi1d<Real> pseudo_prop_f(length);
79  multi1d<Real> axial_prop_f(length);
80  multi1d<Real> pseudo_prop_b(length);
81  multi1d<Real> axial_prop_b(length);
82 
83  // 3-space volume normalization
84  Real norm = 1.0 / Real(QDP::Layout::vol());
85  norm *= Real(QDP::Layout::lattSize()[j_decay]);
86 
87  // Spin projectors
88  SpinMatrix g_one = 1.0;
89  SpinMatrix P_plus = 0.5*(g_one + (Gamma(jd) * g_one));
90  SpinMatrix P_minus = 0.5*(g_one - (Gamma(jd) * g_one));
91 
92  /* Location of upper wall source */
93  int tmin = fermbc.getDecayMin();
94  int tmax = fermbc.getDecayMax();
95 
96  // Grab the links from the state
97  const multi1d<LatticeColorMatrix>& u = state->getLinks();
98 
99  // Total number of inversions
100  int ncg_had = 0;
101 
102  LatticePropagator quark_prop_f = zero;
103  LatticePropagator quark_prop_b = zero;
104 
105  // Temporaries
106  multi1d<Real> pseudo_prop_tmp;
107  multi1d<Real> axial_prop_tmp;
108 
109  push(xml_out, "PCAC_measurements");
110  for(int direction = -1; direction <= 1; direction+=2)
111  {
112  int t0 = (direction == -1) ? tmax : tmin;
113 
114  for(int color_source = 0; color_source < Nc; ++color_source)
115  {
116  for(int spin_source = 0; spin_source < Ns; ++spin_source)
117  {
118  /* Compute quark propagator "psi" using source "chi" with type specified */
119  /* by WALL_SOURCE, and color and spin equal to color_source and spin_source. */
120  LatticeFermion psi, chi;
121  {
122  LatticeFermion tmp1;
123  walfil(tmp1, t0, j_decay, color_source, spin_source);
124 
125  if (direction == -1)
126  {
127  chi = P_minus * (u[j_decay] * tmp1);
128  }
129  else
130  {
131  chi = shift(P_plus * (adj(u[j_decay]) * tmp1), BACKWARD, j_decay);
132  }
133 
134  // Solve for the propagator
135  psi = zero;
136  SystemSolverResults_t res = (*qprop)(psi, chi);
137  ncg_had += res.n_count;
138  }
139 
140 
141  /* Store in quark_prop_f/b */
142  if (direction == -1)
143  {
144  FermToProp(psi, quark_prop_b, color_source, spin_source);
145  }
146  else
147  {
148  FermToProp(psi, quark_prop_f, color_source, spin_source);
149  }
150 
151  }
152  }
153 
154  /* Time reverse backwards source */
155  if (direction == -1)
156  {
157  // Construct the pion axial current divergence and the pion correlator
158  SFcorr(pseudo_prop_b, axial_prop_b, quark_prop_b, phases);
159 
160  // Normalize to compare to everybody else
161  pseudo_prop_b *= norm;
162  axial_prop_b *= norm;
163 
164  pseudo_prop_tmp.resize(length);
165  axial_prop_tmp.resize(length);
166 
167  // Time reverse
168  for(int t = 0; t < (length-1)/2 + 1; ++t)
169  {
170  int t_eff = length - t - 1;
171 
172  pseudo_prop_tmp[t] = pseudo_prop_b[t_eff];
173  pseudo_prop_tmp[t_eff] = pseudo_prop_b[t];
174 
175  axial_prop_tmp[t] = -axial_prop_b[t_eff];
176  axial_prop_tmp[t_eff] = -axial_prop_b[t];
177  }
178 
179  }
180  else
181  {
182  // Construct the pion axial current divergence and the pion correlator
183  SFcorr(pseudo_prop_f, axial_prop_f, quark_prop_f, phases);
184 
185  // Normalize to compare to everybody else
186  pseudo_prop_f *= norm;
187  axial_prop_f *= norm;
188 
189  pseudo_prop_tmp = pseudo_prop_f;
190  axial_prop_tmp = axial_prop_f;
191  }
192 
193  // Write out results
194  push(xml_out, "elem");
195  write(xml_out, "direction", direction);
196  write(xml_out, "pseudo_prop", pseudo_prop_tmp);
197  write(xml_out, "axial_prop", axial_prop_tmp);
198  pop(xml_out);
199 
200  } // end for direction
201  pop(xml_out); // PCAC_measurements
202 
203 #if 0
204  {
205  multi1d<Double> prop_corr = sumMulti(localNorm2(quark_prop_f),
206  phases.getSet());
207 
208  push(xml_out, "Forward_prop_test");
209  write(xml_out, "quark_prop_f", prop_corr);
210  write(xml_out, "pseudo_prop_f", pseudo_prop_f);
211  pop(xml_out);
212  }
213 #endif
214 
215  //
216  // Currents
217  //
218  // Compute Z_V
219  if (ZVfactP)
220  SFCurrentZV(xml_out, "ZV_measurements",
221  quark_prop_f, quark_prop_b, qprop, state, phases);
222 
223  // Compute Z_A
224  if (ZAfactP)
225  ncg_had += SFCurrentZA(xml_out, "ZA_measurements",
226  pseudo_prop_f, axial_prop_f, pseudo_prop_b, axial_prop_b,
227  quark_prop_f, quark_prop_b, qprop, state, phases, x0, y0);
228 
229  QDPIO::cout << __func__ << ": print iterations" << std::endl;
230 
231  push(xml_out,"Relaxation_Iterations");
232  write(xml_out, "ncg_had", ncg_had);
233  pop(xml_out);
234 
235  pop(xml_out); // xml_group
236 
237  QDPIO::cout << __func__ << ": exiting" << std::endl;
238 
239  END_CODE();
240  }
241 
242 }
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 getDecayMin() const =0
Starting slice in decay direction.
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 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
void SFcorr(multi1d< Real > &pseudo_prop, multi1d< Real > &axial_prop, const LatticePropagator &quark_propagator, const SftMom &phases)
Schroedinger functional correlation functions.
Definition: sfcorr_w.cc:29
void SFpcac(Handle< SystemSolver< LatticeFermion > > qprop, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const SftMom &phases, bool ZVfactP, bool ZAfactP, int x0, int y0, XMLWriter &xml_out, const std::string &xml_group)
Schroedinger functional stuff.
Definition: sfpcac_w.cc:45
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.
void walfil(LatticeStaggeredFermion &a, int slice, int mu, int color_index, int src_index)
Fill a specific color and spin index with 1.0 on a wall.
Definition: walfil_s.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
#define BACKWARD
Definition: primitives.h:83
int norm
Definition: qtopcor.cc:35
Fermion action boundary conditions.
Schroedinger functional correlation functions.
Current renormalizations within Schroedinger functional.
Schroedinger functional application of PCAC.
Holds return info from SystemSolver call.
Definition: syssolver.h:17
Wall source construction.