CHROMA
klein_gordon_fermact_s.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Klein-Gordon boson action masquerading action as a staggered action
3  */
4 
7 
10 
11 namespace Chroma
12 {
13  // Default constructor
15  {
16  Mass = 0.0;
17  }
18 
19  // Read parameters
21  {
22  XMLReader paramtop(xml, path);
23 
24  // Read the stuff for the action
25  read(paramtop, "Mass", Mass);
26 
27  // Read optional anisoParam.
28  if (paramtop.count("AnisoParam") != 0)
29  read(paramtop, "AnisoParam", anisoParam);
30  }
31 
32  // Read parameters
33  void read(XMLReader& xml, const std::string& path, KleinGordonFermActParams& param)
34  {
35  KleinGordonFermActParams tmp(xml, path);
36  param = tmp;
37  }
38 
39  // Writer parameters
40  void write(XMLWriter& xml, const std::string& path, const KleinGordonFermActParams& param)
41  {
42  push(xml, path);
43 
44  write(xml, "Mass", param.Mass);
45  if (param.anisoParam.anisoP)
46  write(xml, "AnisoParam", param.anisoParam);
47 
48  pop(xml);
49  }
50 
51 
52  //! Hooks to register the class with the fermact factory
53  namespace KleinGordonFermActEnv
54  {
55  //! Callback function
56  StaggeredTypeFermAct<LatticeStaggeredFermion,
57  multi1d<LatticeColorMatrix>,
58  multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
59  const std::string& path)
60  {
62  KleinGordonFermActParams(xml_in, path));
63  }
64 
65  //! Callback function
66  /*! Differs in return type */
67  FermionAction<LatticeStaggeredFermion,
68  multi1d<LatticeColorMatrix>,
69  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
70  const std::string& path)
71  {
72  return createFermAct4D(xml_in, path);
73  }
74 
75  //! Name to be used
76  const std::string name = "KLEIN_GORDON";
77 
78  //! Local registration flag
79  static bool registered = false;
80 
81  //! Register all the factories
82  bool registerAll()
83  {
84  bool success = true;
85  if (! registered)
86  {
89  registered = true;
90  }
91  return success;
92  }
93  }
94 
95 
96  //! Create a state -- this multiplies in the K-S phases computes the fat and triple links etc
97  FermState<LatticeStaggeredFermion,
98  multi1d<LatticeColorMatrix>,
99  multi1d<LatticeColorMatrix> >*
100  KleinGordonFermAct::createState(const multi1d<LatticeColorMatrix>& u_) const
101  {
102  return getCreateState()(u_);
103  }
104 
105 
106  // Produce a linear operator for this action
107  UnprecLinearOperator<LatticeStaggeredFermion,
108  multi1d<LatticeColorMatrix>,
109  multi1d<LatticeColorMatrix> >*
111  {
113  }
114 
115 
116  // Produce a M^dag.M linear operator for this action
117  DiffLinearOperator<LatticeStaggeredFermion,
118  multi1d<LatticeColorMatrix>,
119  multi1d<LatticeColorMatrix> >*
121  {
122  return new DiffMdagMLinOp<T,P,Q>(this->linOp(state));
123  }
124 
125 
126 #if 0
127  // Already supplied in chroma/lib/actions/ferm/qprop/quarkprop_s.cc
128 
129  // Return a linear operator solver for this action to solve MdagM*psi=chi
132  const GroupXML_t& invParam) const
133  {
134  std::istringstream xml(invParam.xml);
135  XMLReader paramtop(xml);
136 
137  return TheMdagMStagFermSystemSolverFactory::Instance().createObject(invParam.id,
138  paramtop,
139  invParam.path,
140  linOp(state));
141  }
142 
143 
144  // Return a multi-shift linear operator solver for this action to solve (MdagM+shift)*psi=chi
147  const GroupXML_t& invParam) const
148  {
149  std::istringstream xml(invParam.xml);
150  XMLReader paramtop(xml);
151 
152  return TheMdagMStagFermMultiSystemSolverFactory::Instance().createObject(invParam.id,
153  paramtop,
154  invParam.path,
155  lMdagM(state));
156  }
157 
158  // Return a multi-shift linear operator solver for this action to solve (MdagM+shift)*psi=chi
161  const GroupXML_t& invParam) const
162  {
163  std::istringstream xml(invParam.xml);
164  XMLReader paramtop(xml);
165 
167  paramtop,
168  invParam.path,
169  lMdagM(state));
170  }
171 
172 
173  // Return quark prop solver, solution of unpreconditioned system
174 // SystemSolver<T>*
175 // KleinGordonFermAct::qprop(Handle< FermState<T,P,Q> > state,
176 // const GroupXML_t& invParam) const;
177 #endif
178 
179 
180 } // End Namespace Chroma
181 
Differentiable Linear Operator.
Definition: linearop.h:98
Differentiable M^dag.M linear operator.
Definition: lmdagm.h:160
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
Klein-Gordon boson action.
DiffLinearOperator< T, P, Q > * lMdagM(Handle< FermState< T, P, Q > > state_) const
Produce a linear operator M^dag.M for this action.
const CreateFermState< T, P, Q > & getCreateState() const
Return the fermion BC object for this action.
FermState< T, P, Q > * createState(const Q &u_) const
Create state should apply the BC.
UnprecLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state_) const
Produce a linear operator for this action.
KleinGordonFermActParams param
SystemSolver disambiguator.
static T & Instance()
Definition: singleton.h:432
Staggered-like fermion actions.
Definition: fermact.orig.h:644
virtual MdagMMultiSystemSolverAccumulate< T > * mInvMdagMAcc(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return a multi-shift linear operator solver for this action to solve (MdagM+shift)*psi=chi.
virtual MdagMMultiSystemSolver< T > * mInvMdagM(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return a multi-shift linear operator solver for this action to solve (MdagM+shift)*psi=chi.
virtual MdagMSystemSolver< T > * invMdagM(Handle< FermState< T, P, Q > > state, const GroupXML_t &invParam) const
Return a linear operator solver for this action to solve MdagM*psi=chi.
Unpreconditioned linear operator including derivatives.
Definition: linearop.h:185
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.
Klein-Gordon boson action masquerading action as a staggered action.
Klein-Gordon operator.
const std::string name
Name to be used.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
StaggeredTypeFermAct< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct4D(XMLReader &xml_in, const std::string &path)
Callback function.
FermionAction< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct(XMLReader &xml_in, const std::string &path)
Callback function.
Handle< CreateFermState< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the CreateFermState readers.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
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
Hold group xml and type id.
Params for klein-gordon action.
SystemSolver disambiguator.