Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Grid/qcd/hmc/HMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,20 @@ struct HMCparameters: Serializable {
};

template <class IntegratorType>
class HybridMonteCarlo {
class HybridMonteCarlo
/*! @brief The HMC class,
* which performs the metropolis
* accept/reject step and molecular dynamics
* integration step.
*
* As introduced in Duane, Kennedy, Pendleton & Roweth,
* Phys. Letters B, 2, 1987
* https://doi.org/10.1016/0370-2693(87)91197-X
*
* See Rothe, Third Edition, Section 16.7
* 'The Hybrid Monte Carlo Algorithm'
*/
{
private:
const HMCparameters Params;

Expand Down Expand Up @@ -289,7 +302,7 @@ class HybridMonteCarlo {
std::cout << GridLogDebug << "Observables # " << obs << std::endl;
std::cout << GridLogDebug << "Observables total " << Observables.size() << std::endl;
std::cout << GridLogDebug << "Observables pointer " << Observables[obs] << std::endl;
Observables[obs]->TrajectoryComplete(traj + 1, TheIntegrator.Smearer, sRNG, pRNG);
Observables[obs]->TrajectoryComplete(traj + 1, TheIntegrator.Smearer, sRNG, pRNG, accept);
}
std::cout << GridLogHMC << ":::::::::::::::::::::::::::::::::::::::::::" << std::endl;
}
Expand Down
34 changes: 33 additions & 1 deletion Grid/qcd/observables/hmc_observable.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ directory
NAMESPACE_BEGIN(Grid);

template <class Field>
class HmcObservable {
class HmcObservable
/*! @brief HMC Observable class,
* HMC observables inherit the method
* TrajectoryComplete from here, which
* is used to run the computation of
* on-the-fly observables.
*
* Expects:
* an integer traj : trajectory number
* a reference to ConfigurationBase : the gauge field configuration
* a reference to a serial RNG
* a reference to a parallel RNG
*/
{
public:
virtual void TrajectoryComplete(int traj,
ConfigurationBase<Field> &SmartConfig,
Expand All @@ -45,6 +58,25 @@ class HmcObservable {
Field &U,
GridSerialRNG &sRNG,
GridParallelRNG &pRNG) = 0;

// allow backward compatibility with current observables that do not have
// acceptance argument
virtual void TrajectoryComplete(int traj,
ConfigurationBase<Field> &SmartConfig,
GridSerialRNG &sRNG,
GridParallelRNG &pRNG,
bool accept)
{
TrajectoryComplete(traj,SmartConfig.get_U(false),sRNG,pRNG,accept); // Unsmeared observable
};
virtual void TrajectoryComplete(int traj,
Field &U,
GridSerialRNG &sRNG,
GridParallelRNG &pRNG,
bool accept)
{
TrajectoryComplete(traj, U, sRNG, pRNG);
};
};

NAMESPACE_END(Grid);
Expand Down
Loading