![]() |
QMCPACK
|
Public Member Functions | |
QMCCostFunctionBatched (ParticleSet &w, TrialWaveFunction &psi, QMCHamiltonian &h, SampleStack &samples, const std::vector< int > &walkers_per_crowd, Communicate *comm) | |
Constructor. More... | |
~QMCCostFunctionBatched () override | |
Destructor. More... | |
void | getConfigurations (const std::string &aroot) override |
void | checkConfigurations (EngineHandle &handle) override |
evaluate everything before optimization More... | |
void | resetPsi (bool final_reset=false) override |
reset the wavefunction More... | |
void | GradCost (std::vector< Return_rt > &PGradient, const std::vector< Return_rt > &PM, Return_rt FiniteDiff=0) override |
Return_rt | fillOverlapHamiltonianMatrices (Matrix< Return_rt > &Left, Matrix< Return_rt > &Right) override |
![]() | |
QMCCostFunctionBase (ParticleSet &w, TrialWaveFunction &psi, QMCHamiltonian &h, Communicate *comm) | |
Constructor. More... | |
~QMCCostFunctionBase () override | |
Destructor. More... | |
bool | put (xmlNodePtr cur) |
process xml node More... | |
void | resetCostFunction (std::vector< xmlNodePtr > &cset) |
Return_rt & | Params (int i) override |
assign optimization parameter i More... | |
Return_t | Params (int i) const override |
return optimization parameter i More... | |
int | getType (int i) const |
Return_rt | Cost (bool needGrad=true) override |
return the cost value for CGMinimization More... | |
Return_rt | computedCost () |
return the cost value for CGMinimization More... | |
void | printEstimates () |
void | GradCost (std::vector< Return_rt > &PGradient, const std::vector< Return_rt > &PM, Return_rt FiniteDiff=0) override |
return the gradient of cost value for CGMinimization More... | |
int | getNumParams () const override |
return the number of optimizable parameters More... | |
int | getNumSamples () const |
return the global number of samples More... | |
void | setNumSamples (int newNumSamples) |
void | getParameterTypes (std::vector< int > &types) const |
void | Report () override |
dump the current parameters and other report More... | |
void | reportParameters () |
report parameters at the end More... | |
void | reportParametersH5 () |
report parameters in HDF5 at the end More... | |
int | getReportCounter () const |
return the counter which keeps track of optimization steps More... | |
void | setWaveFunctionNode (xmlNodePtr cur) |
void | setTargetEnergy (Return_rt et) |
void | setRootName (const std::string &aroot) |
void | setStream (std::ostream *os) |
void | addCoefficients (xmlXPathContextPtr acontext, const char *cname) |
add coefficient or coefficients More... | |
void | printCJParams (xmlNodePtr cur, std::string &rname) |
void | addCJParams (xmlXPathContextPtr acontext, const char *cname) |
void | setRng (RefVector< RandomBase< FullPrecRealType >> r) |
bool | getneedGrads () const |
void | setneedGrads (bool tf) |
void | setDMC () |
std::string | getParamName (int i) const override |
const opt_variables_type & | getOptVariables () const |
Return_rt | getVariance () const |
return variance after checkConfigurations More... | |
![]() | |
MPIObjectBase (Communicate *c) | |
constructor with communicator More... | |
int | rank () const |
return the rank of the communicator More... | |
int | getGroupID () const |
return the group id of the communicator More... | |
Communicate * | getCommunicator () const |
return myComm More... | |
Communicate & | getCommRef () const |
return a TEMPORARY reference to Communicate More... | |
mpi_comm_type | getMPI () const |
return MPI communicator if one wants to use MPI directly More... | |
bool | is_manager () const |
return true if the rank == 0 More... | |
const std::string & | getName () const |
return the name More... | |
void | setName (const std::string &aname) |
Protected Member Functions | |
EffectiveWeight | correlatedSampling (bool needGrad=true) override |
run correlated sampling return effective walkers ( w_i)^2/(Nw * w^2_i) More... | |
![]() | |
bool | checkParameters () |
Apply constraints on the optimizables. More... | |
void | updateXmlNodes () |
bool | isEffectiveWeightValid (EffectiveWeight effective_weight) const |
check the validity of the effective weight calculated by correlatedSampling More... | |
UniqueOptObjRefs | extractOptimizableObjects (TrialWaveFunction &psi) const |
survey all the optimizable objects More... | |
void | resetOptimizableObjects (TrialWaveFunction &psi, const opt_variables_type &opt_variables) const |
Protected Attributes | |
std::vector< std::string > | H_KE_node_names_ |
H components used in correlated sampling. It can be KE or KE+NLPP. More... | |
Matrix< Return_rt > | RecordsOnNode_ |
Matrix< Return_t > | DerivRecords_ |
Temp derivative properties and Hderivative properties of all the walkers. More... | |
Matrix< Return_rt > | HDerivRecords_ |
SampleStack & | samples_ |
int | rank_local_num_samples_ |
std::vector< int > | walkers_per_crowd_ |
NewTimer & | check_config_timer_ |
NewTimer & | corr_sampling_timer_ |
NewTimer & | fill_timer_ |
![]() | |
ParticleSet & | W |
Particle set. More... | |
TrialWaveFunction & | Psi |
Trial function. More... | |
QMCHamiltonian & | H |
Hamiltonian. More... | |
bool | Write2OneXml |
if true, do not write the *.opt.#.xml More... | |
int | PowerE |
|E-E_T|^PowerE is used for the cost function More... | |
int | NumCostCalls |
number of times cost function evaluated More... | |
int | NumSamples |
global number of samples to use in correlated sampling More... | |
int | NumOptimizables |
total number of optimizable variables More... | |
int | ReportCounter |
counter for output More... | |
Return_rt | w_en |
weights for energy and variance in the cost function More... | |
Return_rt | w_var |
Return_rt | w_abs |
Return_rt | w_w |
Return_rt | CostValue |
value of the cost function More... | |
Return_rt | Etarget |
target energy More... | |
Return_rt | EtargetEff |
real target energy with the Correlation Factor More... | |
Return_rt | MinNumWalkers |
fraction of the number of walkers below which the costfunction becomes invalid More... | |
Return_rt | MaxWeight |
maximum weight beyond which the weight is set to 1 More... | |
Return_rt | curAvg |
current Average More... | |
Return_rt | curVar |
current Variance More... | |
Return_rt | curAvg_w |
current weighted average (correlated sampling) More... | |
Return_rt | curVar_w |
current weighted variance (correlated sampling) More... | |
Return_rt | curVar_abs |
current variance of SUM_ABSE_WGT/SUM_WGT More... | |
Return_rt | w_beta |
Return_rt | vmc_or_dmc |
bool | needGrads |
std::string | targetExcitedStr |
whether we are targeting an excited state More... | |
bool | targetExcited |
whether we are targeting an excited state More... | |
double | omega_shift |
the shift to use when targeting an excited state More... | |
opt_variables_type | OptVariables |
list of optimizables More... | |
opt_variables_type | OptVariablesForPsi |
full list of optimizables More... | |
opt_variables_type | InitVariables |
std::vector< TinyVector< int, 2 > > | equalVarMap |
index mapping for <equal> constraints More... | |
std::vector< TinyVector< int, 2 > > | negateVarMap |
index mapping for <negate> constraints More... | |
std::ostream * | msg_stream |
stream to which progress is sent More... | |
xmlNodePtr | m_wfPtr |
xml node to be dumped More... | |
xmlDocPtr | m_doc_out |
document node to be dumped More... | |
std::map< std::string, xmlNodePtr > | paramNodes |
parameters to be updated` More... | |
std::map< std::string, xmlNodePtr > | coeffNodes |
coefficients to be updated More... | |
std::map< std::string, std::pair< xmlNodePtr, std::string > > | attribNodes |
attributes to be updated More... | |
std::string | RootName |
string for the file root More... | |
UPtrVector< RandomBase< FullPrecRealType > > | RngSaved |
Random number generators. More... | |
std::vector< RandomBase< FullPrecRealType > * > | MoverRng |
std::vector< std::string > | variational_subset_names |
optimized parameter names More... | |
std::vector< Return_rt > | SumValue |
Sum of energies and weights for averages. More... | |
Matrix< Return_rt > | Records |
Saved properties of all the walkers. More... | |
std::vector< ParticleGradient * > | dLogPsi |
Fixed Gradients , ![]() | |
std::vector< ParticleLaplacian * > | d2LogPsi |
Fixed Laplacian , ![]() | |
std::unique_ptr< std::ostream > | debug_stream |
stream for debug More... | |
bool | do_override_output |
Flag on whether the variational parameter override is output to the new wavefunction. More... | |
![]() | |
Communicate * | myComm |
pointer to Communicate More... | |
std::string | ClassName |
class Name More... | |
std::string | myName |
name of the object More... | |
Definition at line 39 of file QMCCostFunctionBatched.h.
QMCCostFunctionBatched | ( | ParticleSet & | w, |
TrialWaveFunction & | psi, | ||
QMCHamiltonian & | h, | ||
SampleStack & | samples, | ||
const std::vector< int > & | walkers_per_crowd, | ||
Communicate * | comm | ||
) |
Constructor.
Definition at line 30 of file QMCCostFunctionBatched.cpp.
References qmcplusplus::app_log().
|
overridedefault |
Destructor.
Clean up the vector.
|
overridevirtual |
evaluate everything before optimization
Implements QMCCostFunctionBase.
Definition at line 223 of file QMCCostFunctionBatched.cpp.
References Communicate::allreduce(), qmcplusplus::app_log(), QMCCostFunctionBatched::check_config_timer_, qmcplusplus::compute_batch_parameters(), qmcplusplus::convertPtrToRefVectorSubset(), QMCCostFunctionBase::d2LogPsi, QMCCostFunctionBatched::DerivRecords_, QMCCostFunctionBase::dLogPsi, QMCCostFunctionBase::ENERGY_FIXED, QMCCostFunctionBase::ENERGY_NEW, QMCCostFunctionBase::ENERGY_TOT, QMCCostFunctionBase::Etarget, FairDivide(), EngineHandle::finishSampling(), CostFunctionCrowdData::get_e0(), CostFunctionCrowdData::get_e2(), CostFunctionCrowdData::get_h_list(), CostFunctionCrowdData::get_log_psi_fixed(), CostFunctionCrowdData::get_log_psi_opt(), CostFunctionCrowdData::get_p_list(), CostFunctionCrowdData::get_rng_ptr_list(), CostFunctionCrowdData::get_rng_save(), CostFunctionCrowdData::get_wf_list(), SampleStack::getNumSamples(), CostFunctionCrowdData::getSharedResource(), QMCCostFunctionBase::H, DriverWalkerResourceCollection::ham_res, QMCCostFunctionBatched::HDerivRecords_, QMCCostFunctionBase::LOGPSI_FIXED, QMCCostFunctionBase::LOGPSI_FREE, QMCCostFunctionBase::MoverRng, QMCHamiltonian::mw_evaluate(), TrialWaveFunction::mw_evaluateDeltaLogSetup(), QMCHamiltonian::mw_evaluateValueAndDerivatives(), ParticleSet::mw_update(), MPIObjectBase::myComm, QMCCostFunctionBase::needGrads, QMCCostFunctionBase::NumOptimizables, QMCCostFunctionBase::NumSamples, QMCCostFunctionBase::OptVariablesForPsi, outputManager, OutputManagerClass::pause(), EngineHandle::prepareSampling(), DriverWalkerResourceCollection::pset_res, QMCCostFunctionBase::Psi, QMCCostFunctionBatched::rank_local_num_samples_, QMCCostFunctionBatched::RecordsOnNode_, QMCCostFunctionBase::ReportCounter, Matrix< T, Alloc >::resize(), OutputManagerClass::resume(), QMCCostFunctionBase::REWEIGHT, QMCCostFunctionBase::RngSaved, QMCCostFunctionBatched::samples_, VariableSet::setComputed(), QMCHamiltonian::setRandomGenerator(), QMCCostFunctionBase::setTargetEnergy(), Matrix< T, Alloc >::size1(), QMCCostFunctionBase::SUM_ABSE_BARE, QMCCostFunctionBase::SUM_E_BARE, QMCCostFunctionBase::SUM_E_WGT, QMCCostFunctionBase::SUM_ESQ_BARE, QMCCostFunctionBase::SUM_ESQ_WGT, QMCCostFunctionBase::SUM_INDEX_SIZE, QMCCostFunctionBase::SUM_WGT, QMCCostFunctionBase::SUM_WGTSQ, QMCCostFunctionBase::SumValue, EngineHandle::takeSample(), DriverWalkerResourceCollection::twf_res, QMCCostFunctionBase::W, QMCCostFunctionBatched::walkers_per_crowd_, and CostFunctionCrowdData::zero_log_psi().
|
overrideprotectedvirtual |
run correlated sampling return effective walkers ( w_i)^2/(Nw * w^2_i)
Implements QMCCostFunctionBase.
Definition at line 455 of file QMCCostFunctionBatched.cpp.
References qmcplusplus::abs(), Communicate::allreduce(), Communicate::barrier(), qmcplusplus::compute_batch_parameters(), OHMMS::Controller, qmcplusplus::convertUPtrToRefVector(), QMCCostFunctionBatched::corr_sampling_timer_, QMCCostFunctionBase::d2LogPsi, QMCCostFunctionBatched::DerivRecords_, QMCCostFunctionBase::dLogPsi, QMCCostFunctionBase::ENERGY_FIXED, QMCCostFunctionBase::ENERGY_NEW, QMCCostFunctionBase::EtargetEff, qmcplusplus::exp(), FairDivide(), CostFunctionCrowdData::get_h0_list(), CostFunctionCrowdData::get_h0_res(), CostFunctionCrowdData::get_log_psi_opt(), CostFunctionCrowdData::get_p_list(), CostFunctionCrowdData::get_rng_ptr_list(), CostFunctionCrowdData::get_rng_save(), CostFunctionCrowdData::get_wf_list(), CostFunctionCrowdData::get_wgt(), CostFunctionCrowdData::get_wgt2(), SampleStack::getGlobalNumSamples(), SampleStack::getNumSamples(), CostFunctionCrowdData::getSharedResource(), QMCHamiltonian::getTWFDependentComponents(), QMCCostFunctionBase::H, QMCCostFunctionBatched::HDerivRecords_, QMCCostFunctionBase::LOGPSI_FREE, QMCCostFunctionBase::MaxWeight, omptarget::min(), QMCCostFunctionBase::MoverRng, QMCHamiltonian::mw_evaluate(), TrialWaveFunction::mw_evaluateDeltaLog(), QMCHamiltonian::mw_evaluateValueAndDerivatives(), ParticleSet::mw_update(), MPIObjectBase::myComm, QMCCostFunctionBase::OptVariablesForPsi, outputManager, OutputManagerClass::pause(), qmcplusplus::pow(), QMCCostFunctionBase::PowerE, DriverWalkerResourceCollection::pset_res, QMCCostFunctionBase::Psi, QMCCostFunctionBatched::rank_local_num_samples_, QMCCostFunctionBatched::RecordsOnNode_, OutputManagerClass::resume(), QMCCostFunctionBase::REWEIGHT, QMCCostFunctionBase::RngSaved, QMCCostFunctionBatched::samples_, QMCHamiltonian::setRandomGenerator(), QMCCostFunctionBase::SUM_ABSE_BARE, QMCCostFunctionBase::SUM_ABSE_WGT, QMCCostFunctionBase::SUM_E_BARE, QMCCostFunctionBase::SUM_E_WGT, QMCCostFunctionBase::SUM_ESQ_BARE, QMCCostFunctionBase::SUM_ESQ_WGT, QMCCostFunctionBase::SUM_WGT, QMCCostFunctionBase::SUM_WGTSQ, QMCCostFunctionBase::SumValue, DriverWalkerResourceCollection::twf_res, QMCCostFunctionBase::vmc_or_dmc, QMCCostFunctionBase::W, QMCCostFunctionBatched::walkers_per_crowd_, and CostFunctionCrowdData::zero_log_psi().
Referenced by QMCCostFunctionBatched::GradCost().
|
overridevirtual |
Implements QMCCostFunctionBase.
Definition at line 698 of file QMCCostFunctionBatched.cpp.
References Communicate::allreduce(), qmcplusplus::conj(), QMCCostFunctionBase::curAvg_w, QMCCostFunctionBatched::DerivRecords_, QMCCostFunctionBase::ENERGY_NEW, FairDivide(), QMCCostFunctionBatched::fill_timer_, QMCCostFunctionBase::getNumParams(), QMCCostFunctionBatched::HDerivRecords_, MPIObjectBase::myComm, qmcplusplus::Units::distance::pm, QMCCostFunctionBatched::rank_local_num_samples_, QMCCostFunctionBatched::RecordsOnNode_, QMCCostFunctionBase::REWEIGHT, QMCCostFunctionBase::SUM_E_WGT, QMCCostFunctionBase::SUM_ESQ_WGT, QMCCostFunctionBase::SUM_WGT, QMCCostFunctionBase::SumValue, QMCCostFunctionBase::w_beta, and QMCCostFunctionBatched::walkers_per_crowd_.
Referenced by qmcplusplus::fill_from_text(), and qmcplusplus::TEST_CASE().
|
overridevirtual |
Implements QMCCostFunctionBase.
Definition at line 171 of file QMCCostFunctionBatched.cpp.
References qmcplusplus::app_log(), QMCCostFunctionBase::d2LogPsi, qmcplusplus::delete_iter(), QMCCostFunctionBase::dLogPsi, SampleStack::getNumSamples(), ParticleSet::getTotalNum(), QMCHamiltonian::getTWFDependentComponents(), QMCCostFunctionBase::H, QMCCostFunctionBatched::rank_local_num_samples_, QMCCostFunctionBatched::samples_, and QMCCostFunctionBase::W.
|
override |
Definition at line 51 of file QMCCostFunctionBatched.cpp.
References qmcplusplus::abs(), Communicate::allreduce(), QMCCostFunctionBatched::correlatedSampling(), QMCCostFunctionBase::Cost(), QMCCostFunctionBase::curAvg, QMCCostFunctionBase::curAvg_w, QMCCostFunctionBase::curVar_w, QMCCostFunctionBatched::DerivRecords_, qmcplusplus::Units::charge::e, QMCCostFunctionBase::ENERGY_NEW, QMCCostFunctionBase::EtargetEff, QMCCostFunctionBatched::HDerivRecords_, QMCCostFunctionBase::isEffectiveWeightValid(), MPIObjectBase::myComm, QMCCostFunctionBase::NumOptimizables, QMCCostFunctionBase::NumSamples, QMCCostFunctionBase::OptVariables, qmcplusplus::Units::distance::pm, qmcplusplus::pow(), QMCCostFunctionBase::PowerE, QMCCostFunctionBatched::rank_local_num_samples_, QMCCostFunctionBatched::RecordsOnNode_, QMCCostFunctionBatched::resetPsi(), QMCCostFunctionBase::REWEIGHT, QMCCostFunctionBase::SUM_E_WGT, QMCCostFunctionBase::SUM_ESQ_WGT, QMCCostFunctionBase::SUM_WGT, QMCCostFunctionBase::SumValue, QMCCostFunctionBase::w_abs, QMCCostFunctionBase::w_en, QMCCostFunctionBase::w_var, and QMCCostFunctionBase::w_w.
|
overridevirtual |
reset the wavefunction
Implements QMCCostFunctionBase.
Definition at line 440 of file QMCCostFunctionBatched.cpp.
References QMCCostFunctionBase::equalVarMap, QMCCostFunctionBase::OptVariables, QMCCostFunctionBase::OptVariablesForPsi, QMCCostFunctionBase::Psi, QMCCostFunctionBase::resetOptimizableObjects(), and VariableSet::size().
Referenced by QMCCostFunctionBatched::GradCost().
|
protected |
Definition at line 87 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations().
|
protected |
Definition at line 88 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::correlatedSampling().
Temp derivative properties and Hderivative properties of all the walkers.
Definition at line 74 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), QMCCostFunctionBatched::fillOverlapHamiltonianMatrices(), LinearMethodTestSupport::getDerivRecords(), and QMCCostFunctionBatched::GradCost().
|
protected |
Definition at line 89 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::fillOverlapHamiltonianMatrices().
|
protected |
H components used in correlated sampling. It can be KE or KE+NLPP.
Definition at line 68 of file QMCCostFunctionBatched.h.
|
protected |
Definition at line 75 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), QMCCostFunctionBatched::fillOverlapHamiltonianMatrices(), LinearMethodTestSupport::getHDerivRecords(), and QMCCostFunctionBatched::GradCost().
|
protected |
Definition at line 82 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), QMCCostFunctionBatched::fillOverlapHamiltonianMatrices(), QMCCostFunctionBatched::getConfigurations(), QMCCostFunctionBatched::GradCost(), and LinearMethodTestSupport::set_samples_and_param().
|
protected |
Definition at line 70 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), QMCCostFunctionBatched::fillOverlapHamiltonianMatrices(), LinearMethodTestSupport::getRecordsOnNode(), and QMCCostFunctionBatched::GradCost().
|
protected |
Definition at line 79 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), and QMCCostFunctionBatched::getConfigurations().
|
protected |
Definition at line 85 of file QMCCostFunctionBatched.h.
Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), and QMCCostFunctionBatched::fillOverlapHamiltonianMatrices().