CHROMA
gauge_monomial.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Generic gauge action monomial wrapper
4  */
5 
6 #ifndef __gaugeact_monomial_h__
7 #define __gaugeact_monomial_h__
8 
9 #include "chromabase.h"
10 
14 #include "io/xmllog_io.h"
15 
16 namespace Chroma
17 {
18  /*! @ingroup monomial */
19  namespace GaugeMonomialEnv
20  {
21  extern const std::string name;
22  bool registerAll();
23  }
24 
25 
26  // Parameter structure
27  /*! @ingroup monomial */
29  {
30  // Base Constructor
32 
33  // Read monomial from some root path
34  GaugeMonomialParams(XMLReader& in, const std::string& path);
36  };
37 
38 
39  //! Wrapper class for gauge monomials
40  /*! @ingroup monomial
41  *
42  * Monomial is expected to be the same for these fermacts
43  */
44  class GaugeMonomial :
45  public ExactMonomial< multi1d<LatticeColorMatrix>,
46  multi1d<LatticeColorMatrix> >
47  {
48  public:
49  typedef multi1d<LatticeColorMatrix> P;
50  typedef multi1d<LatticeColorMatrix> Q;
51 
52  //! Construct out of a parameter struct. Check against the desired GaugeAct name
53  GaugeMonomial(const GaugeMonomialParams& param_);
54 
55  //! Copy Constructor
57 
58  //! Create a suitable state and compute F
59  void dsdq(P& F, const AbsFieldState<P,Q>& s)
60  {
61  START_CODE();
62 
63  XMLWriter& xml_out = TheXMLLogWriter::Instance();
64  push(xml_out, "GaugeMonomial");
65 
66  // Make a gauge connect state
67  Handle< GaugeState<P,Q> > g_state(getGaugeAct().createState(s.getQ()));
68 
69  getGaugeAct().deriv(F, g_state);
70 
71  monitorForces(xml_out, "Forces", F);
72  pop(xml_out);
73 
74  END_CODE();
75  }
76 
77 
78  //! Gauge action value
80  {
81  START_CODE();
82 
83  XMLWriter& xml_out = TheXMLLogWriter::Instance();
84  push(xml_out, "GaugeMonomial");
85 
86  Handle< GaugeState<P,Q> > g_state(getGaugeAct().createState(s.getQ()));
87  Double action = getGaugeAct().S(g_state);
88 
89  write(xml_out, "S", action);
90  pop(xml_out);
91 
92  END_CODE();
93 
94  return action;
95  }
96 
97 
99  {
100  //No internal fields to refresh => Nop
101  }
102 
104  {
105  // No internal fields to refresh => Nop
106  }
107 
108  protected:
109  const GaugeAction<P,Q>& getGaugeAct(void) const {
110  return *gaugeact;
111  }
112 
113  private:
114  // Hide empty constructor and =
116  void operator=(const GaugeMonomial&);
117 
118  private:
119  // A handle for the gaugeact
121  };
122 
123 
124 } //end namespace chroma
125 
126 #endif
Monomials - gauge action or fermion binlinear contributions for HMC.
Primary include file for CHROMA library code.
Abstract field state.
Definition: field_state.h:27
Abstract monomial class, for exact algorithms.
Definition: abs_monomial.h:75
Abstract base class for gauge actions.
Definition: gaugeact.h:25
Wrapper class for gauge monomials.
void dsdq(P &F, const AbsFieldState< P, Q > &s)
Create a suitable state and compute F.
void operator=(const GaugeMonomial &)
void setInternalFields(const Monomial< P, Q > &m)
Copy pseudofermions if any.
multi1d< LatticeColorMatrix > P
Double S(const AbsFieldState< P, Q > &s)
Gauge action value.
const GaugeAction< P, Q > & getGaugeAct(void) const
Handle< GaugeAction< P, Q > > gaugeact
GaugeMonomial(const GaugeMonomial &m)
Copy Constructor.
multi1d< LatticeColorMatrix > Q
void refreshInternalFields(const AbsFieldState< P, Q > &s)
Refresh pseudofermion fields if any.
Class for counted reference semantics.
Definition: handle.h:33
An abstract monomial class, for inexact algorithms.
Definition: abs_monomial.h:43
static T & Instance()
Definition: singleton.h:432
Field state.
Helper function for calculating forces.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void monitorForces(XMLWriter &xml_out, const std::string &path, const multi1d< LatticeColorMatrix > &F)
Calculate and write out forces.
static int m[4]
Definition: make_seeds.cc:16
const std::string name
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
push(xml_out,"Condensates")
pop(xml_out)
START_CODE()
static QDP_ColorVector * in
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
Singleton instances of xml output.
static INTERNAL_PRECISION F