CHROMA
eoprec_clover_extfield_fermact_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Even-odd preconditioned Clover fermion action with an external field
3  */
4 
5 #include "chromabase.h"
6 
8 
11 
13 
17 
18 
19 namespace Chroma
20 {
21 
22  //! Hooks to register the class with the fermact factory
23  namespace EvenOddPrecCloverExtFieldFermActEnv
24  {
25 #if 0
26  // Helper function for the FermAction readers
27  Handle< CreateFermState<LatticeFermion,
28  multi1d<LatticeColorMatrix>,
29  multi1d<LatticeColorMatrix> > > reader(XMLReader& xml_in,
30  const std::string& path)
31  {
32  XMLReader top(xml_in, path);
33 
34  {
35  std::ostringstream os;
36  top.printCurrentContext(os);
37  cout << __func__ << ": top = XX" << os.str() << "XX" << std::endl;
38  }
39 
40  std::string fermstate = "FermState";
41  if (top.count(fermstate) == 0)
42  {
44  << ": did not find appropriate FermState" << std::endl;
45  QDP_abort(1);
46  }
47 
48  XMLReader paramtop(top, fermstate);
49 
50  // Read the array of function names
51  multi1d< Handle< ExternalField > > ext_field(Nd);
52 
53  try
54  {
55  for(int mu=0; mu < ext_field.size(); ++mu)
56  {
57  // Create the query for the element
58  std::ostringstream element_xpath;
59  element_xpath << "ExternalField/elem[" << (mu+1) << "]";
60 
62  read(paramtop, element_xpath.str() + "/Name", name);
63 
64  QDPIO::cout << "External field type = " << name << std::endl;
65  ext_field[mu] = TheExternalFieldFactory::Instance().createObject(name,
66  paramtop,
67  element_xpath.str());
68  }
69  }
70  catch(const std::string& e)
71  {
72  QDPIO::cerr << __func__ << ": caught exception reading XML: " << e << std::endl;
73  QDP_abort(1);
74  }
75 
76  return new CreateExtFieldFermState<LatticeFermion,
77  multi1d<LatticeColorMatrix>,
78  multi1d<LatticeColorMatrix> >(WilsonTypeFermBCEnv::reader(paramtop, "FermionBC"),
79  ext_field);
80  }
81 #endif
82 
83  //! Callback function
84  WilsonTypeFermAct<LatticeFermion,
85  multi1d<LatticeColorMatrix>,
86  multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
87  const std::string& path)
88  {
90  CloverFermActParams(xml_in, path));
91  }
92 
93  //! Callback function
94  /*! Differs in return type */
95  FermionAction<LatticeFermion,
96  multi1d<LatticeColorMatrix>,
97  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
98  const std::string& path)
99  {
100  return createFermAct4D(xml_in, path);
101  }
102 
103  //! Name to be used
104  const std::string name = "CLOVER_EXTERNAL_FIELD";
105 
106  //! Local registration flag
107  static bool registered = false;
108 
109  //! Register all the factories
110  bool registerAll()
111  {
112  bool success = true;
113  if (! registered)
114  {
115  success &= ExternalFieldEnv::registerAll();
116  success &= Chroma::TheFermionActionFactory::Instance().registerObject(name, createFermAct);
118  registered = true;
119  }
120  return success;
121  }
122  }
123 
124  //! Produce a linear operator for this action
125  /*!
126  * The operator acts on the odd subset
127  *
128  * \param state gauge field (Read)
129  */
130  EvenOddPrecLogDetLinearOperator<LatticeFermion,
131  multi1d<LatticeColorMatrix>,
132  multi1d<LatticeColorMatrix> >*
134  {
136  }
137 
138 }
139 
Primary include file for CHROMA library code.
Create a simple ferm connection state.
Create a fermion connection state.
Definition: create_state.h:69
Even-odd preconditioned Clover fermion action with an external field.
EvenOddPrecLogDetLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const
Produce a linear operator for this action.
Even-odd preconditioned Clover-Dirac operator in an external field.
Even-odd preconditioned linear operator.
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
Wilson-like fermion actions.
Definition: fermact.orig.h:344
int mu
Definition: cool.cc:24
Even-odd preconditioned Clover fermion action with an external field.
Even-odd preconditioned Clover fermion linear operator in an external field.
External field functions.
External field factory.
Fermion external field state and a creator.
All ferm create-state method.
Fermion action factories.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
Handle< FermBC< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the FermionAction readers.
Nd
Definition: meslate.cc:74
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.
Handle< FermBC< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > reader(XMLReader &xml_in, const std::string &path)
Helper function for the FermionAction readers.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
::std::string string
Definition: gtest.h:1979
Params for clover ferm acts.