CHROMA
eoprec_kno_fermact_array_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief preconditioned KNO fermion action
3  */
4 
5 #include "chromabase.h"
10 
12 
15 
18 
19 namespace Chroma
20 {
21  //! Hooks to register the class with the fermact factory
22  namespace EvenOddPrecKNOFermActArrayEnv
23  {
24  //! Callback function
25  WilsonTypeFermAct5D<LatticeFermion,
26  multi1d<LatticeColorMatrix>,
27  multi1d<LatticeColorMatrix> >* createFermAct5D(XMLReader& xml_in,
28  const std::string& path)
29  {
31  EvenOddPrecKNOFermActArrayParams(xml_in, path));
32  }
33 
34  //! Callback function
35  /*! Differs in return type */
36  FermionAction<LatticeFermion,
37  multi1d<LatticeColorMatrix>,
38  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
39  const std::string& path)
40  {
41  return createFermAct5D(xml_in, path);
42  }
43 
44  //! Name to be used
45  const std::string name = "KNO";
46 
47  //! Local registration flag
48  static bool registered = false;
49 
50  //! Register all the factories
51  bool registerAll()
52  {
53  bool success = true;
54  if (! registered)
55  {
56  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
58  registered = true;
59  }
60  return success;
61  }
62  }
63 
64 
65  //! Read parameters
67  const std::string& path)
68  {
69  XMLReader paramtop(xml, path);
70  try
71  {
72  // Read the stuff for the action
73  read(paramtop, "OverMass", OverMass);
74  read(paramtop, "Mass", Mass);
75  read(paramtop, "a5", a5);
76  read(paramtop, "coefs", coefs);
77  //read(paramtop, "N5", N5);
78  N5 = coefs.size();
79  }
80  catch(const std::string& e) {
81  QDPIO::cerr << "Caught Exception : " << e << std::endl;
82  }
83  }
84 
85 
86  //! Read parameters
87  void read(XMLReader& xml, const std::string& path, EvenOddPrecKNOFermActArrayParams& param)
88  {
90  param = tmp;
91  }
92 
93 
94 
95  //! Check stuff
97  {
98  }
99 
100  void EvenOddPrecKNOFermActArray::initCoeffs(multi1d<Real>& b5_arr,
101  multi1d<Real>& c5_arr) const
102  {
103  b5_arr.resize(N5);
104  c5_arr.resize(N5);
105 
106 
107  QDPIO::cout << "Initing General NEF Linop: N5=" << N5 <<std::endl ;
108  QDPIO::cout << " a5=" << a5 <<std::endl ;
109  for(int i = 0; i < N5; i++)
110  QDPIO::cout<<" coef("<<i<<") = "<<coefs[i]<<std::endl ;
111 
112 
113  for(int i = 0; i < N5; i++) {
114  b5_arr[i] = Real(0.5)*( coefs[i] + a5 );
115  c5_arr[i] = Real(0.5)*( coefs[i] - a5 );
116 
117  QDPIO::cout << " b5["<< i << "] ="<< b5_arr[i]
118  << " c5["<< i << "] ="<< c5_arr[i] << std::endl;
119  }
120 
121  }
122 
123 
124  //! Produce a preconditioned linear operator for this action with arbitrary quark mass
125  EvenOddPrecDWLikeLinOpBaseArray<LatticeFermion,
126  multi1d<LatticeColorMatrix>,
127  multi1d<LatticeColorMatrix> >*
129  const Real& m_q) const
130  {
131  multi1d<Real> b5_arr;
132  multi1d<Real> c5_arr;
133 
134  // Cast the state up to an overlap state
135  initCoeffs(b5_arr,c5_arr);
136 
137  return new EvenOddPrecGenNEFDWLinOpArray(state,OverMass,b5_arr,c5_arr,m_q,N5);
138  }
139 
140  //! Produce an unpreconditioned linear operator for this action with arbitrary quark mass
141  UnprecDWLikeLinOpBaseArray<LatticeFermion,
142  multi1d<LatticeColorMatrix>,
143  multi1d<LatticeColorMatrix> >*
145  const Real& m_q) const
146  {
147  multi1d<Real> b5_arr;
148  multi1d<Real> c5_arr;
149 
150  // Cast the state up to an overlap state
151  initCoeffs(b5_arr,c5_arr);
152 
153  return new UnprecNEFDWLinOpArray(state,OverMass,b5_arr,c5_arr,m_q,N5);
154  }
155 
156 
157  // Given a complete propagator as a source, this does all the inversions needed
158  void
159  EvenOddPrecKNOFermActArray::quarkProp(LatticePropagator& q_sol,
160  XMLWriter& xml_out,
161  const LatticePropagator& q_src,
162  int t_src, int j_decay,
164  const GroupXML_t& invParam,
165  QuarkSpinType quarkSpinType,
166  bool obsvP,
167  int& ncg_had) const
168  {
169  if (obsvP && (quarkSpinType == QUARK_SPIN_TYPE_FULL))
170  nef_quarkProp4(q_sol, xml_out, q_src, t_src, j_decay, *this, state, invParam, ncg_had);
171  else
172  {
174  quarkProp4(q_sol, xml_out, q_src, qprop, quarkSpinType, ncg_had);
175  }
176  }
177 
178 
179 }
Primary include file for CHROMA library code.
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 NEF domain-wall Dirac operator
EvenOddPreconditioned NEF fermion action.
void quarkProp(LatticePropagator &q_sol, XMLWriter &xml_out, const LatticePropagator &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.
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.
void initCoeffs(multi1d< Real > &b5_arr, multi1d< Real > &c5_arr) const
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.
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
preconditioned KNO domain-wall fermion action
4D Even Odd preconditioned NEF domain-wall fermion linear operator generalised to take array of b_5 a...
All ferm create-state method.
Fermion action factories.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
QuarkSpinType
Quark spin type.
void nef_quarkProp4(LatticePropagator &q_sol, XMLWriter &xml_out, const LatticePropagator &q_src, int t_src, int j_decay, const UnprecDWFermActBaseArray< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &S_f, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, const GroupXML_t &invParam, 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.
const std::string name
Name to be used.
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.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
int i
Definition: pbg5p_w.cc:55
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
::std::string string
Definition: gtest.h:1979
Full quark propagator solver for domain wall fermions.
Full quark propagator solver.
Hold group xml and type id.
Unpreconditioned NEF domain-wall fermion linear operator.
Unpreconditioned Wilson fermion action.