CHROMA
unprec_parwilson_fermact_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Unpreconditioned Wilson fermion action with parity breaking term
3  */
4 
5 #include "chromabase.h"
8 
11 
12 #include "io/param_io.h" // to get kappaToMass
13 
14 namespace Chroma
15 {
16  //! Hooks to register the class with the fermact factory
17  namespace UnprecParWilsonFermActEnv
18  {
19  //! Callback function
20  WilsonTypeFermAct<LatticeFermion,
21  multi1d<LatticeColorMatrix>,
22  multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
23  const std::string& path)
24  {
25  return new UnprecParWilsonFermAct(CreateFermStateEnv::reader(xml_in, path),
26  UnprecParWilsonFermActParams(xml_in, path));
27  }
28 
29  //! Callback function
30  /*! Differs in return type */
31  FermionAction<LatticeFermion,
32  multi1d<LatticeColorMatrix>,
33  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
34  const std::string& path)
35  {
36  return createFermAct4D(xml_in, path);
37  }
38 
39  //! Name to be used
40  const std::string name = "UNPRECONDITIONED_PARWILSON";
41 
42  //! Local registration flag
43  static bool registered = false;
44 
45  //! Register all the factories
46  bool registerAll()
47  {
48  bool success = true;
49  if (! registered)
50  {
51  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
53  registered = true;
54  }
55  return success;
56  }
57  }
58 
59 
60  //! Read parameters
62  {
63  XMLReader paramtop(xml, path);
64 
65  read(paramtop, "H", H);
66 
67 
68  // Read the stuff for the action
69  if (paramtop.count("Mass") != 0)
70  {
71  read(paramtop, "Mass", Mass);
72  if (paramtop.count("Kappa") != 0)
73  {
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  {
80  Real Kappa;
81  read(paramtop, "Kappa", Kappa);
82  Mass = kappaToMass(Kappa); // Convert Kappa to Mass
83  }
84  else
85  {
86  QDPIO::cerr << "Error: neither Mass or Kappa found" << std::endl;
87  QDP_abort(1);
88  }
89 
90 
91  }
92 
93  //! Read parameters
94  void read(XMLReader& xml, const std::string& path, UnprecParWilsonFermActParams& param)
95  {
97  param = tmp;
98  }
99 
100 
101 
102  //! Produce a linear operator for this action
103  /*!
104  * The operator acts on the entire lattice
105  *
106  * \param state gauge field (Read)
107  */
108  UnprecLinearOperator<LatticeFermion,
109  multi1d<LatticeColorMatrix>,
110  multi1d<LatticeColorMatrix> >*
112  {
114  }
115 
116 }
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 linear operator including derivatives.
Definition: linearop.h:185
Unpreconditioned Wilson fermion action with parity breaking term.
UnprecParWilsonFermActParams param
UnprecLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
Unpreconditioned Wilson-Dirac operator with parity breaking term.
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.
static bool registered
Local registration flag.
const std::string name
Name to be used.
bool registerAll()
Register all the factories.
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 with parity breaking term.
Unpreconditioned Wilson fermion linear operator with parity breaking term.