CHROMA
eoprec_dwf_fermact_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief 4D style even-odd preconditioned domain-wall fermion action
3  */
4 
5 #include "chromabase.h"
9 
12 
15 #include "io/param_io.h"
16 
18 
19 namespace Chroma
20 {
21 
22  //! Hooks to register the class with the fermact factory
23  namespace EvenOddPrecDWFermActArrayEnv
24  {
25  //! Callback function
26  WilsonTypeFermAct5D<LatticeFermion,
27  multi1d<LatticeColorMatrix>,
28  multi1d<LatticeColorMatrix> >* createFermAct5D(XMLReader& xml_in,
29  const std::string& path)
30  {
31  return new EvenOddPrecDWFermActArray(CreateFermStateEnv::reader(xml_in, path),
32  EvenOddPrecDWFermActArrayParams(xml_in, path));
33  }
34 
35  //! Callback function
36  /*! Differs in return type */
37  FermionAction<LatticeFermion,
38  multi1d<LatticeColorMatrix>,
39  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
40  const std::string& path)
41  {
42  return createFermAct5D(xml_in, path);
43  }
44 
45  //! Name to be used
46  const std::string name = "DWF";
47 
48  //! Local registration flag
49  static bool registered = false;
50 
51  //! Register all the factories
52  bool registerAll()
53  {
54  bool success = true;
55  if (! registered)
56  {
57  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
59  registered = true;
60  }
61  return success;
62  }
63  }
64 
65 
66  // Ancient obsolete crap
67  namespace
68  {
69 
70  //! Parameters for chiral fermion actions
71  /*! Ancient obsolete junk */
72  struct ChiralParam_t
73  {
74  ChiralParam_t(); // default constructor
75  ~ChiralParam_t() {}
76 
77  Real OverMass;
78  int N5;
79  Real a5;
80  int NWilsVec;
81  };
82 
83  //! Read chiral action like parameters
84  void read(XMLReader& xml, const std::string& path, ChiralParam_t& param);
85 
86  //! Write chiral action like parameters
87  void write(XMLWriter& xml, const std::string& path, const ChiralParam_t& param);
88 
89  //! Initialize a chiral param struct
90  ChiralParam_t::ChiralParam_t()
91  {
92  OverMass = 0;
93  N5 = 0;
94  a5 = 1;
95  NWilsVec = 0;
96  }
97 
98  //! Read chiral action like parameters
99  void read(XMLReader& xml, const std::string& path, ChiralParam_t& param)
100  {
101  XMLReader paramtop(xml, path);
102 
103  read(paramtop, "OverMass", param.OverMass);
104  read(paramtop, "N5", param.N5);
105 
106  std::string xpath;
107  xpath = "a5";
108  if (paramtop.count(xpath) != 0)
109  read(paramtop, xpath, param.a5);
110  else
111  param.a5 = 1;
112 
113  xpath = "NWilsVec";
114  if (paramtop.count(xpath) != 0)
115  read(paramtop, xpath, param.NWilsVec);
116  else
117  param.NWilsVec = 0;
118  }
119 
120  //! Write chiral action like parameters
121  void write(XMLWriter& xml, const std::string& path, const ChiralParam_t& param)
122  {
123  push(xml, path);
124 
125  write(xml, "OverMass", param.OverMass);
126  write(xml, "N5", param.N5);
127  write(xml, "a5", param.a5);
128  write(xml, "NWilsVec", param.NWilsVec);
129 
130  pop(xml);
131  }
132 
133  } // end namespace
134 
135 
136 
137  //! Read parameters
139  const std::string& path)
140  {
141  XMLReader paramtop(xml, path);
142 
143  // Check for ancient obsolete tags - try to maintain some backwards compatibility
144  if (paramtop.count("ChiralParam") != 0)
145  {
146  ChiralParam_t pp;
147  read(paramtop, "ChiralParam", pp);
148  OverMass = pp.OverMass;
149  N5 = pp.N5;
150  a5 = pp.a5;
151  }
152  else
153  {
154  // Read the stuff for the action
155  read(paramtop, "OverMass", OverMass);
156  read(paramtop, "Mass", Mass);
157  read(paramtop, "N5", N5);
158 
159  if (paramtop.count("a5") != 0)
160  read(paramtop, "a5", a5);
161  else
162  a5 = 1.0;
163  }
164 
165  // Read optional anisoParam.
166  if (paramtop.count("AnisoParam") != 0)
167  read(paramtop, "AnisoParam", anisoParam);
168  }
169 
170 
171  //! Read parameters
172  void read(XMLReader& xml, const std::string& path, EvenOddPrecDWFermActArrayParams& param)
173  {
175  param = tmp;
176  }
177 
178 
179 
180  //! Produce a preconditioned linear operator for this action with arbitrary quark mass
181  EvenOddPrecDWLikeLinOpBaseArray<LatticeFermion,
182  multi1d<LatticeColorMatrix>,
183  multi1d<LatticeColorMatrix> >*
185  const Real& m_q) const
186  {
188  }
189 
190  //! Produce an unpreconditioned linear operator for this action with arbitrary quark mass
191  UnprecDWLikeLinOpBaseArray<LatticeFermion,
192  multi1d<LatticeColorMatrix>,
193  multi1d<LatticeColorMatrix> >*
195  const Real& m_q) const
196  {
198  }
199 
200 
201  // Return possibly optimized quark prop solver, solution of preconditioned system
204  const GroupXML_t& invParam) const
205  {
206  return new DWFQpropT(linOp(state), invLinOp(state,invParam), state,
207  param.OverMass, param.Mass, param.anisoParam, invParam);
208  }
209 
210 
211  // Given a complete propagator as a source, this does all the inversions needed
212  void
213  EvenOddPrecDWFermActArray::quarkProp(LatticePropagator& q_sol,
214  XMLWriter& xml_out,
215  const LatticePropagator& q_src,
216  int t_src, int j_decay,
218  const GroupXML_t& invParam,
219  QuarkSpinType quarkSpinType,
220  bool obsvP,
221  int& ncg_had) const
222  {
223  if (obsvP && (quarkSpinType == QUARK_SPIN_TYPE_FULL))
224  {
226  dwf_quarkProp4(q_sol, xml_out, q_src, t_src, j_decay,
227  qpropT, state, getQuarkMass(), ncg_had);
228  }
229  else
230  {
232  quarkProp4(q_sol, xml_out, q_src, qprop, quarkSpinType, ncg_had);
233  }
234  }
235 
236 }
Primary include file for CHROMA library code.
4D style even-odd preconditioned domain-wall fermion action
EvenOddPrecDWLikeLinOpBaseArray< T, P, Q > * precLinOp(Handle< FermState< T, P, Q > > state, const Real &m_q) const
Produce an even-odd preconditioned linear operator for this action with arbitrary quark mass.
Real getQuarkMass() const
Return the quark mass.
UnprecDWLikeLinOpBaseArray< T, P, Q > * unprecLinOp(Handle< FermState< T, P, Q > > state, const Real &m_q) const
Produce an unpreconditioned linear operator for this action with arbitrary quark mass.
SystemSolverArray< T > * qpropT(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return possibly optimized quark prop solver, solution of preconditioned system.
EvenOddPrecDWFermActArrayParams param
void quarkProp(PropTypeTraits< T >::Type_t &q_sol, XMLWriter &xml_out, const PropTypeTraits< T >::Type_t &q_src, int t_src, int j_decay, Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam, QuarkSpinType quarkSpinType, bool obsvP, int &ncg_had) const
Given a complete propagator as a source, this does all the inversions needed.
virtual EvenOddPrecDWLikeLinOpBaseArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * linOp(Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state) const
Override to produce a DWF-link even-odd prec. linear operator for this action.
SystemSolver< LatticeFermion > * qprop(Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const GroupXML_t &invParam) const
Define quark propagator routine for 4D fermions.
4D Even Odd preconditioned domain-wall Dirac operator
4D Even Odd preconditioned domain-wall Dirac operator
Support class for fermion actions and linear operators.
Definition: state.h:94
Base class for quadratic matter actions (e.g., fermions)
Definition: fermact.h:53
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
Unpreconditioned domain-wall Dirac operator.
Unpreconditioned domain-wall Dirac operator.
Wilson-like fermion actions.
Definition: fermact.orig.h:403
virtual LinOpSystemSolverArray< T > * invLinOp(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return a linear operator solver for this action to solve M*psi=chi.
Pick up possibly optimized DWF inverters.
Full quark propagator solver for domain wall fermions.
4D style even-odd preconditioned domain-wall fermion action
4D Even Odd preconditioned domain-wall fermion linear operator
All ferm create-state method.
Fermion action factories.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
QuarkSpinType
Quark spin type.
void dwf_quarkProp4(LatticePropagator &q_sol, XMLWriter &xml_out, const LatticePropagator &q_src, int t_src, int j_decay, Handle< SystemSolverArray< LatticeFermion > > qpropT, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const Real &m_q, int &ncg_had)
Given a complete propagator as a source, this does all the inversions needed.
void quarkProp4(LatticeStaggeredPropagator &q_sol, XMLWriter &xml_out, const LatticeStaggeredPropagator &q_src, const StaggeredTypeFermAct< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &S_f, Handle< FermState< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const GroupXML_t &invParam, QuarkSpinType quarkSpinType, int &ncg_had)
Given a complete propagator as a source, this does all the inversions needed.
int j_decay
Definition: meslate.cc:22
Handle< CreateFermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the CreateFermState readers.
bool registerAll()
Register all the factories.
WilsonTypeFermAct5D< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct5D(XMLReader &xml_in, const std::string &path)
Callback function.
FermionAction< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct(XMLReader &xml_in, const std::string &path)
Callback function.
const std::string name
Name to be used.
static bool registered
Local registration flag.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
PrecFermAct5DQprop< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > DWFQpropT
Definition: dwf_qpropt_w.h:109
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
::std::string string
Definition: gtest.h:1979
Various parameter structs and reader/writers.
Full quark propagator solver.
Hold group xml and type id.
Unpreconditioned domain-wall fermion linear operator.