CHROMA
eoprec_logdet_ee_monomial_w.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Even-odd preconditioned log(det(A_ee))
4  */
5 
6 #ifndef __eoprec_logdet_even_even_monomial_h__
7 #define __eoprec_logdet_even_even_monomial_h__
8 
13 #include "io/xmllog_io.h"
14 
15 
16 namespace Chroma
17 {
18 
19  //! A Monomial For Just the EvenEven part of EvenOddPrecLogDetWilsonTypeFermActs
20  /*! @ingroup monomial
21  *
22  * Monomial is expected to be the same for these fermacts
23  */
24  template<typename P, typename Q, typename Phi>
26  {
27  public:
29 
30  void dsdq(P& F, const AbsFieldState<P,Q>& s)
31  {
32  START_CODE();
33 
34  XMLWriter& xml_out = TheXMLLogWriter::Instance();
35  push(xml_out, "EvenOddPrecLogDetEvenEvenMonomial");
36 
37  // Create FermAct
39 
40  // Create a state for linop
42 
43  //Create LinOp
45 
46  lin->derivLogDetEvenEvenLinOp(F, PLUS);
47 
48  for(int mu=0; mu < Nd; mu++) {
49  F[mu] *= Real(-getNumFlavors());
50  }
51 
52  state->deriv(F);
53 
54  monitorForces(xml_out, "Forces", F);
55  pop(xml_out);
56 
57  END_CODE();
58  }
59 
60 
61  //! Gauge action value
63  {
64  START_CODE();
65 
66  XMLWriter& xml_out = TheXMLLogWriter::Instance();
67 
68  push(xml_out, "EvenOddPrecLogDetEvenEvenMonomial");
70  Handle< FermState<Phi,P,Q> > bc_g_state = FA.createState(s.getQ());
71 
72  // Need way to get gauge state from AbsFieldState<P,Q>
74 
75  Double S_ee =(Double(-getNumFlavors())*lin->logDetEvenEvenLinOp());
76  write(xml_out, "S", S_ee);
77  pop(xml_out);
78 
79  END_CODE();
80 
81  return S_ee;
82  }
83 
84 
85  void refreshInternalFields(const AbsFieldState<multi1d<LatticeColorMatrix>,
86  multi1d<LatticeColorMatrix> >& s) {
87  //No internal fields to refresh => Nop
88  }
89 
90  void setInternalFields(const Monomial<multi1d<LatticeColorMatrix>,
91  multi1d<LatticeColorMatrix> >& m) {
92  // No internal fields to refresh => Nop
93  }
94 
95  protected:
97  virtual int getNumFlavors() const = 0;
98  };
99 
100 
101  /*! @ingroup monomial */
102  namespace EvenOddPrecLogDetEvenEvenMonomial4DEnv
103  {
104  bool registerAll();
105  }
106 
107  // Parameter structure
108  /*! @ingroup monomial */
110  {
111  // Base Constructor
113 
114  // Read monomial from some root path
115  EvenOddPrecLogDetEvenEvenMonomialParams(XMLReader& in, const std::string& path);
118  };
119 
120  /*! @ingroup monomial */
121  void read(XMLReader& r, const std::string& path, EvenOddPrecLogDetEvenEvenMonomialParams& p);
122 
123  /*! @ingroup monomial */
124  void write(XMLWriter& xml, const std::string& path, const EvenOddPrecLogDetEvenEvenMonomialParams& p);
125 
126 
127  //! A Monomial For Just the EvenEven part of EvenOddPrecLogDetWilsonTypeFermActs -- concretely a 4D one
128  /*! @ingroup monomial
129  *
130  * Monomial is expected to be the same for these fermacts
131  */
133  public EvenOddPrecLogDetEvenEvenMonomial<multi1d<LatticeColorMatrix>,
134  multi1d<LatticeColorMatrix>,
135  LatticeFermion>
136  {
137  public:
138  // Typedefs to save typing
139  typedef LatticeFermion T;
140  typedef multi1d<LatticeColorMatrix> P;
141  typedef multi1d<LatticeColorMatrix> Q;
142 
143  //! Construct from param struct
145 
146  //! Copy Constructor
148 
149  //! Destructor is automagic
151 
152 
153  protected:
155  return *fermact;
156  }
157 
158  int getNumFlavors() const {
159  return num_flavors;
160  }
161 
162  private:
165  };
166 
167 } //end namespace chroma
168 
169 #endif
Monomials - gauge action or fermion binlinear contributions for HMC.
Abstract field state.
Definition: field_state.h:27
A Monomial For Just the EvenEven part of EvenOddPrecLogDetWilsonTypeFermActs – concretely a 4D one.
EvenOddPrecLogDetEvenEvenMonomial4D(const EvenOddPrecLogDetEvenEvenMonomialParams &p)
Construct from param struct.
Handle< EvenOddPrecLogDetWilsonTypeFermAct< T, P, Q > > fermact
EvenOddPrecLogDetEvenEvenMonomial4D(const EvenOddPrecLogDetEvenEvenMonomial4D &m)
Copy Constructor.
const EvenOddPrecLogDetWilsonTypeFermAct< T, P, Q > & getFermAct(void) const
A Monomial For Just the EvenEven part of EvenOddPrecLogDetWilsonTypeFermActs.
void dsdq(P &F, const AbsFieldState< P, Q > &s)
Compute dsdq for the system... Not specified how to actually do this.
Double S(const AbsFieldState< P, Q > &s)
Gauge action value.
virtual const EvenOddPrecLogDetWilsonTypeFermAct< Phi, P, Q > & getFermAct() const =0
void refreshInternalFields(const AbsFieldState< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &s)
Refresh pseudofermion fields if any.
void setInternalFields(const Monomial< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > &m)
Copy pseudofermions if any.
Even-odd preconditioned Wilson-like fermion action, specialised to clover like (gauge dependent diago...
virtual EvenOddPrecLogDetLinearOperator< T, P, Q > * linOp(Handle< FermState< T, P, Q > > state) const =0
Override to produce an even-odd prec. linear operator for this action.
Abstract monomial class, for exact algorithms.
Definition: abs_monomial.h:75
virtual FermState< T, P, Q > * createState(const Q &q) const
Given links (coordinates Q) create the state needed for the linear operators.
Definition: fermact.h:59
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
int mu
Definition: cool.cc:24
Even-odd const determinant Wilson-like fermact.
Field state.
Helper function for calculating forces.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
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
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
push(xml_out,"Condensates")
@ PLUS
Definition: chromabase.h:45
pop(xml_out)
START_CODE()
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
static QDP_ColorVector * in
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
Hold group xml and type id.
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13
Singleton instances of xml output.
static INTERNAL_PRECISION F