CHROMA
unprec_hamberwu_fermact_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned Hamber-Wu fermion action
3  */
4 
5 #include "chromabase.h"
8 
11 
12 #include "io/param_io.h"
13 
14 namespace Chroma
15 {
16 
17  //! Hooks to register the class with the fermact factory
18  namespace UnprecHamberWuFermActEnv
19  {
20  //! Callback function
21  WilsonTypeFermAct<LatticeFermion,
22  multi1d<LatticeColorMatrix>,
23  multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
24  const std::string& path)
25  {
26  return new UnprecHamberWuFermAct(CreateFermStateEnv::reader(xml_in, path),
27  UnprecHamberWuFermActParams(xml_in, path));
28  }
29 
30  //! Callback function
31  /*! Differs in return type */
32  FermionAction<LatticeFermion,
33  multi1d<LatticeColorMatrix>,
34  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
35  const std::string& path)
36  {
37  return createFermAct4D(xml_in, path);
38  }
39 
40  //! Name to be used
41  const std::string name = "UNPRECONDITIONED_HAMBER-WU";
42 
43  //! Local registration flag
44  static bool registered = false;
45 
46  //! Register all the factories
47  bool registerAll()
48  {
49  bool success = true;
50  if (! registered)
51  {
52  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
54  registered = true;
55  }
56  return success;
57  }
58  }
59 
60 
61  //! Read parameters
63  {
64  XMLReader paramtop(xml, path);
65 
66  // Read the stuff for the action
67  if (paramtop.count("Mass") != 0)
68  {
69  read(paramtop, "Mass", Mass);
70  if (paramtop.count("Kappa") != 0)
71  {
72  QDPIO::cerr << "Error: found both a Kappa and a Mass tag" << std::endl;
73  QDP_abort(1);
74  }
75  }
76  else if (paramtop.count("Kappa") != 0)
77  {
78  Real Kappa;
79  read(paramtop, "Kappa", Kappa);
80  Mass = kappaToMass(Kappa); // Convert Kappa to Mass
81  }
82  else
83  {
84  QDPIO::cerr << "Error: neither Mass or Kappa found" << std::endl;
85  QDP_abort(1);
86  }
87 
88  read(paramtop, "u0", u0);
89 
90  // Read optional aniso
91  if (paramtop.count("AnisoParam") != 0)
92  read(paramtop, "AnisoParam", anisoParam);
93  }
94 
95 
96  //! Read parameters
97  void read(XMLReader& xml, const std::string& path, UnprecHamberWuFermActParams& param)
98  {
100  param = tmp;
101  }
102 
103 
104 
105  //! Produce a linear operator for this action
106  /*!
107  * The operator acts on the entire lattice
108  *
109  * \param state gauge field (Read)
110  */
111  UnprecLinearOperator<LatticeFermion,
112  multi1d<LatticeColorMatrix>,
113  multi1d<LatticeColorMatrix> >*
115  {
116  if (param.anisoParam.anisoP)
117  {
118  QDPIO::cerr << "UnprecHamberWuFermAct::linOp - currently no aniso support" << std::endl;
119  QDP_abort(1);
120  }
121 
122  return new UnprecHamberWuLinOp(state, param.Mass, param.u0);
123  }
124 
125 }
Primary include file for CHROMA library code.
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 HamberWu fermion action.
UnprecLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
UnprecHamberWuFermActParams param
Unpreconditioned Hamber-Wu operator.
Unpreconditioned linear operator including derivatives.
Definition: linearop.h:185
Wilson-like fermion actions.
Definition: fermact.orig.h:344
All ferm create-state method.
Fermion action factories.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
Real kappaToMass(const Real &Kappa)
Convert a Kappa to a mass.
Definition: param_io.cc:12
Handle< CreateFermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the CreateFermState readers.
WilsonTypeFermAct< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct4D(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.
bool registerAll()
Register all the factories.
static bool registered
Local registration flag.
const std::string name
Name to be used.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
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.
Unpreconditioned Hamber-Wu fermion action.
Unpreconditioned Hamber-Wu fermion linear operator.