CHROMA
asqtad_fermact_s.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Asqtad staggered fermion action
3  */
4 // NEW $Id: asqtad_fermact_s.cc 2003/11/12 steve
5 
6 #include "chromabase.h"
7 //#include "actions/ferm/linop/asqtad_linop_s.h"
8 //#include "actions/ferm/fermacts/asqtad_fermact_s.h"
9 //#include "actions/ferm/linop/lmdagm_s.h"
10 
13 
18 
19 namespace Chroma
20 {
21 
22  //! Hooks to register the class with the fermact factory
23  namespace AsqtadFermActEnv
24  {
25  //! Callback function
26  StaggeredTypeFermAct<LatticeStaggeredFermion,
27  multi1d<LatticeColorMatrix>,
28  multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
29  const std::string& path)
30  {
31  return new AsqtadFermAct(StaggeredCreateFermStateEnv::reader(xml_in, path),
32  AsqtadFermActParams(xml_in, path));
33  }
34 
35  //! Callback function
36  /*! Differs in return type */
37  FermionAction<LatticeStaggeredFermion,
38  multi1d<LatticeColorMatrix>,
39  multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
40  const std::string& path)
41  {
42  return createFermAct4D(xml_in, path);
43  }
44 
45  //! Name to be used
46  const std::string name = "ASQTAD";
47 
48  //! Local registration flag
49  static bool registered = false;
50 
51  //! Register all the factories
52  bool registerAll()
53  {
54  bool success = true;
55  if (! registered)
56  {
59  registered = true;
60  }
61  return success;
62  }
63  }
64 
65 
66  //! Produce a linear operator for this action
67  /*!
68  * \ingroup fermact
69  *
70  * The operator acts on the entire lattice
71  *
72  * \param u_fat, u_triple fat7 and triple links (Read)
73  * \u has already had KS phases multiplied in.
74  */
75  EvenOddLinearOperator<LatticeStaggeredFermion,
76  multi1d<LatticeColorMatrix>,
77  multi1d<LatticeColorMatrix> >*
79  {
80 
81  // Why in fact are we casting to the base class on both sides of
82  // this assignment ? The answer is so that we can use a proxy.
83  // Both the Proxy and the ConnectState inherit from the BaseClass
84  // and can be cast to and from the base class. However the Proxy
85  // and the connect state cannot be directly cast into each other.
86  // Which is why we have a virtual base class in the first place.
87  //
88  // So We cast the ConnectState to an AsqtadConnectStateBase
89  // This we can do at our leisure from either AsqtadConnectState
90  // OR from the Proxy. We then get access to all the virtual methods
91  // in the AsqtadConnectState. Only Restriction: We have to use the
92  // get() methods as they are all the base class provides.
93  return new AsqtadLinOp(state.cast<AsqtadConnectStateBase>(), param.Mass);
94  }
95 
96  //! Produce a M^dag.M linear operator for this action
97  /*!
98  * \ingroup fermact
99  *
100  * The operator acts on the checkerboarded lattice
101  *
102  * \param u_fat, u_triple fat7 and triple links (Read)
103  */
104  DiffLinearOperator<LatticeStaggeredFermion,
105  multi1d<LatticeColorMatrix>,
106  multi1d<LatticeColorMatrix> >*
108  {
109  return new AsqtadMdagM(state.cast<AsqtadConnectStateBase>(), param.Mass);
110  }
111 
112 
113  //! Create a state -- this multiplies in the K-S phases computes the fat and triple links etc
115  AsqtadFermAct::createState(const multi1d<LatticeColorMatrix>& u_) const
116  {
117  multi1d<LatticeColorMatrix> u_with_phases(Nd);
118  multi1d<LatticeColorMatrix> u_fat(Nd);
119  multi1d<LatticeColorMatrix> u_triple(Nd);
120 
121  // First put in the BC
122  u_with_phases = u_;
123  getFermBC().modify(u_with_phases);
124 
125  // Now multiply in phases
126  //
127  // alpha comes from the StagPhases:: namespace
128  for(int i = 0; i < Nd; i++) {
129  u_with_phases[i] *= StagPhases::alpha(i);
130  }
131 
132  // Make Fat7 and triple links
133  Fat7_Links(u_with_phases, u_fat, param.u0);
134  Triple_Links(u_with_phases, u_triple, param.u0);
135 
136  return new AsqtadConnectState(cfs->getFermBC(), u_with_phases, u_fat, u_triple);
137  }
138 
139 } // End Namespace Chroma
140 
Asqtad staggered fermion action.
Unpreconditioned Wilson fermion linear operator.
Primary include file for CHROMA library code.
Basic "Connect State" for ASQTAD.
Definition: asqtad_state.h:24
The actual Asqtad thing.
Definition: asqtad_state.h:48
Asqtad staggered fermion action.
Handle< CreateFermState< T, P, Q > > cfs
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this action.
AsqtadFermActParams param
AsqtadConnectStateBase * createState(const Q &u_) const
Create state should apply the BC.
Asqtad Staggered-Dirac operator.
Differentiable Linear Operator.
Definition: linearop.h:98
Even odd Linear Operator (for staggered like things )
Definition: eo_linop.h:28
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
Staggered-like fermion actions.
Definition: fermact.orig.h:644
All ferm create-state method.
Fermion action factories.
DiffLinearOperator< T, P, Q > * lMdagM(Handle< FermState< T, P, Q > > state_) const
Produce a linear operator M^dag.M for this action.
EvenOddLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state_) const
Produce a linear operator for this action.
void Triple_Links(multi1d< LatticeColorMatrix > &u, multi1d< LatticeColorMatrix > &u_triple, Real u0)
Definition: naik_term_s.cc:33
void Fat7_Links(multi1d< LatticeColorMatrix > &u, multi1d< LatticeColorMatrix > &uf, Real u0)
FAT7_LINKS.
Definition: fat7_links_s.cc:21
Nd
Definition: meslate.cc:74
StaggeredTypeFermAct< LatticeStaggeredFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermAct4D(XMLReader &xml_in, const std::string &path)
Callback function.
bool registerAll()
Register all the factories.
FermionAction< LatticeStaggeredFermion, 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.
static const LatticeInteger & alpha(const int dim)
Definition: stag_phases_s.h:43
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
int i
Definition: pbg5p_w.cc:55
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
::std::string string
Definition: gtest.h:1979
Params for asqtad ferm acts.