24 template<
typename P,
typename Q>
48 push(xml_out,
"HMCTrajectory");
49 push(xml_log,
"HMCTrajectory");
52 write(xml_out,
"WarmUpP", WarmUpP);
53 write(xml_log,
"WarmUpP", WarmUpP);
58 swatch.reset(); swatch.start();
61 QDPIO::cout <<
"HMC_TIME: Momentum Refresh Time: " << swatch.getTimeInSeconds() <<
" \n";
63 bool acceptTraj =
false;
71 swatch.reset(); swatch.start();
74 QDPIO::cout <<
"HMC_TIME: Pseudofermion Refres Time: " << swatch.getTimeInSeconds() <<
" \n";
77 QDPIO::cout <<
"ERROR: Caught MG Solver exception in pseudofermion refresh" << std::endl;
78 QDPIO::cout <<
"ERROR: Exception Was: " << e.
whatStr() << std::endl;
79 QDPIO::cout <<
"Aborting";
92 push(xml_out,
"H_old");
93 push(xml_log,
"H_old");
94 swatch.reset(); swatch.start();
95 H_MC.
mesE(*s_old, KE_old, PE_old);
97 QDPIO::cout <<
"HMC_TIME: Start Energy Time: " << swatch.getTimeInSeconds() <<
" \n";
99 write(xml_out,
"KE_old", KE_old);
100 write(xml_log,
"KE_old", KE_old);
102 write(xml_out,
"PE_old", PE_old);
103 write(xml_log,
"PE_old", PE_old);
109 QDPIO::cout <<
"ERROR: Caught MG Solver exception in Start Energy Calculation" << std::endl;
110 QDPIO::cout <<
"ERROR: Exception Was: " << e.
whatStr() << std::endl;
111 QDPIO::cout <<
"Aborting";
130 QDPIO::cout <<
"HMC_TIME: Traj MD Time: " << swatch.getTimeInSeconds() <<
" \n";
139 push(xml_out,
"H_new");
140 push(xml_log,
"H_new");
141 H_MC.
mesE(
s, KE, PE);
142 write(xml_out,
"KE_new", KE);
143 write(xml_log,
"KE_new", KE);
144 write(xml_out,
"PE_new", PE);
145 write(xml_log,
"PE_new", PE);
149 QDPIO::cout <<
"HMC_TIME: Finish Energy Time: " << swatch.getTimeInSeconds() <<
" \n";
151 Double DeltaKE = KE - KE_old;
152 Double DeltaPE = PE - PE_old;
153 Double DeltaH = DeltaKE + DeltaPE;
154 Double AccProb = where(DeltaH < 0.0,
Double(1), exp(-DeltaH));
155 write(xml_out,
"deltaKE", DeltaKE);
156 write(xml_log,
"deltaKE", DeltaKE);
158 write(xml_out,
"deltaPE", DeltaPE);
159 write(xml_log,
"deltaPE", DeltaPE);
161 write(xml_out,
"deltaH", DeltaH);
162 write(xml_log,
"deltaH", DeltaH);
164 write(xml_out,
"AccProb", AccProb);
165 write(xml_log,
"AccProb", AccProb);
167 QDPIO::cout <<
"Delta H = " << DeltaH << std::endl;
168 QDPIO::cout <<
"AccProb = " << AccProb << std::endl;
187 QDPIO::cout <<
"WARNING: Caught MG Solver Convergence Exception, during MD or Final Energy Calculation!" << std::endl;
188 QDPIO::cout <<
"WARNING: Exception was: " << e.
whatStr() << std::endl;
189 QDPIO::cout <<
"WARNING: Aborting" << std::endl;
193 write(xml_out,
"AcceptP", acceptTraj);
194 write(xml_log,
"AcceptP", acceptTraj);
195 QDPIO::cout <<
"AcceptP = " << acceptTraj << std::endl;
209 swatch.reset(); swatch.start();
211 QDPIO::cout <<
"Reversing trajectory for reversability test" <<std::endl;
226 H_MC.
mesE(*s_rev, KE_rev, PE_rev);
228 Double DeltaDeltaKE = KE_rev - KE_old;
229 Double DeltaDeltaPE = PE_rev - PE_old;
230 Double DeltaDeltaH = DeltaDeltaKE + DeltaDeltaPE;
237 push(xml_log,
"ReversibilityMetrics");
238 write(xml_log,
"DeltaDeltaH", fabs(DeltaDeltaH));
239 write(xml_log,
"DeltaDeltaKE", fabs(DeltaDeltaKE));
240 write(xml_log,
"DeltaDeltaPE", fabs(DeltaDeltaPE));
241 write(xml_log,
"DeltaQPerSite", dq);
242 write(xml_log,
"DeltaPPerSite", dp);
245 QDPIO::cout <<
"Reversibility: DeltaDeltaH = " << fabs(DeltaDeltaH) <<std::endl;
246 QDPIO::cout <<
"Reversibility: DeltaQ = " << dq << std::endl;
247 QDPIO::cout <<
"Reversibility: DeltaP = " << dp << std::endl;
249 QDPIO::cout <<
"HMC_TIME: Reverse Check Time: " << swatch.getTimeInSeconds() <<
" \n";
253 QDPIO::cout <<
"WARNING: Caught MG Solver Exception in Reverse Trajectory" << std::endl;
254 QDPIO::cout <<
"WARNING: Exception was: " << e.
whatStr() << std::endl;
255 QDPIO::cout <<
"WARNING: Aborting" << std::endl;
266 if ( ! acceptTraj ) {
269 s.getQ() = s_old->getQ();
270 s.getP() = s_old->getP();
Primary include file for CHROMA library code.
virtual AbsHamiltonian< P, Q > & getMCHamiltonian(void)=0
virtual void refreshP(AbsFieldState< P, Q > &state) const =0
virtual AbsMDIntegrator< P, Q > & getMDIntegrator(void)=0
virtual void operator()(AbsFieldState< P, Q > &s, const bool WarmUpP, const bool CheckRevP)
virtual void reverseCheckMetrics(Double &deltaQ, Double &deltaP, const AbsFieldState< P, Q > &s, const AbsFieldState< P, Q > &s_old) const =0
virtual void flipMomenta(AbsFieldState< P, Q > &state) const =0
virtual bool acceptReject(const Double &DeltaH) const =0
New Abstract Hamiltonian.
virtual void mesE(const AbsFieldState< P, Q > &s, Double &KE, Double &PE) const
virtual void refreshInternalFields(const AbsFieldState< P, Q > &s)=0
Refresh pseudofermsions (if any)
New MD integrator interface.
virtual void copyFields(void) const =0
Copy equivalent fields into MD monomals before integration.
virtual Real getTrajLength(void) const =0
Get the trajectory length.
Class for counted reference semantics.
const std::string & whatStr() const
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
Asqtad Staggered-Dirac operator.
push(xml_out,"Condensates")
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
multi1d< LatticeFermion > s(Ncb)
FloatingPoint< double > Double
Singleton instances of xml output.