![]() |
QMCPACK
|
Manages the state of QMC sections and handles population control for DMCs. More...
Classes | |
struct | VParams |
controlling parameters of full precision real type More... | |
Public Member Functions | |
SFNBranch (RealType tau, RealType feedback, DMCRefEnergyScheme) | |
Constructor. More... | |
SFNBranch (const SFNBranch &abranch)=delete | |
copy constructor More... | |
~SFNBranch () | |
bool | phaseChanged (RealType psi0) const |
void | advanceQMCCounter () |
increment QMCCounter More... | |
void | regressQMCCounter () |
int | initParam (const MCPopulation &population, FullPrecRealType ene, FullPrecRealType var, bool fixW, bool killwalker) |
initialize branching parameters More... | |
RealType | branchWeightBare (RealType enew, RealType eold) const |
return the bare branch weight More... | |
RealType | branchWeight (FullPrecRealType enew, FullPrecRealType eold) const |
return the bare branch weight with a filtering using an energy window More... | |
RealType | symLinkAction (RealType logGf, RealType logGb, RealType enew, RealType eold) const |
RealType | symLinkActionBare (RealType logGf, RealType logGb, RealType enew, RealType eold) const |
RealType | DMCLinkAction (RealType enew, RealType eold) const |
RealType | branchWeight (RealType enew, RealType eold, RealType scnew, RealType scold) const |
return the branch weight according to JCP1993 Umrigar et al. More... | |
RealType | branchWeight (RealType enew, RealType eold, RealType scnew, RealType scold, RealType p) const |
return the branch weight according to JCP1993 Umrigar et al. More... | |
RealType | getEref () const |
RealType | getEtrial () const |
RealType | getTau () const |
RealType | getTauEff () const |
int | getWarmupToDoSteps () const |
void | updateParamAfterPopControl (const MCDataType< FullPrecRealType > &wc_ensemble_prop, int Nelec) |
perform branching More... | |
bool | put (xmlNodePtr cur) |
Parse the xml file for parameters. More... | |
void | registerParameters () |
create map between the parameter name and variables More... | |
void | printStatus () const |
finalize the simulation More... | |
Private Member Functions | |
void | setBranchCutoff (FullPrecRealType variance, FullPrecRealType targetSigma, FullPrecRealType maxSigma, int Nelec=0) |
set branch cutoff, max, filter More... | |
Private Attributes | |
BranchModeType | BranchMode |
IParamType | iParam |
VParamType | vParam |
int | WarmUpToDoSteps |
number of remaning steps in warmup, [0, iParam[B_WARMUPSTEPS]] More... | |
int | EtrialUpdateToDoSteps |
number of remaning steps in before adjusting ETRIAL, [0, iParam[B_ENERGYUPDATEINTERVAL]] More... | |
xmlNodePtr | myNode |
save xml element More... | |
DMCRefEnergy | ref_energy_collector |
collect energy and variance history More... | |
accumulator_set< RealType > | R2Accepted |
a simple accumulator for energy More... | |
accumulator_set< RealType > | R2Proposed |
a simple accumulator for energy More... | |
accumulator_set< RealType > | R2Center |
a simple accumulator for reptation's center slice More... | |
std::string | branching_cutoff_scheme |
scheme of branching cutoff More... | |
ParameterSet | m_param |
set of parameters More... | |
std::vector< std::string > | sParam |
string parameters More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, SFNBranch::VParamType &rhs) |
Manages the state of QMC sections and handles population control for DMCs.
: Remove duplicate reading of Driver XML section with own copies of input parameters.
: Rename, it is the only branching class so its name is too much
: Use normal types for data members, don't be clever, the parameter enums violate KISS and make debugging annoying
: Remove as much state as possible.
QMCDriver object owns a SFNBranch to keep track of the progress of a qmc section. It implements several methods to control the population and trial energy during a DMC and evaluate the properties of a population, e.g., energy, variance, population etc.
Steps in SFNB states machine
Definition at line 63 of file SFNBranch.h.
using BranchModeType = std::bitset<B_MODE_MAX> |
Definition at line 94 of file SFNBranch.h.
using IParamType = TinyVector<int, B_IPARAM_MAX> |
using MCPWalker = Walker<QMCTraits, PtclOnLatticeTraits> |
Definition at line 66 of file SFNBranch.h.
using SBVP = SimpleBranchVectorParameter |
Definition at line 138 of file SFNBranch.h.
using VParamType = VParams<SBVP> |
Definition at line 151 of file SFNBranch.h.
anonymous enum |
enum for booleans
Definition at line 71 of file SFNBranch.h.
anonymous enum |
enum for iParam std::bitset<B_IPARAM_MAX> When introducing a new iParam, check if B_IPARAM_MAX is sufficiently large. Use multiples of 8 Why? Much easier to use bool flags. Are these ever serialized?
Definition at line 100 of file SFNBranch.h.
|
strong |
enum for vParam
Easy serialization is a relatively minor concern compared to the annoyance this causes elsewhere.
Enumerator | |
---|---|
TAU | |
TAUEFF | |
ETRIAL | |
EREF | |
ENOW | |
BRANCHMAX | |
BRANCHCUTOFF | |
BRANCHFILTER | |
SIGMA2 | |
SIGMA_BOUND | |
FEEDBACK | |
FILTERSCALE | |
VPARAM_MAX |
Definition at line 120 of file SFNBranch.h.
SFNBranch | ( | RealType | tau, |
RealType | feedback, | ||
DMCRefEnergyScheme | refenergy_update_scheme | ||
) |
Constructor.
Definition at line 34 of file SFNBranch.cpp.
References SFNBranch::B_BRANCHINTERVAL, SFNBranch::B_CLEARHISTORY, SFNBranch::B_COUNTER, SFNBranch::B_DMCSTAGE, SFNBranch::B_ENERGYUPDATEINTERVAL, SFNBranch::B_KILLNODES, SFNBranch::B_POPCONTROL, SFNBranch::B_TARGETWALKERS, SFNBranch::B_USETAUEFF, SFNBranch::B_WARMUPSTEPS, SFNBranch::branching_cutoff_scheme, SFNBranch::BranchMode, qmcplusplus::DUMMYOPT, qmcplusplus::Units::charge::e, SFNBranch::FEEDBACK, SFNBranch::FILTERSCALE, SFNBranch::iParam, SFNBranch::R2Accepted, SFNBranch::R2Proposed, SFNBranch::registerParameters(), SFNBranch::SIGMA_BOUND, SFNBranch::sParam, SFNBranch::TAU, SFNBranch::TAUEFF, and SFNBranch::vParam.
|
default |
|
inline |
increment QMCCounter
QMCCounter is the number of times any QMC section is processed.
Definition at line 175 of file SFNBranch.h.
References SFNBranch::B_COUNTER, and SFNBranch::iParam.
|
inline |
return the bare branch weight with a filtering using an energy window
Cutoff values are set by the variance
Definition at line 199 of file SFNBranch.h.
References SFNBranch::BRANCHCUTOFF, SFNBranch::BRANCHFILTER, SFNBranch::BRANCHMAX, SFNBranch::EREF, SFNBranch::ETRIAL, qmcplusplus::exp(), SFNBranch::TAUEFF, and SFNBranch::vParam.
Referenced by DMCBatched::advanceWalkers().
return the branch weight according to JCP1993 Umrigar et al.
Appendix A p=1, q=0
enew | new energy |
eold | old energy |
scnew | ![]() |
scold | ![]() |
Definition at line 249 of file SFNBranch.h.
References SFNBranch::EREF, SFNBranch::ETRIAL, qmcplusplus::exp(), SFNBranch::TAUEFF, and SFNBranch::vParam.
|
inline |
return the branch weight according to JCP1993 Umrigar et al.
Appendix A
enew | new energy |
eold | old energy |
scnew | ![]() |
scold | ![]() |
p | acceptance ratio |
Definition at line 263 of file SFNBranch.h.
References SFNBranch::EREF, SFNBranch::ETRIAL, qmcplusplus::exp(), SFNBranch::TAUEFF, and SFNBranch::vParam.
return the bare branch weight
This is equivalent to calling branchWeight(enew,eold,1.0,1.0)
Definition at line 190 of file SFNBranch.h.
References SFNBranch::ETRIAL, qmcplusplus::exp(), SFNBranch::TAUEFF, and SFNBranch::vParam.
Definition at line 233 of file SFNBranch.h.
References SFNBranch::BRANCHCUTOFF, SFNBranch::BRANCHFILTER, SFNBranch::BRANCHMAX, SFNBranch::EREF, SFNBranch::TAUEFF, and SFNBranch::vParam.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 276 of file SFNBranch.h.
References SFNBranch::WarmUpToDoSteps.
int initParam | ( | const MCPopulation & | population, |
FullPrecRealType | ene, | ||
FullPrecRealType | var, | ||
bool | fixW, | ||
bool | killwalker | ||
) |
initialize branching parameters
pop | Population of Walkers |
fixW | true, if reconfiguration with the fixed number of walkers is used |
killwalker |
FIXME, magic number 50
Definition at line 94 of file SFNBranch.cpp.
References qmcplusplus::app_log(), SFNBranch::B_COUNTER, SFNBranch::B_DMC, SFNBranch::B_DMCSTAGE, SFNBranch::B_KILLNODES, SFNBranch::B_POPCONTROL, SFNBranch::B_TARGETWALKERS, SFNBranch::B_WARMUPSTEPS, SFNBranch::BRANCHCUTOFF, SFNBranch::branching_cutoff_scheme, SFNBranch::BRANCHMAX, SFNBranch::BranchMode, SFNBranch::EREF, SFNBranch::ETRIAL, SFNBranch::FEEDBACK, MCPopulation::get_golden_electrons(), MCPopulation::get_num_global_walkers(), ParticleSet::getTotalNum(), SFNBranch::iParam, SFNBranch::R2Accepted, SFNBranch::R2Proposed, accumulator_set< T, typename >::result(), SFNBranch::setBranchCutoff(), SFNBranch::SIGMA2, SFNBranch::SIGMA_BOUND, SFNBranch::TAU, SFNBranch::TAUEFF, and SFNBranch::vParam.
|
inline |
Definition at line 161 of file SFNBranch.h.
References qmcplusplus::cos().
Referenced by DMCBatched::advanceWalkers().
void printStatus | ( | ) | const |
finalize the simulation
Definition at line 231 of file SFNBranch.cpp.
References qmcplusplus::app_log(), SFNBranch::B_COUNTER, SFNBranch::B_RMC, SFNBranch::B_TARGETWALKERS, SFNBranch::BRANCHCUTOFF, SFNBranch::BRANCHMAX, SFNBranch::BranchMode, SFNBranch::EREF, SFNBranch::ETRIAL, SFNBranch::FEEDBACK, SFNBranch::iParam, SFNBranch::SIGMA2, SFNBranch::TAU, SFNBranch::TAUEFF, and SFNBranch::vParam.
bool put | ( | xmlNodePtr | cur | ) |
Parse the xml file for parameters.
cur | current xmlNode |
Few important parameters are:
Definition at line 277 of file SFNBranch.cpp.
References SFNBranch::B_ENERGYUPDATEINTERVAL, SFNBranch::B_WARMUPSTEPS, SFNBranch::EtrialUpdateToDoSteps, SFNBranch::iParam, SFNBranch::m_param, SFNBranch::myNode, ParameterSet::put(), and SFNBranch::WarmUpToDoSteps.
void registerParameters | ( | ) |
create map between the parameter name and variables
Definition at line 68 of file SFNBranch.cpp.
References ParameterSet::add(), SFNBranch::B_BRANCHINTERVAL, SFNBranch::B_ENERGYUPDATEINTERVAL, SFNBranch::B_TARGETWALKERS, SFNBranch::B_WARMUPSTEPS, SFNBranch::branching_cutoff_scheme, SFNBranch::EREF, SFNBranch::FILTERSCALE, SFNBranch::iParam, SFNBranch::m_param, qmcplusplus::MIXDMCOPT, SFNBranch::SIGMA_BOUND, SFNBranch::sParam, SFNBranch::TAU, qmcplusplus::USETAUOPT, and SFNBranch::vParam.
Referenced by SFNBranch::SFNBranch().
|
inline |
|
private |
set branch cutoff, max, filter
Definition at line 287 of file SFNBranch.cpp.
References APP_ABORT, SFNBranch::BRANCHCUTOFF, SFNBranch::BRANCHFILTER, SFNBranch::branching_cutoff_scheme, SFNBranch::BRANCHMAX, omptarget::min(), qmcplusplus::sqrt(), SFNBranch::TAU, and SFNBranch::vParam.
Referenced by SFNBranch::initParam(), and SFNBranch::updateParamAfterPopControl().
|
inline |
Definition at line 210 of file SFNBranch.h.
References SFNBranch::BRANCHCUTOFF, SFNBranch::BRANCHFILTER, SFNBranch::BRANCHMAX, SFNBranch::EREF, SFNBranch::TAUEFF, and SFNBranch::vParam.
|
inline |
void updateParamAfterPopControl | ( | const MCDataType< FullPrecRealType > & | wc_ensemble_prop, |
int | Nelec | ||
) |
perform branching
iter | current step |
w | Walker configuration |
FIXME vParam[SBVP::ETRIAL] = vParam[SBVP::EREF];
FIXME vParam[SBVP::ETRIAL] = vParam[SBVP::ENOW];
Definition at line 133 of file SFNBranch.cpp.
References qmcplusplus::app_log(), SFNBranch::B_DMCSTAGE, SFNBranch::B_ENERGYUPDATEINTERVAL, SFNBranch::B_KILLNODES, SFNBranch::B_POPCONTROL, SFNBranch::B_TARGETWALKERS, SFNBranch::B_USETAUEFF, SFNBranch::B_WARMUPSTEPS, SFNBranch::BRANCHCUTOFF, SFNBranch::BRANCHMAX, SFNBranch::BranchMode, DMCRefEnergy::count(), MCDataType< T >::Energy, SFNBranch::ENOW, SFNBranch::EREF, SFNBranch::ETRIAL, SFNBranch::EtrialUpdateToDoSteps, SFNBranch::FEEDBACK, DMCRefEnergy::getEnergyVariance(), SFNBranch::iParam, MCDataType< T >::LivingFraction, qmcplusplus::log(), qmcplusplus::MIXDMCOPT, DMCRefEnergy::pushWeightEnergyVariance(), MCDataType< T >::R2Accepted, SFNBranch::R2Accepted, MCDataType< T >::R2Proposed, SFNBranch::R2Proposed, SFNBranch::ref_energy_collector, accumulator_set< T, typename >::result(), SFNBranch::setBranchCutoff(), SFNBranch::SIGMA2, SFNBranch::SIGMA_BOUND, SFNBranch::sParam, SFNBranch::TAU, SFNBranch::TAUEFF, MCDataType< T >::Variance, SFNBranch::vParam, SFNBranch::WarmUpToDoSteps, and MCDataType< T >::Weight.
|
friend |
Definition at line 322 of file SFNBranch.cpp.
|
private |
scheme of branching cutoff
Definition at line 322 of file SFNBranch.h.
Referenced by SFNBranch::initParam(), SFNBranch::registerParameters(), SFNBranch::setBranchCutoff(), and SFNBranch::SFNBranch().
|
private |
Definition at line 300 of file SFNBranch.h.
Referenced by SFNBranch::initParam(), SFNBranch::printStatus(), SFNBranch::SFNBranch(), and SFNBranch::updateParamAfterPopControl().
|
private |
number of remaning steps in before adjusting ETRIAL, [0, iParam[B_ENERGYUPDATEINTERVAL]]
Definition at line 308 of file SFNBranch.h.
Referenced by SFNBranch::put(), and SFNBranch::updateParamAfterPopControl().
|
private |
Definition at line 302 of file SFNBranch.h.
Referenced by SFNBranch::advanceQMCCounter(), SFNBranch::initParam(), SFNBranch::printStatus(), SFNBranch::put(), SFNBranch::registerParameters(), SFNBranch::regressQMCCounter(), SFNBranch::SFNBranch(), and SFNBranch::updateParamAfterPopControl().
|
private |
set of parameters
Definition at line 324 of file SFNBranch.h.
Referenced by SFNBranch::put(), and SFNBranch::registerParameters().
|
private |
|
private |
a simple accumulator for energy
Definition at line 314 of file SFNBranch.h.
Referenced by SFNBranch::initParam(), SFNBranch::SFNBranch(), and SFNBranch::updateParamAfterPopControl().
|
private |
a simple accumulator for reptation's center slice
Definition at line 318 of file SFNBranch.h.
|
private |
a simple accumulator for energy
Definition at line 316 of file SFNBranch.h.
Referenced by SFNBranch::initParam(), SFNBranch::SFNBranch(), and SFNBranch::updateParamAfterPopControl().
|
private |
collect energy and variance history
Definition at line 312 of file SFNBranch.h.
Referenced by SFNBranch::updateParamAfterPopControl().
|
private |
string parameters
Definition at line 326 of file SFNBranch.h.
Referenced by SFNBranch::registerParameters(), SFNBranch::SFNBranch(), and SFNBranch::updateParamAfterPopControl().
|
private |
Definition at line 304 of file SFNBranch.h.
Referenced by SFNBranch::branchWeight(), SFNBranch::branchWeightBare(), SFNBranch::DMCLinkAction(), SFNBranch::getEref(), SFNBranch::getEtrial(), SFNBranch::getTau(), SFNBranch::getTauEff(), SFNBranch::initParam(), SFNBranch::printStatus(), SFNBranch::registerParameters(), SFNBranch::setBranchCutoff(), SFNBranch::SFNBranch(), SFNBranch::symLinkAction(), SFNBranch::symLinkActionBare(), and SFNBranch::updateParamAfterPopControl().
|
private |
number of remaning steps in warmup, [0, iParam[B_WARMUPSTEPS]]
Definition at line 306 of file SFNBranch.h.
Referenced by SFNBranch::getWarmupToDoSteps(), SFNBranch::put(), and SFNBranch::updateParamAfterPopControl().