CHROMA
unprec_dwftransf_fermact_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned Wilson fermion action
3  */
4 
5 #include "chromabase.h"
8 #include "io/param_io.h"
9 
12 
13 #include <string>
14 
15 
16 namespace Chroma
17 {
18 
19  //! Hooks to register the class with the fermact factory
20  namespace UnprecDWFTransfFermActEnv
21  {
22  //! Callback function
23  WilsonTypeFermAct<LatticeFermion,
24  multi1d<LatticeColorMatrix>,
25  multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
26  const std::string& path)
27  {
28  return new UnprecDWFTransfFermAct(CreateFermStateEnv::reader(xml_in, path),
29  UnprecDWFTransfFermActParams(xml_in, path));
30  }
31 
32  //! Callback function
33  /*! Differs in return type */
34  FermionAction<LatticeFermion,
35  multi1d<LatticeColorMatrix>,
36  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
37  const std::string& path)
38  {
39  return createFermAct4D(xml_in, path);
40  }
41 
42  //! Name to be used
43  const std::string name = "UNPRECONDITIONED_DWFTRANSF";
44 
45  //! Local registration flag
46  static bool registered = false;
47 
48  //! Register all the factories
49  bool registerAll()
50  {
51  bool success = true;
52  if (! registered)
53  {
54  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
56  registered = true;
57  }
58  return success;
59  }
60  }
61 
62 
63  //! Read parameters
65  {
66  try
67  {
68  XMLReader paramtop(xml, path);
69 
70  // Read the stuff for the action
71  if (paramtop.count("Mass") != 0) {
72  read(paramtop, "Mass", Mass);
73  if (paramtop.count("Kappa") != 0) {
74  QDPIO::cerr << "Error: found both a Kappa and a Mass tag" << std::endl;
75  QDP_abort(1);
76  }
77  }
78  else if (paramtop.count("Kappa") != 0) {
79  Real Kappa;
80  read(paramtop, "Kappa", Kappa);
81  Mass = kappaToMass(Kappa); // Convert Kappa to Mass
82  }
83  else {
84  QDPIO::cerr << "Error: neither Mass or Kappa found" << std::endl;
85  QDP_abort(1);
86  }
87 
88  // Read b5 c5 and the solver params
89  read(paramtop, "b5", b5);
90  read(paramtop, "c5", c5);
91  read(paramtop, "RsdCG", invParam.RsdCG);
92  read(paramtop, "MaxCG", invParam.MaxCG);
93  }
94  catch( const std::string& e) {
95  QDPIO::cerr << "Caught exception reading XML " << e << std::endl;
96  QDP_abort(1);
97  }
98 
99  }
100 
101 
102  //! Read parameters
103  void read(XMLReader& xml, const std::string& path, UnprecDWFTransfFermActParams& param)
104  {
106  param = tmp;
107  }
108 
109 
110 
111  //! Produce a linear operator for this action
112  /*!
113  * The operator acts on the entire lattice
114  *
115  * \param state gauge field (Read)
116  */
117  UnprecLinearOperator<LatticeFermion,
118  multi1d<LatticeColorMatrix>,
119  multi1d<LatticeColorMatrix> >*
121  {
122  return new UnprecDWFTransfLinOp(state,
123  param.Mass,
124  param.b5,
125  param.c5,
126  param.invParam);
127  }
128 
129 }
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 DWFTransf fermion action.
UnprecLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
UnprecDWFTransfFermActParams param
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.
bool registerAll()
Register all the factories.
FermionAction< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct(XMLReader &xml_in, const std::string &path)
Callback function.
const std::string name
Name to be used.
WilsonTypeFermAct< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct4D(XMLReader &xml_in, const std::string &path)
Callback function.
static bool registered
Local registration flag.
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 Wilson fermion action.
Unpreconditioned Wilson fermion linear operator.