CHROMA
unprec_two_flavor_ratio_conv_conv_multihasen_monomial_w.cc
Go to the documentation of this file.
1 /*! @file
2  * @brief Two-flavor collection of unpreconditioned 4D ferm monomials
3  */
4 
5 #include "chromabase.h"
8 
11 
14 
15 
16 namespace Chroma
17 {
18 
19  namespace UnprecTwoFlavorRatioConvConvMultihasenWilsonTypeFermMonomialEnv
20  {
21  namespace
22  {
23  //! Callback function for the factory
25  multi1d<LatticeColorMatrix> >* createMonomial(XMLReader& xml, const std::string& path)
26  {
29  }
30 
31  //! Local registration flag
32  bool registered = false;
33  }
34 
35  const std::string name("TWO_FLAVOR_UNPREC_RATIO_CONV_CONV_MULTIHASEN_FERM_MONOMIAL");
36 
37  //! Register all the factories
38  bool registerAll()
39  {
40  bool success = true;
41  if (! registered)
42  {
44  success &= TheMonomialFactory::Instance().registerObject(name, createMonomial);
45  registered = true;
46  }
47  return success;
48  }
49  } //end namespace Unprec TwoFlavorRatioConvConvWilsonFermMonomialEnv
50 
51 
52  // Constructor
55  {
56  START_CODE();
57 
58  QDPIO::cout << "Constructor: " << __func__ << std::endl;
59 
60  if( param.numer.invParam.id == "NULL" ) {
61  QDPIO::cerr << "Numerator inverter params are NULL" << std::endl;
62  QDP_abort(1);
63  }
64 
65  invParam_num = param.numer.invParam;
66 
67  if( param.denom.invParam.id == "NULL" ) {
68  QDPIO::cerr << "WARNING: No inverter params provided for denominator." << std::endl;
69  QDPIO::cerr << "WARNING: Assuming same as for numerator " << std::endl;
70  invParam_den = param.numer.invParam;
71  }
72  else {
73  invParam_den = param.denom.invParam;
74  }
75 
76 
77  //*********************************************************************
78  // Fermion action
79  {
80  std::istringstream is(param.numer.fermact.xml);
81  XMLReader fermact_reader(is);
82  QDPIO::cout << "Construct numer fermion action= " << param.numer.fermact.id << std::endl;
83 
84  WilsonTypeFermAct<T,P,Q>* tmp_act =
85  TheWilsonTypeFermActFactory::Instance().createObject(param.numer.fermact.id,
86  fermact_reader,
87  param.numer.fermact.path);
88 
89  UnprecWilsonTypeFermAct<T,P,Q>* downcast=dynamic_cast<UnprecWilsonTypeFermAct<T,P,Q>*>(tmp_act);
90 
91  // Check success of the downcast
92  if( downcast == 0x0 )
93  {
94  QDPIO::cerr << __func__ << ": unable to downcast FermAct to UnprecWilsonTypeFermAct" << std::endl;
95  QDP_abort(1);
96  }
97 
98  fermact_num = downcast;
99  }
100 
101  //*********************************************************************
102  // Fermion action
103  {
104  std::istringstream is(param.denom.fermact.xml);
105  XMLReader fermact_reader(is);
106  QDPIO::cout << "Construct denom fermion action= " << param.denom.fermact.id << std::endl;
107 
108  WilsonTypeFermAct<T,P,Q>* tmp_act =
109  TheWilsonTypeFermActFactory::Instance().createObject(param.denom.fermact.id,
110  fermact_reader,
111  param.denom.fermact.path);
112 
113  UnprecWilsonTypeFermAct<T,P,Q>* downcast=dynamic_cast<UnprecWilsonTypeFermAct<T,P,Q>*>(tmp_act);
114 
115  // Check success of the downcast
116  if( downcast == 0x0 )
117  {
118  QDPIO::cerr << __func__ << ": unable to downcast FermAct to UnprecWilsonTypeFermAct" << std::endl;
119  QDP_abort(1);
120  }
121 
122  fermact_den = downcast;
123  }
124  //*********************************************************************
125 
126  //*********************************************************************
127  // Number of Hasenbusch term
128  numHasenTerms = param.masses.size();
129  //*********************************************************************
130 
131  //*********************************************************************
132  // Get Chronological predictor
133  {
135  if( param.predictor.xml == "" ) {
136  // No predictor specified use zero guess
138  }
139  else
140  {
141  try
142  {
143  std::istringstream chrono_is(param.predictor.xml);
144  XMLReader chrono_xml(chrono_is);
146  chrono_xml,
147  param.predictor.path);
148  }
149  catch(const std::string& e ) {
150  QDPIO::cerr << "Caught Exception Reading XML: " << e << std::endl;
151  QDP_abort(1);
152  }
153  }
154 
155  if( tmp == 0x0 ) {
156  QDPIO::cerr << "Failed to create the 4D ChronoPredictor" << std::endl;
157  QDP_abort(1);
158  }
159  chrono_predictor = tmp;
160  }
161  //*********************************************************************
162 
163  QDPIO::cout << "Finished constructing: " << __func__ << std::endl;
164 
165  END_CODE();
166  }
167  // Sum over all Hasenbusch term to get total action
169  Double S=0;
170  for(int i=0; i<numHasenTerms; ++i){
171  S += multihasenMonomial[i]->S(s);
172  }
173  return S;
174  }
175 
176  // Sum over all Force terms
178  dsdq(P& F, const AbsFieldState<P,Q>& s){
179  P F_t = zero;
180  for(int i=0; i<numHasenTerms; ++i){
181  numltihasenMonomial[i]->dsdq(F, s);
182  F_t += F;
183  }
184  F = F_t;
185  }
186 
187  // Refresh pseudofermion field of all Hasenbusch term
188  void UnprecTwoFlavorRatioConvConvMultihasenWilsonTypeFermMonomial::
189  refreshInteralFields(const AbsFieldState<P,Q>& field_state){
190  for(int i=0; i<numHasenTerms; ++i){
191  multihasenMonomial[i]->refreshIntermalFields(field_state)
192 
193 
194 
195 } //end namespace Chroma
Primary include file for CHROMA library code.
Monomial factories.
Abstract field state.
Definition: field_state.h:27
An abstract monomial class, for inexact algorithms.
Definition: abs_monomial.h:43
static T & Instance()
Definition: singleton.h:432
mult1d< Handle< UnprecTwoFlavorRatioConvConvWilsonTypeFermMonomial > > multihasenMonomial
UnprecTwoFlavorRatioConvConvMultihasenWilsonTypeFermMonomial(const TwoFlavorRatioConvConvMultihasenWilsonTypeFermMonomialParams &param_)
Unpreconditioned Wilson-like fermion actions with derivatives.
Definition: fermact.orig.h:491
Wilson-like fermion actions.
Definition: fermact.orig.h:344
Zero initial guess predictor.
Fermion action factories.
All Wilson-type fermion actions.
Monomial factories.
static bool registered
Local registration flag.
const std::string name
Name to be used.
Monomial< multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createMonomial(XMLReader &xml, const std::string &path)
Callback function for the factory.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
int i
Definition: pbg5p_w.cc:55
START_CODE()
Double zero
Definition: invbicg.cc:106
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
multi1d< LatticeColorMatrix > P
Definition: t_clover.cc:13
Two flavor Monomials - gauge action or fermion binlinear contributions for HMC.
Zero initial guess predictor.
static INTERNAL_PRECISION F