From e9cbc045b931ae1bc2507a76e37e6089d92dc138 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Tue, 28 Sep 2021 13:54:19 -0500 Subject: [PATCH 01/11] Proper abort when users request excessive orbitals. --- src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp b/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp index e3e2087977..f9bcaa8e44 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp +++ b/src/QMCWaveFunctions/EinsplineSetBuilderESHDF.fft.cpp @@ -468,6 +468,13 @@ void EinsplineSetBuilder::OccupyBands_ESHDF(int spin, int sortBands, int numOrbs maxOrbs++; } } + + app_log() << SortBands.size() << " complex-valued orbitals supplied by h5 can be expanded up to " << maxOrbs + << " SPOs." << std::endl; + if (maxOrbs < numOrbs) + myComm->barrier_and_abort("EinsplineSetBuilder::OccupyBands_ESHDF user input requests " + "more orbitals than what the h5 file supplies."); + // Now sort the bands by energy if (sortBands == 2) { @@ -644,7 +651,7 @@ void EinsplineSetBuilder::OccupyBands_ESHDF(int spin, int sortBands, int numOrbs orbIndex++; } NumDistinctOrbitals = orbIndex; - app_log() << "We will read " << NumDistinctOrbitals << " distinct orbitals.\n"; + app_log() << "We will read " << NumDistinctOrbitals << " distinct complex-valued orbitals from h5.\n"; app_log() << "There are " << NumCoreOrbs << " core states and " << NumValenceOrbs << " valence states.\n"; } From d5e6abb2168feeafd5e3009433b41551feff8e26 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Tue, 28 Sep 2021 14:45:20 -0500 Subject: [PATCH 02/11] Rename UseRealOrbitals to use_real_splines_ --- src/QMCWaveFunctions/EinsplineSetBuilder.h | 3 ++- .../EinsplineSetBuilderCommon.cpp | 16 ++++++++-------- .../EinsplineSetBuilder_createSPOs.cpp | 12 ++++++------ .../EinsplineSpinorSetBuilder.cpp | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/QMCWaveFunctions/EinsplineSetBuilder.h b/src/QMCWaveFunctions/EinsplineSetBuilder.h index daca4bacfd..f898efd2b4 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilder.h +++ b/src/QMCWaveFunctions/EinsplineSetBuilder.h @@ -234,7 +234,8 @@ class EinsplineSetBuilder : public SPOSetBuilder // clone std::vector> UseTwists; std::vector IncludeTwists, DistinctTwists; - bool UseRealOrbitals; + /// if false, splines are conceptually complex valued + bool use_real_splines_; int NumDistinctOrbitals, NumCoreOrbs, NumValenceOrbs; // This is true if the corresponding twist in DistinctTwists should // should be used to generate two distinct orbitals from the real and diff --git a/src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp b/src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp index b4209afc69..b8e9fbea51 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp +++ b/src/QMCWaveFunctions/EinsplineSetBuilderCommon.cpp @@ -621,7 +621,7 @@ void EinsplineSetBuilder::AnalyzeTwists2() } } // Find out if we can make real orbitals - UseRealOrbitals = true; + use_real_splines_ = true; for (int i = 0; i < DistinctTwists.size(); i++) { int ti = DistinctTwists[i]; @@ -629,18 +629,18 @@ void EinsplineSetBuilder::AnalyzeTwists2() for (int j = 0; j < OHMMS_DIM; j++) if (std::abs(twist[j] - 0.0) > MatchingTol && std::abs(twist[j] - 0.5) > MatchingTol && std::abs(twist[j] + 0.5) > MatchingTol) - UseRealOrbitals = false; + use_real_splines_ = false; } - if (UseRealOrbitals && (DistinctTwists.size() > 1)) + if (use_real_splines_ && (DistinctTwists.size() > 1)) { app_log() << "***** Use of real orbitals is possible, but not currently implemented\n" << " with more than one twist angle.\n"; - UseRealOrbitals = false; + use_real_splines_ = false; } - if (UseRealOrbitals) - app_log() << "Using real orbitals.\n"; + if (use_real_splines_) + app_log() << "Using real splines.\n"; else - app_log() << "Using complex orbitals.\n"; + app_log() << "Using complex splines.\n"; #else DistinctTwists.resize(IncludeTwists.size()); MakeTwoCopies.resize(IncludeTwists.size()); @@ -649,7 +649,7 @@ void EinsplineSetBuilder::AnalyzeTwists2() DistinctTwists[i] = IncludeTwists[i]; MakeTwoCopies[i] = false; } - UseRealOrbitals = false; + use_real_splines_ = false; #endif } diff --git a/src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp b/src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp index c5dfaf8c83..d78903cc62 100644 --- a/src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp +++ b/src/QMCWaveFunctions/EinsplineSetBuilder_createSPOs.cpp @@ -41,7 +41,7 @@ namespace qmcplusplus void EinsplineSetBuilder::set_metadata(int numOrbs, int TwistNum_inp, bool skipChecks) { // 1. set a lot of internal parameters in the EinsplineSetBuilder class - // e.g. TileMatrix, UseRealOrbitals, DistinctTwists, MakeTwoCopies. + // e.g. TileMatrix, use_real_splines_, DistinctTwists, MakeTwoCopies. // 2. this is also where metadata for the orbitals are read from the wavefunction hdf5 file // and broadcast to MPI groups. Variables broadcasted are listed in // EinsplineSetBuilderCommon.cpp EinsplineSetBuilder::BroadcastOrbitalInfo() @@ -263,7 +263,7 @@ std::unique_ptr EinsplineSetBuilder::createSPOSetFromXML(xmlNodePtr cur) // set the internal parameters if (spinSet == 0) set_metadata(numOrbs, TwistNum_inp, skipChecks); - //if (use_complex_orb == "yes") UseRealOrbitals = false; // override given user input + //if (use_complex_orb == "yes") use_real_splines_ = false; // override given user input // look for , would be a lot easier with xpath, but I cannot get it to work bool has_backflow = false; @@ -289,8 +289,8 @@ std::unique_ptr EinsplineSetBuilder::createSPOSetFromXML(xmlNodePtr cur) kid = kid->next; } - if (has_backflow && use_einspline_set_extended == "yes" && UseRealOrbitals) - APP_ABORT("backflow optimization is broken with UseRealOrbitals"); + if (has_backflow && use_einspline_set_extended == "yes" && use_real_splines_) + APP_ABORT("backflow optimization is broken with use_real_splines_"); ////////////////////////////////// // Create the OrbitalSet object @@ -308,7 +308,7 @@ std::unique_ptr EinsplineSetBuilder::createSPOSetFromXML(xmlNodePtr cur) APP_ABORT("The 'truncate' feature of spline SPO has been removed. Please use hybrid orbital representation."); #if !defined(QMC_COMPLEX) - if (UseRealOrbitals) + if (use_real_splines_) { //if(TargetPtcl.Lattice.SuperCellEnum != SUPERCELL_BULK && truncate=="yes") if (MixedSplineReader == 0) @@ -350,7 +350,7 @@ std::unique_ptr EinsplineSetBuilder::createSPOSetFromXML(xmlNodePtr cur) #endif { EinsplineSet* new_OrbitalSet; - if (UseRealOrbitals) + if (use_real_splines_) { EinsplineSetExtended* temp_OrbitalSet; #if defined(QMC_CUDA) diff --git a/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp b/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp index 2ead75d793..33ec92cc89 100644 --- a/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp +++ b/src/QMCWaveFunctions/EinsplineSpinorSetBuilder.cpp @@ -168,7 +168,7 @@ std::unique_ptr EinsplineSpinorSetBuilder::createSPOSetFromXML(xmlNodePt std::string useGPU("no"); #if !defined(QMC_COMPLEX) - if (UseRealOrbitals) + if (use_real_splines_) { if (MixedSplineReader == 0) { From eb7b705875366ae3e7f6f051d539c57b1a634883 Mon Sep 17 00:00:00 2001 From: William F Godoy Date: Mon, 27 Sep 2021 20:41:17 -0400 Subject: [PATCH 03/11] Refactor public functions Single translation unit --- src/QMCHamiltonians/OperatorBase.cpp | 190 ++++++++++--- src/QMCHamiltonians/OperatorBase.h | 386 ++++++++++++++++----------- 2 files changed, 387 insertions(+), 189 deletions(-) diff --git a/src/QMCHamiltonians/OperatorBase.cpp b/src/QMCHamiltonians/OperatorBase.cpp index 3004003f3f..96a64fbd4e 100644 --- a/src/QMCHamiltonians/OperatorBase.cpp +++ b/src/QMCHamiltonians/OperatorBase.cpp @@ -22,6 +22,7 @@ namespace qmcplusplus { +// PUBLIC OperatorBase::OperatorBase() : value_(0.0), my_index_(-1), t_walker_(0) { quantum_domain_ = NO_QUANTUM_DOMAIN; @@ -47,15 +48,33 @@ void OperatorBase::setName(const std::string name) noexcept { name_ = name; } TraceRequest& OperatorBase::getRequest() noexcept { return request_; } #endif -/** The correct behavior of this routine requires estimators with non-deterministic components - * in their evaluate() function to override this function. - */ +//////// VIRTUAL FUNCTIONS //////////////// +void OperatorBase::addObservables(PropertySetType& plist, BufferType& collectables) { addValue(plist); } + +void OperatorBase::registerObservables(std::vector& h5desc, hid_t gid) const +{ + const bool collect = update_mode_.test(COLLECTABLE); + //exclude collectables + if (!collect) + { + h5desc.emplace_back(name_); + auto& oh = h5desc.back(); + std::vector onedim(1, 1); + oh.set_dimensions(onedim, my_index_); + oh.open(gid); + } +} + +void OperatorBase::registerCollectables(std::vector& h5desc, hid_t gid) const {} + +void OperatorBase::setObservables(PropertySetType& plist) { plist[my_index_] = value_; } + +void OperatorBase::setParticlePropertyList(PropertySetType& plist, int offset) { plist[my_index_ + offset] = value_; } + +void OperatorBase::setHistories(Walker_t& ThisWalker) { t_walker_ = &(ThisWalker); } + OperatorBase::Return_t OperatorBase::evaluateDeterministic(ParticleSet& P) { return evaluate(P); } -/** Take o_list and p_list update evaluation result variables in o_list? - * - * really should reduce vector of local_energies. matching the ordering and size of o list - * the this can be call for 1 or more QMCHamiltonians - */ + void OperatorBase::mw_evaluate(const RefVectorWithLeader& o_list, const RefVectorWithLeader& wf_list, const RefVectorWithLeader& p_list) const @@ -64,7 +83,7 @@ void OperatorBase::mw_evaluate(const RefVectorWithLeader& o_list, /** Temporary raw omp pragma for simple thread parallelism * ignoring the driver level concurrency * - * \todo replace this with a proper abstraction. It should adequately describe the behavior + * TODO: replace this with a proper abstraction. It should adequately describe the behavior * and strictly limit the activation of this level concurrency to when it is intended. * It is unlikely to belong in this function. * @@ -115,7 +134,131 @@ void OperatorBase::mw_evaluateWithParameterDerivatives(const RefVectorWithLeader } } +OperatorBase::Return_t OperatorBase::rejectedMove(ParticleSet& P) { return 0; } + +OperatorBase::Return_t OperatorBase::evaluateWithToperator(ParticleSet& P) { return evaluate(P); } + +void OperatorBase::mw_evaluateWithToperator(const RefVectorWithLeader& o_list, + const RefVectorWithLeader& wf_list, + const RefVectorWithLeader& p_list) const +{ + mw_evaluate(o_list, wf_list, p_list); +} + +OperatorBase::Return_t OperatorBase::evaluateValueAndDerivatives(ParticleSet& P, + const opt_variables_type& optvars, + const std::vector& dlogpsi, + std::vector& dhpsioverpsi) +{ + return evaluate(P); +} + +OperatorBase::Return_t OperatorBase::evaluateWithIonDerivs(ParticleSet& P, + ParticleSet& ions, + TrialWaveFunction& psi, + ParticleSet::ParticlePos_t& hf_term, + ParticleSet::ParticlePos_t& pulay_term) +{ + return evaluate(P); +} + +OperatorBase::Return_t OperatorBase::evaluateWithIonDerivsDeterministic(ParticleSet& P, + ParticleSet& ions, + TrialWaveFunction& psi, + ParticleSet::ParticlePos_t& hf_term, + ParticleSet::ParticlePos_t& pulay_term) +{ + return evaluateWithIonDerivs(P, ions, psi, hf_term, pulay_term); +} + +void OperatorBase::updateSource(ParticleSet& s) {} + +OperatorBase::Return_t OperatorBase::getEnsembleAverage() { return 0.0; } + +void OperatorBase::createResource(ResourceCollection& collection) const {} + +void OperatorBase::acquireResource(ResourceCollection& collection, + const RefVectorWithLeader& o_list) const +{} + +void OperatorBase::releaseResource(ResourceCollection& collection, + const RefVectorWithLeader& o_list) const +{} + +void OperatorBase::setRandomGenerator(RandomGenerator_t* rng) {} + +void OperatorBase::add2Hamiltonian(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& targetH) +{ + std::unique_ptr myclone = makeClone(qp, psi); + if (myclone) + { + targetH.addOperator(std::move(myclone), name_, update_mode_[PHYSICAL]); + } +} + +#if !defined(REMOVE_TRACEMANAGER) +void OperatorBase::getRequiredTraces(TraceManager& tm){}; +#endif + +void OperatorBase::addEnergy(MCWalkerConfiguration& W, std::vector& LocalEnergy) +{ + APP_ABORT("Need specialization for " + name_ + + "::addEnergy(MCWalkerConfiguration &W).\n Required functionality not implemented\n"); +} +void OperatorBase::addEnergy(MCWalkerConfiguration& W, + std::vector& LocalEnergy, + std::vector>& Txy) +{ + addEnergy(W, LocalEnergy); +} + +// END VIRTUAL FUNCTIONS // + +bool OperatorBase::isClassical() const noexcept { return quantum_domain_ == CLASSICAL; } + +bool OperatorBase::isQuantum() const noexcept { return quantum_domain_ == QUANTUM; } + +bool OperatorBase::isClassicalClassical() const noexcept { return quantum_domain_ == CLASSICAL_CLASSICAL; } + +bool OperatorBase::isQuantumClassical() const noexcept { return quantum_domain_ == QUANTUM_CLASSICAL; } + +bool OperatorBase::isQuantumQuantum() const noexcept { return quantum_domain_ == QUANTUM_QUANTUM; } + +bool OperatorBase::getMode(const int i) const noexcept { return update_mode_[i]; } + +bool OperatorBase::isNonLocal() const noexcept { return update_mode_[NONLOCAL]; } + + +#if !defined(REMOVE_TRACEMANAGER) + +void OperatorBase::contributeTraceQuantities() +{ + contributeScalarQuantities(); + contributeParticleQuantities(); +} + +void OperatorBase::checkoutTraceQuantities(TraceManager& tm) +{ + checkoutScalarQuantities(tm); + checkoutParticleQuantities(tm); +} + +void OperatorBase::collectScalarTraces() { collectScalarQuantities(); } + +void OperatorBase::deleteTraceQuantities() +{ + deleteScalarQuantities(); + deleteParticleQuantities(); + streaming_scalars_ = false; + streaming_particles_ = false; + have_required_traces_ = false; + request_.reset(); +} + +#endif + +////// PROTECTED FUNCTIONS void OperatorBase::setEnergyDomain(EnergyDomains edomain) { if (energyDomainValid(edomain)) @@ -170,33 +313,4 @@ void OperatorBase::twoBodyQuantumDomain(const ParticleSet& P1, const ParticleSet bool OperatorBase::quantumDomainValid(QuantumDomains qdomain) { return qdomain != NO_QUANTUM_DOMAIN; } -void OperatorBase::add2Hamiltonian(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& targetH) -{ - std::unique_ptr myclone = makeClone(qp, psi); - if (myclone) - { - targetH.addOperator(std::move(myclone), name_, update_mode_[PHYSICAL]); - } -} - -void OperatorBase::registerObservables(std::vector& h5desc, hid_t gid) const -{ - bool collect = update_mode_.test(COLLECTABLE); - //exclude collectables - if (!collect) - { - h5desc.emplace_back(name_); - auto& oh = h5desc.back(); - std::vector onedim(1, 1); - oh.set_dimensions(onedim, my_index_); - oh.open(gid); - } -} - -void OperatorBase::addEnergy(MCWalkerConfiguration& W, std::vector& LocalEnergy) -{ - APP_ABORT("Need specialization for " + name_ + - "::addEnergy(MCWalkerConfiguration &W).\n Required functionality not implemented\n"); -} - } // namespace qmcplusplus diff --git a/src/QMCHamiltonians/OperatorBase.h b/src/QMCHamiltonians/OperatorBase.h index 1bdecd0371..5dc2dcd79b 100644 --- a/src/QMCHamiltonians/OperatorBase.h +++ b/src/QMCHamiltonians/OperatorBase.h @@ -110,33 +110,40 @@ class OperatorBase : public QMCTraits NONLOCAL = 5, }; - ///constructor + /** + * @brief Construct a new Operator Base object + * Default and unique empty constructor. Initializes with default values. + */ OperatorBase(); - ///virtual destructor - virtual ~OperatorBase() {} + virtual ~OperatorBase() = default; + + //////// GETTER AND SETTER FUNCTIONS //////////////// - // getter for update_mode member /** - * @brief get update_mode_ + * @brief get update_mode_ reference + * * @return std::bitset<8>& reference of get_update_mode_ */ std::bitset<8>& getUpdateMode() noexcept; /** * @brief get a copy of value_ + * * @return Return_t copy of value_ */ Return_t getValue() const noexcept; /** * @brief getter a copy of my_name_, rvalue small string optimization + * * @return std::string copy of my_name_ member */ std::string getName() const noexcept; /** * @brief Set my_name member, uses small string optimization (pass by value) + * * @param name input */ void setName(const std::string name) noexcept; @@ -144,233 +151,305 @@ class OperatorBase : public QMCTraits #if !defined(REMOVE_TRACEMANAGER) /** * @brief Get request_ member + * * @return TraceRequest& reference to request_ */ TraceRequest& getRequest() noexcept; #endif - inline bool isClassical() { return quantum_domain_ == CLASSICAL; } - inline bool isQuantum() { return quantum_domain_ == QUANTUM; } - inline bool isClassicalClassical() { return quantum_domain_ == CLASSICAL_CLASSICAL; } - inline bool isQuantumClassical() { return quantum_domain_ == QUANTUM_CLASSICAL; } - inline bool isQuantumQuantum() { return quantum_domain_ == QUANTUM_QUANTUM; } + //////// PURELY VIRTUAL FUNCTIONS //////////////// + /** + * @brief Reset the data with the target ParticleSet + * @param P new target ParticleSet + */ + virtual void resetTargetParticleSet(ParticleSet& P) = 0; - /** return the mode i - * @param i index among PRIMARY, OPTIMIZABLE, RATIOUPDATE, PHYSICAL + /** + * @brief Evaluate the local energy contribution of this component + * @param P input configuration containing N particles + * @return the value of the Hamiltonian component */ - inline bool getMode(int i) { return update_mode_[i]; } + virtual Return_t evaluate(ParticleSet& P) = 0; - inline bool isNonLocal() const { return update_mode_[NONLOCAL]; } + /** write about the class */ + virtual bool get(std::ostream& os) const = 0; + + // TODO: add docs + virtual std::unique_ptr makeClone(ParticleSet& qp, TrialWaveFunction& psi) = 0; - /** named values to the property list + //////// VIRTUAL FUNCTIONS //////////////// + + /** + * @brief named values to the property list + * Default implementaton uses addValue(plist_) + * * @param plist RecordNameProperty * @param collectables Observables that are accumulated by evaluate - * - * Default implementaton uses addValue(plist) */ - virtual void addObservables(PropertySetType& plist, BufferType& collectables) { addValue(plist); } + virtual void addObservables(PropertySetType& plist, BufferType& collectables); - /*** add to observable descriptor for hdf5 + /** + * @brief add to observable descriptor for hdf5 + * The default implementation is to register a scalar for this->value_ + * * @param h5desc contains a set of hdf5 descriptors for a scalar observable * @param gid hdf5 group to which the observables belong - * - * The default implementation is to register a scalar for this->Value */ virtual void registerObservables(std::vector& h5desc, hid_t gid) const; - /*** add to collectables descriptor for hdf5 - * @param h5desc contains a set of hdf5 descriptors for a scalar observable - * @param gid hdf5 group to which the observables belong - * + /*** + * @brief add to collectables descriptor for hdf5 * The default implementation does nothing. The derived classes which compute * big data, e.g. density, should overwrite this function. + * + * @param h5desc contains a set of hdf5 descriptors for a scalar observable + * @param gid hdf5 group to which the observables belong */ - virtual void registerCollectables(std::vector& h5desc, hid_t gid) const {} + virtual void registerCollectables(std::vector& h5desc, hid_t gid) const; - /** set the values evaluated by this object to plist - * @param plist RecordNameProperty - * + /** + * @brief Set the values evaluated by this object to plist * Default implementation is to assign Value which is updated - * by evaluate function using myIndex. + * by evaluate function using my_index_. + * + * @param plist RecordNameProperty */ - virtual void setObservables(PropertySetType& plist) { plist[my_index_] = value_; } + virtual void setObservables(PropertySetType& plist); - virtual void setParticlePropertyList(PropertySetType& plist, int offset) { plist[my_index_ + offset] = value_; } + // TODO: add docs + virtual void setParticlePropertyList(PropertySetType& plist, int offset); - //virtual void setHistories(Walker& ThisWalker) - virtual void setHistories(Walker_t& ThisWalker) { t_walker_ = &(ThisWalker); } + // TODO: add docs + virtual void setHistories(Walker_t& ThisWalker); - /** reset the data with the target ParticleSet - * @param P new target ParticleSet - */ - virtual void resetTargetParticleSet(ParticleSet& P) = 0; + /** + * @brief Evaluate the local energy contribution of this component, deterministically based on current state. + * The correct behavior of this routine requires estimators with non-deterministic components + * in their evaluate() function to override this function. - /** Evaluate the local energy contribution of this component - *@param P input configuration containing N particles - *@return the value of the Hamiltonian component - */ - virtual Return_t evaluate(ParticleSet& P) = 0; - /** Evaluate the local energy contribution of this component, deterministically based on current state. - *@param P input configuration containing N particles - *@return the value of the Hamiltonian component + * @param P input configuration containing N particles + * @return the value of the Hamiltonian component */ virtual Return_t evaluateDeterministic(ParticleSet& P); - /** Evaluate the contribution of this component of multiple walkers */ + + /** + * @brief Evaluate the contribution of this component of multiple walkers. + * Take o_list and p_list update evaluation result variables in o_list? + * really should reduce vector of local_energies. matching the ordering and size of o list + * the this can be call for 1 or more QMCHamiltonians + + * @param o_list + * @param wf_list + * @param p_list + */ virtual void mw_evaluate(const RefVectorWithLeader& o_list, const RefVectorWithLeader& wf_list, const RefVectorWithLeader& p_list) const; + /** + * @brief TODO: add docs + + * @param o_list + * @param p_list + * @param optvars + * @param dlogpsi + * @param dhpsioverpsi + */ virtual void mw_evaluateWithParameterDerivatives(const RefVectorWithLeader& o_list, const RefVectorWithLeader& p_list, const opt_variables_type& optvars, RecordArray& dlogpsi, RecordArray& dhpsioverpsi) const; + /** + * @brief TODO: add docs + * + * @param P + * @return Return_t + */ + virtual Return_t rejectedMove(ParticleSet& P); + + /** + * @brief Evaluate the local energy contribution of this component with Toperators updated if requested - virtual Return_t rejectedMove(ParticleSet& P) { return 0; } - /** Evaluate the local energy contribution of this component with Toperators updated if requested - *@param P input configuration containing N particles - *@return the value of the Hamiltonian component + * @param P input configuration containing N particles + * @return the value of the Hamiltonian component */ - virtual Return_t evaluateWithToperator(ParticleSet& P) { return evaluate(P); } + virtual Return_t evaluateWithToperator(ParticleSet& P); - /** Evaluate the contribution of this component of multiple walkers */ + /** + * @brief Evaluate the contribution of this component of multiple walkers + + * @param o_list + * @param wf_list + * @param p_list + */ virtual void mw_evaluateWithToperator(const RefVectorWithLeader& o_list, const RefVectorWithLeader& wf_list, - const RefVectorWithLeader& p_list) const - { - mw_evaluate(o_list, wf_list, p_list); - } + const RefVectorWithLeader& p_list) const; - /** evaluate value and derivatives wrt the optimizables - * - * Default uses evaluate + /** + * @brief Evaluate value and derivatives wrt the optimizables. Default uses evaluate. + + * @param P + * @param optvars + * @param dlogpsi + * @param dhpsioverpsi + * @return Return_t */ virtual Return_t evaluateValueAndDerivatives(ParticleSet& P, const opt_variables_type& optvars, const std::vector& dlogpsi, - std::vector& dhpsioverpsi) - { - return evaluate(P); - } + std::vector& dhpsioverpsi); + + /** + * @brief Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase. - /** evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase. - * @param P target particle set (electrons) - * @param ions source particle set (ions) - * @param psi Trial wave function - * @param hf_terms Adds OperatorBase's contribution to Re [(dH)Psi]/Psi - * @param pulay_terms Adds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi - * @return Contribution of OperatorBase to Local Energy. - */ + * @param P target particle set (electrons) + * @param ions source particle set (ions) + * @param psi Trial wave function + * @param hf_terms Adds OperatorBase's contribution to Re [(dH)Psi]/Psi + * @param pulay_terms Adds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi + * @return Contribution of OperatorBase to Local Energy. + */ virtual Return_t evaluateWithIonDerivs(ParticleSet& P, ParticleSet& ions, TrialWaveFunction& psi, ParticleSet::ParticlePos_t& hf_term, - ParticleSet::ParticlePos_t& pulay_term) - { - return evaluate(P); - } - - /** evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase. - * @param P target particle set (electrons) - * @param ions source particle set (ions) - * @param psi Trial wave function - * @param hf_terms Adds OperatorBase's contribution to Re [(dH)Psi]/Psi - * @param pulay_terms Adds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi - * @return Contribution of OperatorBase to Local Energy. - */ + ParticleSet::ParticlePos_t& pulay_term); + + /** + * @brief Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase. + * If there's no stochastic component, defaults to evaluateWithIonDerivs. + * If not otherwise specified, this defaults to evaluate(). + + * @param P target particle set (electrons) + * @param ions source particle set (ions) + * @param psi Trial wave function + * @param hf_terms Adds OperatorBase's contribution to Re [(dH)Psi]/Psi + * @param pulay_terms Adds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi + * @return Contribution of OperatorBase to Local Energy. + */ virtual Return_t evaluateWithIonDerivsDeterministic(ParticleSet& P, ParticleSet& ions, TrialWaveFunction& psi, ParticleSet::ParticlePos_t& hf_term, - ParticleSet::ParticlePos_t& pulay_term) - { - //If there's no stochastic component, defaults to above defined evaluateWithIonDerivs. - //If not otherwise specified, this defaults to evaluate(). - return evaluateWithIonDerivs(P, ions, psi, hf_term, pulay_term); - } - /** update data associated with a particleset - * @param s source particle set - * + ParticleSet::ParticlePos_t& pulay_term); + + /** + * @brief Update data associated with a particleset. * Default implementation does nothing. Only A-A interactions for s needs to implement its own method. + + * @param s source particle set */ - virtual void updateSource(ParticleSet& s) {} + virtual void updateSource(ParticleSet& s); - /** return an average value by collective operation + /** + * @brief Return an average value by collective operation */ - virtual Return_t getEnsembleAverage() { return 0.0; } + virtual Return_t getEnsembleAverage(); - /** write about the class */ - virtual bool get(std::ostream& os) const = 0; + /** + * @brief Initialize a shared resource and hand it to a collection - /** initialize a shared resource and hand it to a collection + * @param collection */ - virtual void createResource(ResourceCollection& collection) const {} + virtual void createResource(ResourceCollection& collection) const; - /** acquire a shared resource from a collection - */ - virtual void acquireResource(ResourceCollection& collection, const RefVectorWithLeader& o_list) const {} + /** + * @brief Acquire a shared resource from a collection - /** return a shared resource to a collection + * @param collection + * @param o_list */ - virtual void releaseResource(ResourceCollection& collection, const RefVectorWithLeader& o_list) const {} - - virtual std::unique_ptr makeClone(ParticleSet& qp, TrialWaveFunction& psi) = 0; + virtual void acquireResource(ResourceCollection& collection, const RefVectorWithLeader& o_list) const; - //virtual std::unique_ptr makeClone(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& H); + /** + * @brief Return a shared resource to a collection + * + * @param collection + * @param o_list + */ + virtual void releaseResource(ResourceCollection& collection, const RefVectorWithLeader& o_list) const; - virtual void setRandomGenerator(RandomGenerator_t* rng) - { - //empty - } + /** + * @brief Set the Random Generator object + * TODO: add docs + * @param rng + */ + virtual void setRandomGenerator(RandomGenerator_t* rng); + /** + * @brief TODO: add docs + * + * @param qp + * @param psi + * @param targetH + */ virtual void add2Hamiltonian(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& targetH); #if !defined(REMOVE_TRACEMANAGER) - ///make trace quantities available - inline void contributeTraceQuantities() - { - contributeScalarQuantities(); - contributeParticleQuantities(); - } - - ///checkout trace arrays - inline void checkoutTraceQuantities(TraceManager& tm) - { - //derived classes must guard individual checkouts using request info - checkoutScalarQuantities(tm); - checkoutParticleQuantities(tm); - } - - ///collect scalar trace data - inline void collectScalarTraces() - { - //app_log()<<"OperatorBase::collectScalarTraces"<< std::endl; - collectScalarQuantities(); - } - - ///delete trace arrays - inline void deleteTraceQuantities() - { - deleteScalarQuantities(); - deleteParticleQuantities(); - streaming_scalars_ = false; - streaming_particles_ = false; - have_required_traces_ = false; - request_.reset(); - } - - virtual void getRequiredTraces(TraceManager& tm){}; + /** + * @brief TODO: add docs + * + * @param tm + */ + virtual void getRequiredTraces(TraceManager& tm); #endif + // TODO: add docs + virtual void addEnergy(MCWalkerConfiguration& W, std::vector& LocalEnergy); virtual void addEnergy(MCWalkerConfiguration& W, std::vector& LocalEnergy, - std::vector>& Txy) - { - addEnergy(W, LocalEnergy); - } + std::vector>& Txy); + + bool isClassical() const noexcept; + bool isQuantum() const noexcept; + bool isClassicalClassical() const noexcept; + bool isQuantumClassical() const noexcept; + bool isQuantumQuantum() const noexcept; + + /** + * @brief Return the mode i + * @param i index among PRIMARY, OPTIMIZABLE, RATIOUPDATE, PHYSICAL + */ + bool getMode(const int i) const noexcept; + + /** + * @brief TODO: add docs + * + * @return true + * @return false + */ + bool isNonLocal() const noexcept; + + +#if !defined(REMOVE_TRACEMANAGER) + + /** + * @brief Make trace quantities available + */ + void contributeTraceQuantities(); + + /** + * @brief Checkout trace arrays + * Derived classes must guard individual checkouts using request info + * @param tm + */ + void checkoutTraceQuantities(TraceManager& tm); + + /** + * @brief Collect scalar trace data + */ + void collectScalarTraces(); + + /** + * @brief delete trace arrays + */ + void deleteTraceQuantities(); +#endif protected: ///set the current update mode @@ -401,12 +480,17 @@ class OperatorBase : public QMCTraits bool have_required_traces_; #endif + + /////PURELY VIRTUAL FUNCTIONS + /** * Read the input parameter * @param cur xml node for a OperatorBase object */ virtual bool put(xmlNodePtr cur) = 0; + //////VIRTUAL FUNCTIONS + #if !defined(REMOVE_TRACEMANAGER) virtual void contributeScalarQuantities() { request_.contribute_scalar(name_); } From ea9814a51e06d7b2340b7b5b97a56fcc29f93a82 Mon Sep 17 00:00:00 2001 From: William F Godoy Date: Tue, 28 Sep 2021 15:19:14 -0400 Subject: [PATCH 04/11] Refactor protected functions Into a single translation unit --- src/QMCHamiltonians/OperatorBase.cpp | 47 ++++++++++++++++++++++++---- src/QMCHamiltonians/OperatorBase.h | 46 +++++++++------------------ 2 files changed, 56 insertions(+), 37 deletions(-) diff --git a/src/QMCHamiltonians/OperatorBase.cpp b/src/QMCHamiltonians/OperatorBase.cpp index 96a64fbd4e..b29002a390 100644 --- a/src/QMCHamiltonians/OperatorBase.cpp +++ b/src/QMCHamiltonians/OperatorBase.cpp @@ -48,7 +48,7 @@ void OperatorBase::setName(const std::string name) noexcept { name_ = name; } TraceRequest& OperatorBase::getRequest() noexcept { return request_; } #endif -//////// VIRTUAL FUNCTIONS //////////////// +//////// FUNCTIONS //////////////// void OperatorBase::addObservables(PropertySetType& plist, BufferType& collectables) { addValue(plist); } void OperatorBase::registerObservables(std::vector& h5desc, hid_t gid) const @@ -213,7 +213,7 @@ void OperatorBase::addEnergy(MCWalkerConfiguration& W, addEnergy(W, LocalEnergy); } -// END VIRTUAL FUNCTIONS // +// END FUNCTIONS // bool OperatorBase::isClassical() const noexcept { return quantum_domain_ == CLASSICAL; } @@ -259,6 +259,35 @@ void OperatorBase::deleteTraceQuantities() #endif ////// PROTECTED FUNCTIONS +#if !defined(REMOVE_TRACEMANAGER) +void OperatorBase::contributeScalarQuantities() { request_.contribute_scalar(name_); } + +void OperatorBase::checkoutScalarQuantities(TraceManager& tm) +{ + streaming_scalars_ = request_.streaming_scalar(name_); + if (streaming_scalars_) + value_sample_ = tm.checkout_real<1>(name_); +} + +void OperatorBase::collectScalarQuantities() +{ + if (streaming_scalars_) + (*value_sample_)(0) = value_; +} + +void OperatorBase::deleteScalarQuantities() +{ + if (streaming_scalars_) + delete value_sample_; +} + +void OperatorBase::contributeParticleQuantities(){}; +void OperatorBase::checkoutParticleQuantities(TraceManager& tm){}; +void OperatorBase::deleteParticleQuantities(){}; +#endif + +void OperatorBase::setComputeForces(bool compute) {} + void OperatorBase::setEnergyDomain(EnergyDomains edomain) { if (energyDomainValid(edomain)) @@ -297,10 +326,10 @@ void OperatorBase::twoBodyQuantumDomain(const ParticleSet& P) void OperatorBase::twoBodyQuantumDomain(const ParticleSet& P1, const ParticleSet& P2) { - bool c1 = P1.is_classical(); - bool c2 = P2.is_classical(); - bool q1 = P1.is_quantum(); - bool q2 = P2.is_quantum(); + const bool c1 = P1.is_classical(); + const bool c2 = P2.is_classical(); + const bool q1 = P1.is_quantum(); + const bool q2 = P2.is_quantum(); if (c1 && c2) quantum_domain_ = CLASSICAL_CLASSICAL; else if ((q1 && c2) || (c1 && q2)) @@ -311,6 +340,12 @@ void OperatorBase::twoBodyQuantumDomain(const ParticleSet& P1, const ParticleSet APP_ABORT("OperatorBase::twoBodyQuantumDomain(P1,P2)\n quantum domain of input particles is invalid"); } +void OperatorBase::addValue(PropertySetType& plist) +{ + if (!update_mode_[COLLECTABLE]) + my_index_ = plist.add(name_.c_str()); +} + bool OperatorBase::quantumDomainValid(QuantumDomains qdomain) { return qdomain != NO_QUANTUM_DOMAIN; } } // namespace qmcplusplus diff --git a/src/QMCHamiltonians/OperatorBase.h b/src/QMCHamiltonians/OperatorBase.h index 5dc2dcd79b..8154d64e82 100644 --- a/src/QMCHamiltonians/OperatorBase.h +++ b/src/QMCHamiltonians/OperatorBase.h @@ -492,38 +492,26 @@ class OperatorBase : public QMCTraits //////VIRTUAL FUNCTIONS #if !defined(REMOVE_TRACEMANAGER) - virtual void contributeScalarQuantities() { request_.contribute_scalar(name_); } + virtual void contributeScalarQuantities(); - virtual void checkoutScalarQuantities(TraceManager& tm) - { - streaming_scalars_ = request_.streaming_scalar(name_); - if (streaming_scalars_) - value_sample_ = tm.checkout_real<1>(name_); - } + virtual void checkoutScalarQuantities(TraceManager& tm); - virtual void collectScalarQuantities() - { - if (streaming_scalars_) - (*value_sample_)(0) = value_; - } + virtual void collectScalarQuantities(); - virtual void deleteScalarQuantities() - { - if (streaming_scalars_) - delete value_sample_; - } + virtual void deleteScalarQuantities(); - virtual void contributeParticleQuantities(){}; - virtual void checkoutParticleQuantities(TraceManager& tm){}; - virtual void deleteParticleQuantities(){}; + virtual void contributeParticleQuantities(); + virtual void checkoutParticleQuantities(TraceManager& tm); + virtual void deleteParticleQuantities(); #endif - virtual void setComputeForces(bool compute) - { - // empty - } + virtual void setComputeForces(bool compute); - ///set energy domain + /** + * @brief Set the Energy Domain + * + * @param edomain + */ void setEnergyDomain(EnergyDomains edomain); ///set quantum domain @@ -539,16 +527,12 @@ class OperatorBase : public QMCTraits void twoBodyQuantumDomain(const ParticleSet& P1, const ParticleSet& P2); /** - * named values to the property list + * @brief named values to the property list * @param plist RecordNameProperty * * Previously addObservables but it is renamed and a non-virtial function. */ - inline void addValue(PropertySetType& plist) - { - if (!update_mode_[COLLECTABLE]) - my_index_ = plist.add(name_.c_str()); - } + void addValue(PropertySetType& plist); private: ///quantum_domain_ of the (particle) operator, default = no_quantum_domain From db5ec23927ca7202544bf3a54f1463e571562ac8 Mon Sep 17 00:00:00 2001 From: William F Godoy Date: Tue, 28 Sep 2021 15:54:16 -0400 Subject: [PATCH 05/11] Refactor private functions --- src/QMCHamiltonians/OperatorBase.cpp | 5 ++++- src/QMCHamiltonians/OperatorBase.h | 10 ++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/QMCHamiltonians/OperatorBase.cpp b/src/QMCHamiltonians/OperatorBase.cpp index b29002a390..5bad8b7c27 100644 --- a/src/QMCHamiltonians/OperatorBase.cpp +++ b/src/QMCHamiltonians/OperatorBase.cpp @@ -346,6 +346,9 @@ void OperatorBase::addValue(PropertySetType& plist) my_index_ = plist.add(name_.c_str()); } -bool OperatorBase::quantumDomainValid(QuantumDomains qdomain) { return qdomain != NO_QUANTUM_DOMAIN; } +////// PRIVATE FUNCTIONS +bool OperatorBase::energyDomainValid(EnergyDomains edomain) const noexcept { return edomain != NO_ENERGY_DOMAIN; } + +bool OperatorBase::quantumDomainValid(QuantumDomains qdomain) const noexcept { return qdomain != NO_QUANTUM_DOMAIN; } } // namespace qmcplusplus diff --git a/src/QMCHamiltonians/OperatorBase.h b/src/QMCHamiltonians/OperatorBase.h index 8154d64e82..2f0afa8f26 100644 --- a/src/QMCHamiltonians/OperatorBase.h +++ b/src/QMCHamiltonians/OperatorBase.h @@ -548,16 +548,10 @@ class OperatorBase : public QMCTraits #endif ///return whether the energy domain is valid - inline bool energyDomainValid(EnergyDomains edomain) const { return edomain != NO_ENERGY_DOMAIN; } - - ///return whether the energy domain is valid - inline bool energyDomainValid() const { return energyDomainValid(energy_domain_); } - - ///return whether the quantum domain is valid - bool quantumDomainValid(QuantumDomains qdomain); + bool energyDomainValid(EnergyDomains edomain) const noexcept; ///return whether the quantum domain is valid - inline bool quantumDomainValid() { return quantumDomainValid(quantum_domain_); } + bool quantumDomainValid(QuantumDomains qdomain) const noexcept; }; } // namespace qmcplusplus #endif From 8d8c262312c9116cfdb6f639d810d22075b50b59 Mon Sep 17 00:00:00 2001 From: William F Godoy Date: Tue, 28 Sep 2021 15:59:50 -0400 Subject: [PATCH 06/11] Apply RAII in constructor --- src/QMCHamiltonians/OperatorBase.cpp | 20 +++++++++++++------- src/QMCHamiltonians/OperatorBase.h | 1 - 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/QMCHamiltonians/OperatorBase.cpp b/src/QMCHamiltonians/OperatorBase.cpp index 5bad8b7c27..14ebad3b32 100644 --- a/src/QMCHamiltonians/OperatorBase.cpp +++ b/src/QMCHamiltonians/OperatorBase.cpp @@ -23,16 +23,22 @@ namespace qmcplusplus { // PUBLIC -OperatorBase::OperatorBase() : value_(0.0), my_index_(-1), t_walker_(0) -{ - quantum_domain_ = NO_QUANTUM_DOMAIN; - energy_domain_ = NO_ENERGY_DOMAIN; +OperatorBase::OperatorBase() + : value_(0.0), + my_index_(-1), + t_walker_(0), #if !defined(REMOVE_TRACEMANAGER) - streaming_scalars_ = false; - streaming_particles_ = false; - have_required_traces_ = false; + streaming_particles_(false), + have_required_traces_(false), #endif + quantum_domain_(NO_QUANTUM_DOMAIN), + energy_domain_(NO_ENERGY_DOMAIN) +#if !defined(REMOVE_TRACEMANAGER) + , + streaming_scalars_(false) +#endif +{ update_mode_.set(PRIMARY, 1); } diff --git a/src/QMCHamiltonians/OperatorBase.h b/src/QMCHamiltonians/OperatorBase.h index 2f0afa8f26..7baeb473f2 100644 --- a/src/QMCHamiltonians/OperatorBase.h +++ b/src/QMCHamiltonians/OperatorBase.h @@ -480,7 +480,6 @@ class OperatorBase : public QMCTraits bool have_required_traces_; #endif - /////PURELY VIRTUAL FUNCTIONS /** From decb0ead783b6ad5e0d141fe1b3af3c50ba283cc Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Tue, 28 Sep 2021 18:56:29 -0500 Subject: [PATCH 07/11] Less ugly ifdef. --- src/QMCHamiltonians/OperatorBase.cpp | 5 +---- src/QMCHamiltonians/OperatorBase.h | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/QMCHamiltonians/OperatorBase.cpp b/src/QMCHamiltonians/OperatorBase.cpp index 14ebad3b32..7b3e3fbba7 100644 --- a/src/QMCHamiltonians/OperatorBase.cpp +++ b/src/QMCHamiltonians/OperatorBase.cpp @@ -31,13 +31,10 @@ OperatorBase::OperatorBase() #if !defined(REMOVE_TRACEMANAGER) streaming_particles_(false), have_required_traces_(false), + streaming_scalars_(false), #endif quantum_domain_(NO_QUANTUM_DOMAIN), energy_domain_(NO_ENERGY_DOMAIN) -#if !defined(REMOVE_TRACEMANAGER) - , - streaming_scalars_(false) -#endif { update_mode_.set(PRIMARY, 1); } diff --git a/src/QMCHamiltonians/OperatorBase.h b/src/QMCHamiltonians/OperatorBase.h index 7baeb473f2..6aeba48f94 100644 --- a/src/QMCHamiltonians/OperatorBase.h +++ b/src/QMCHamiltonians/OperatorBase.h @@ -534,11 +534,6 @@ class OperatorBase : public QMCTraits void addValue(PropertySetType& plist); private: - ///quantum_domain_ of the (particle) operator, default = no_quantum_domain - QuantumDomains quantum_domain_; - ///energy domain of the operator (kinetic/potential), default = no_energy_domain - EnergyDomains energy_domain_; - #if !defined(REMOVE_TRACEMANAGER) bool streaming_scalars_; @@ -546,6 +541,11 @@ class OperatorBase : public QMCTraits Array* value_sample_; #endif + ///quantum_domain_ of the (particle) operator, default = no_quantum_domain + QuantumDomains quantum_domain_; + ///energy domain of the operator (kinetic/potential), default = no_energy_domain + EnergyDomains energy_domain_; + ///return whether the energy domain is valid bool energyDomainValid(EnergyDomains edomain) const noexcept; From 7325f32ec8bdf2188b89516d2a36d368c18f2fab Mon Sep 17 00:00:00 2001 From: Peter Doak Date: Tue, 28 Sep 2021 18:43:36 -0400 Subject: [PATCH 08/11] Adding OneBodyDensityMatricesInput and tests --- src/Estimators/CMakeLists.txt | 2 +- src/Estimators/InputSection.cpp | 6 +- src/Estimators/InputSection.h | 9 +- .../OneBodyDensityMatricesInput.cpp | 42 ++++++ src/Estimators/OneBodyDensityMatricesInput.h | 120 ++++++++++++++++++ src/Estimators/tests/CMakeLists.txt | 3 +- ...ensityTesting.cpp => EstimatorTesting.cpp} | 4 +- ...pinDensityTesting.h => EstimatorTesting.h} | 6 +- .../InvalidOneBodyDensityMatricesInput.h | 53 ++++++++ .../tests/ValidOneBodyDensityMatricesInput.h | 53 ++++++++ .../test_OneBodyDensityMatricesInput.cpp | 53 ++++++++ .../tests/test_SpinDensityInput.cpp | 2 +- src/Estimators/tests/test_SpinDensityNew.cpp | 4 +- 13 files changed, 342 insertions(+), 15 deletions(-) create mode 100644 src/Estimators/OneBodyDensityMatricesInput.cpp create mode 100644 src/Estimators/OneBodyDensityMatricesInput.h rename src/Estimators/tests/{SpinDensityTesting.cpp => EstimatorTesting.cpp} (92%) rename src/Estimators/tests/{SpinDensityTesting.h => EstimatorTesting.h} (84%) create mode 100644 src/Estimators/tests/InvalidOneBodyDensityMatricesInput.h create mode 100644 src/Estimators/tests/ValidOneBodyDensityMatricesInput.h create mode 100644 src/Estimators/tests/test_OneBodyDensityMatricesInput.cpp diff --git a/src/Estimators/CMakeLists.txt b/src/Estimators/CMakeLists.txt index ca025cce76..af3af2da5f 100644 --- a/src/Estimators/CMakeLists.txt +++ b/src/Estimators/CMakeLists.txt @@ -24,7 +24,7 @@ set(QMCEST_SRC OperatorEstBase.cpp SpinDensityNew.cpp MomentumDistribution.cpp - ) + OneBodyDensityMatricesInput.cpp) #################################### # create libqmcestimators diff --git a/src/Estimators/InputSection.cpp b/src/Estimators/InputSection.cpp index e94e19ff74..4cee4759c5 100644 --- a/src/Estimators/InputSection.cpp +++ b/src/Estimators/InputSection.cpp @@ -63,7 +63,6 @@ void InputSection::readXML(xmlNodePtr cur) // check input validity check_valid(); - //report(); } @@ -79,7 +78,6 @@ void InputSection::init(const std::unordered_map& init_va // check input validity check_valid(); - //report(); } @@ -91,7 +89,6 @@ void InputSection::set_defaults() set_from_value(name, default_value); } - void InputSection::set_from_stream(const std::string& name, std::istringstream& svalue) { if (is_string(name)) @@ -158,7 +155,8 @@ void InputSection::check_valid() << " has not been assigned\n"; throw UniformCommunicateError(error.str()); } -} + this->checkParticularValidity(); +}; void InputSection::report() const diff --git a/src/Estimators/InputSection.h b/src/Estimators/InputSection.h index b68718d3f2..5b1736fadb 100644 --- a/src/Estimators/InputSection.h +++ b/src/Estimators/InputSection.h @@ -61,7 +61,7 @@ class InputSection // Enable read-only access to variable values. // Needs updating to allow copy-less return. template - T get(const std::string& name) const + const T get(const std::string& name) const { return std::any_cast(values.at(name)); } @@ -74,6 +74,13 @@ class InputSection // Initialize from unordered_map/initializer list void init(const std::unordered_map& init_values); +protected: + /** Do validation for a particular subtype of InputSection + * Called by check_valid. + * Default implementation is noop + */ + virtual void checkParticularValidity() {} + private: // Query functions bool is_attribute(const std::string& name) const { return attributes.find(name) != attributes.end(); } diff --git a/src/Estimators/OneBodyDensityMatricesInput.cpp b/src/Estimators/OneBodyDensityMatricesInput.cpp new file mode 100644 index 0000000000..6fda7243cd --- /dev/null +++ b/src/Estimators/OneBodyDensityMatricesInput.cpp @@ -0,0 +1,42 @@ +////////////////////////////////////////////////////////////////////////////////////// +// This file is distributed under the University of Illinois/NCSA Open Source License. +// See LICENSE file in top directory for details. +// +// Copyright (c) 2021 QMCPACK developers. +// +// File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory +// +// Some code refactored from: DensityMatrices1b.cpp +////////////////////////////////////////////////////////////////////////////////////// + +#include "string_utils.h" +#include "OneBodyDensityMatricesInput.h" + +namespace qmcplusplus +{ + +OneBodyDensityMatricesInput::OneBodyDensityMatricesInput(){}; +OneBodyDensityMatricesInput::OneBodyDensityMatricesInput(xmlNodePtr cur) +{ + // This results in checkParticularValidity being called on OneBodyDensityMatrixInputSection + input_section_.readXML(cur); +} + +void OneBodyDensityMatricesInput::OneBodyDensityMatrixInputSection::checkParticularValidity() +{ + if (has("scale")) + { + Real scale = get("scale"); + std::cout << "SCALE is :" << scale << '\n'; + if (scale > 1.0 + 1e-10) + throw UniformCommunicateError("OneBodyDensityMatrices input: scale must be less than one"); + else if (scale < 0.0 - 1e-10) + throw UniformCommunicateError("OneBodyDensityMatrices input: scale must be greater than zero"); + } + std::string basis_str = get("basis"); + auto basis_set_names = split(basis_str); + if (basis_set_names.size() == 0 || basis_set_names[0].size() == 0) + throw UniformCommunicateError("OneBodyDensityMatrices input: basis must have at least one sposet"); +} + +} // namespace qmcplusplus diff --git a/src/Estimators/OneBodyDensityMatricesInput.h b/src/Estimators/OneBodyDensityMatricesInput.h new file mode 100644 index 0000000000..3aa8855d7c --- /dev/null +++ b/src/Estimators/OneBodyDensityMatricesInput.h @@ -0,0 +1,120 @@ +////////////////////////////////////////////////////////////////////////////////////// +// This file is distributed under the University of Illinois/NCSA Open Source License. +// See LICENSE file in top directory for details. +// +// Copyright (c) 2021 QMCPACK developers. +// +// File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory +// +// Some code refactored from: DensityMatrices1b.h +////////////////////////////////////////////////////////////////////////////////////// + +#ifndef QMCPLUSPLUS_ONE_BODY_DENSITY_MATRICES_INPUT_H +#define QMCPLUSPLUS_ONE_BODY_DENSITY_MATRICES_INPUT_H + +#include "Configuration.h" +#include "InputSection.h" + +namespace qmcplusplus +{ +/** Native representation for DensityMatrices1B Estimator's inputs + */ +class OneBodyDensityMatricesInput +{ +public: + enum class Integrators + { + UNIFORM_GRID, + UNIFORM, + DENSITY, + NO_INTEGRATOR + }; + + enum class Evaluators + { + LOOP, + MATRIX, + NO_EVALUATOR + }; + + enum class Samplings + { + VOLUME_BASED, + METROPOLIS, + NO_SAMPLING + }; + + class OneBodyDensityMatrixInputSection : public InputSection + { + public: + /** parse time definition of input parameters */ + OneBodyDensityMatrixInputSection() + { + section_name = "OneBodyDensityMatrix"; + attributes = {"name", "type"}; + parameters = {"basis", "energy_matrix", "integrator", "evaluator", "scale", + "center", "points", "samples", "warmup", "timestep", + "use_drift", "check_overlap", "check_derivatives", "acceptance_ratio", "rstats", + "normalized", "volumed_normed"}; + bools = {"energy_matrix", "use_drift", "normalized", "volume_normed", + "check_overlap", "check_derivatives", "rstats", "acceptance_ratio"}; + strings = {"name", "type", "basis", "integrator", "evaluator"}; + integers = {"points", "samples"}; + reals = {"scale", "timestep"}; + required = {"name", "basis"}; + // I'd much rather see the default defined in simple native c++ as below + } + + /** do parse time checks of input */ + void checkParticularValidity() override; + }; + + using Position = QMCTraits::PosType; + using Real = QMCTraits::FullPrecRealType; + + OneBodyDensityMatricesInput(); + OneBodyDensityMatricesInput(xmlNodePtr cur); + +private: + OneBodyDensityMatrixInputSection input_section_; + + bool energy_matrix_ = false; + bool use_drift_ = false; + bool normalized_ = true; + bool volume_normalized_ = true; + bool check_overlap_ = false; + bool check_derivatives_ = false; + bool rstats_ = false; + bool acceptance_ratio_ = false; + Integrators integrator_ = Integrators::UNIFORM_GRID; + Samplings sampling_ = Samplings::VOLUME_BASED; + Evaluators evaluator_ = Evaluators::LOOP; + Real scale_ = 1.0; + Position center_ = 0.0; + Real timestep_ = 0.5; + int points_ = 10; + int samples_ = 10; + int warmup_samples_ = 30; +public: + bool get_energy_matrix() const { return energy_matrix_; } + bool get_use_drift() const { return use_drift_; } + bool get_normalized() const { return normalized_; } + bool get_volume_normalized() const { return volume_normalized_; } + bool get_check_overlap() const { return check_overlap_; } + bool get_check_derivatives() const { return check_derivatives_; } + bool get_rstats() const { return rstats_; } + bool get_acceptance_ratio() const { return acceptance_ratio_; } + Integrators get_integrator() const { return integrator_; } + Samplings get_sampling() const { return sampling_; } + Evaluators get_evaluator() const { return evaluator_; } + Real get_scale() const { return scale_; } + Position get_center() const { return center_; } + Real get_timestep() const { return timestep_; } + int get_points() const { return points_; } + int get_samples() const { return samples_; } + int get_warmup_samples() const { return warmup_samples_; } +}; + +} // namespace qmcplusplus + +#endif diff --git a/src/Estimators/tests/CMakeLists.txt b/src/Estimators/tests/CMakeLists.txt index bd2c5f3a1f..2ee4136b3e 100644 --- a/src/Estimators/tests/CMakeLists.txt +++ b/src/Estimators/tests/CMakeLists.txt @@ -23,10 +23,11 @@ set(SRCS test_manager.cpp test_EstimatorManagerNew.cpp test_trace_manager.cpp - SpinDensityTesting.cpp + EstimatorTesting.cpp test_SpinDensityInput.cpp test_SpinDensityNew.cpp test_InputSection.cpp + test_OneBodyDensityMatricesInput.cpp ) add_executable(${UTEST_EXE} ${SRCS}) diff --git a/src/Estimators/tests/SpinDensityTesting.cpp b/src/Estimators/tests/EstimatorTesting.cpp similarity index 92% rename from src/Estimators/tests/SpinDensityTesting.cpp rename to src/Estimators/tests/EstimatorTesting.cpp index b190f020f9..339a3e96ab 100644 --- a/src/Estimators/tests/SpinDensityTesting.cpp +++ b/src/Estimators/tests/EstimatorTesting.cpp @@ -2,14 +2,14 @@ // This file is distributed under the University of Illinois/NCSA Open Source License. // See LICENSE file in top directory for details. // -// Copyright (c) 2020 QMCPACK developers. +// Copyright (c) 2021 QMCPACK developers. // // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory // // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory ////////////////////////////////////////////////////////////////////////////////////// -#include "SpinDensityTesting.h" +#include "EstimatorTesting.h" namespace qmcplusplus { diff --git a/src/Estimators/tests/SpinDensityTesting.h b/src/Estimators/tests/EstimatorTesting.h similarity index 84% rename from src/Estimators/tests/SpinDensityTesting.h rename to src/Estimators/tests/EstimatorTesting.h index 324557980f..91f99e68b4 100644 --- a/src/Estimators/tests/SpinDensityTesting.h +++ b/src/Estimators/tests/EstimatorTesting.h @@ -2,15 +2,15 @@ // This file is distributed under the University of Illinois/NCSA Open Source License. // See LICENSE file in top directory for details. // -// Copyright (c) 2020 QMCPACK developers. +// Copyright (c) 2021 QMCPACK developers. // // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory // // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory ////////////////////////////////////////////////////////////////////////////////////// -#ifndef QMCPLUSPLUS_SPINDENSITYTESTING_H -#define QMCPLUSPLUS_SPINDENSITYTESTING_H +#ifndef QMCPLUSPLUS_ESTIMATOR_TESTING_H +#define QMCPLUSPLUS_ESTIMATOR_TESTING_H #include "ParticleSet.h" diff --git a/src/Estimators/tests/InvalidOneBodyDensityMatricesInput.h b/src/Estimators/tests/InvalidOneBodyDensityMatricesInput.h new file mode 100644 index 0000000000..0a75477c63 --- /dev/null +++ b/src/Estimators/tests/InvalidOneBodyDensityMatricesInput.h @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////////////// +// This file is distributed under the University of Illinois/NCSA Open Source License. +// See LICENSE file in top directory for details. +// +// Copyright (c) 2021 QMCPACK developers. +// +// File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab +// +// File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab +////////////////////////////////////////////////////////////////////////////////////// + +#ifndef QMCPLUSPLUS_INVALID_OBDM_INPUT_H +#define QMCPLUSPLUS_INVALID_OBDM_INPUT_H + +#include + +namespace qmcplusplus +{ +namespace testing +{ +// clang-format: off +constexpr std::array invalid_one_body_density_matrices_input_sections{ + R"( + + spo_u spo_uv + matrix + path + -0.2 + 64 + 0.5 + no + +)", + R"( + + dm_basis + loop + uniform + 128 + 1.1 + 0.5 + yes + +)" + // clang-format: on +}; + +constexpr int invalid_obdm_input_bad_integrator = 0; +constexpr int invalid_obdm_input_bad_scale = 1; +} // namespace testing +} // namespace qmcplusplus + +#endif diff --git a/src/Estimators/tests/ValidOneBodyDensityMatricesInput.h b/src/Estimators/tests/ValidOneBodyDensityMatricesInput.h new file mode 100644 index 0000000000..5cf5d2e7ea --- /dev/null +++ b/src/Estimators/tests/ValidOneBodyDensityMatricesInput.h @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////////////// +// This file is distributed under the University of Illinois/NCSA Open Source License. +// See LICENSE file in top directory for details. +// +// Copyright (c) 2021 QMCPACK developers. +// +// File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab +// +// File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab +////////////////////////////////////////////////////////////////////////////////////// + +#ifndef QMCPLUSPLUS_VALID_OBDM_INPUT_H +#define QMCPLUSPLUS_VALID_OBDM_INPUT_H + +#include + +namespace qmcplusplus +{ +namespace testing +{ +// clang-format: off +constexpr std::array valid_one_body_density_matrices_input_sections{ + R"( + + spo_u spo_uv + matrix + density + 64 + 0.5 + no + +)", + R"( + + dm_basis + loop + uniform + 128 + 0.8 + 0.5 + yes + +)" + // clang-format: on +}; + +constexpr int valid_obdm_input = 0; +constexpr int vlaid_obdm_input_scale = 1; + +} // namespace testing +} // namespace qmcplusplus + +#endif diff --git a/src/Estimators/tests/test_OneBodyDensityMatricesInput.cpp b/src/Estimators/tests/test_OneBodyDensityMatricesInput.cpp new file mode 100644 index 0000000000..1beb4a80f6 --- /dev/null +++ b/src/Estimators/tests/test_OneBodyDensityMatricesInput.cpp @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////////////// +// This file is distributed under the University of Illinois/NCSA Open Source License. +// See LICENSE file in top directory for details. +// +// Copyright (c) 2021 QMCPACK developers. +// +// File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab +// +// File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab +////////////////////////////////////////////////////////////////////////////////////// + + +#include "catch.hpp" + +#include "OneBodyDensityMatricesInput.h" +#include "ValidOneBodyDensityMatricesInput.h" +#include "InvalidOneBodyDensityMatricesInput.h" +#include "EstimatorTesting.h" +#include "ParticleSet.h" +#include "OhmmsData/Libxml2Doc.h" +#include "Message/UniformCommunicateError.h" + +#include + +namespace qmcplusplus +{ +TEST_CASE("OneBodyDensityMatricesInput::from_xml", "[estimators]") +{ + using POLT = PtclOnLatticeTraits; + using Lattice = POLT::ParticleLayout_t; + + for (auto input_xml : testing::valid_one_body_density_matrices_input_sections) + { + Libxml2Document doc; + bool okay = doc.parseFromString(input_xml); + REQUIRE(okay); + xmlNodePtr node = doc.getRoot(); + OneBodyDensityMatricesInput obdmi(node); + } + + for (auto input_xml : testing::invalid_one_body_density_matrices_input_sections) + { + Libxml2Document doc; + bool okay = doc.parseFromString(input_xml); + REQUIRE(okay); + xmlNodePtr node = doc.getRoot(); + + CHECK_THROWS_AS(OneBodyDensityMatricesInput(node), UniformCommunicateError); + } + +} + +} // namespace qmcplusplus diff --git a/src/Estimators/tests/test_SpinDensityInput.cpp b/src/Estimators/tests/test_SpinDensityInput.cpp index 157906a7f9..64efa90125 100644 --- a/src/Estimators/tests/test_SpinDensityInput.cpp +++ b/src/Estimators/tests/test_SpinDensityInput.cpp @@ -14,7 +14,7 @@ #include "SpinDensityInput.h" #include "ValidSpinDensityInput.h" -#include "SpinDensityTesting.h" +#include "EstimatorTesting.h" #include "ParticleSet.h" #include "OhmmsData/Libxml2Doc.h" diff --git a/src/Estimators/tests/test_SpinDensityNew.cpp b/src/Estimators/tests/test_SpinDensityNew.cpp index 6e4ec13d9d..ede76f9081 100644 --- a/src/Estimators/tests/test_SpinDensityNew.cpp +++ b/src/Estimators/tests/test_SpinDensityNew.cpp @@ -2,7 +2,7 @@ // This file is distributed under the University of Illinois/NCSA Open Source License. // See LICENSE file in top directory for details. // -// Copyright (c) 2020 QMCPACK developers. +// Copyright (c) 2021 QMCPACK developers. // // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Lab // @@ -18,7 +18,7 @@ #include "RandomForTest.h" #include "ParticleSet.h" #include "TrialWaveFunction.h" -#include "SpinDensityTesting.h" +#include "EstimatorTesting.h" #include "OhmmsData/Libxml2Doc.h" From 6601fe903d535a70fac040b46d29e77c00955392 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Wed, 29 Sep 2021 16:23:13 -0500 Subject: [PATCH 09/11] Fix accidentally moved executables by #3467 --- src/QMCTools/CMakeLists.txt | 1 + src/Sandbox/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/QMCTools/CMakeLists.txt b/src/QMCTools/CMakeLists.txt index 1c48896f66..5f358da550 100644 --- a/src/QMCTools/CMakeLists.txt +++ b/src/QMCTools/CMakeLists.txt @@ -17,6 +17,7 @@ project(qmctools) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${qmcpack_BINARY_DIR}/bin) add_executable(convert4qmc convert4qmc.cpp QMCGaussianParserBase.cpp GaussianFCHKParser.cpp GamesAsciiParser.cpp LCAOHDFParser.cpp DiracParser.cpp) diff --git a/src/Sandbox/CMakeLists.txt b/src/Sandbox/CMakeLists.txt index eaea5cc545..c371a21443 100644 --- a/src/Sandbox/CMakeLists.txt +++ b/src/Sandbox/CMakeLists.txt @@ -1,5 +1,6 @@ project(Sandbox) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${qmcpack_BINARY_DIR}/bin) # add apps XYZ.cpp, e.g., qmc_particles.cpp set(ESTEST diff_distancetables einspline_spo einspline_spo_nested determinant restart determinant_delayed_update) From d8b9ea4ffff501adeea4292534776ebe0dc0f586 Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Wed, 29 Sep 2021 16:30:43 -0500 Subject: [PATCH 10/11] Need special care in src/QMCTools/tests --- src/QMCTools/tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/QMCTools/tests/CMakeLists.txt b/src/QMCTools/tests/CMakeLists.txt index 2be1e44c11..c4d276111e 100644 --- a/src/QMCTools/tests/CMakeLists.txt +++ b/src/QMCTools/tests/CMakeLists.txt @@ -10,6 +10,7 @@ #////////////////////////////////////////////////////////////////////////////////////// +unset(CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(SRC_DIR tools) set(UTEST_EXE test_${SRC_DIR}) set(UTEST_NAME deterministic-unit_test_${SRC_DIR}) From adca6d172759c93d9014d9e8789d3be4f84d0635 Mon Sep 17 00:00:00 2001 From: Jaron Krogel Date: Thu, 30 Sep 2021 07:48:53 -0400 Subject: [PATCH 11/11] nexus: fix convert4qmc usage --- nexus/lib/qmcpack_converters.py | 10 ++++------ nexus/tests/unit/test_qmcpack_converter_simulations.py | 6 ++++-- nexus/tests/unit/test_qmcpack_simulation.py | 7 +++++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nexus/lib/qmcpack_converters.py b/nexus/lib/qmcpack_converters.py index f4c66562dc..09867ac56e 100644 --- a/nexus/lib/qmcpack_converters.py +++ b/nexus/lib/qmcpack_converters.py @@ -799,10 +799,8 @@ def get_result(self,result_name,sim): wfn_file,ptcl_file = self.list_output_files() if result_name=='orbitals': result.location = os.path.join(self.locdir,wfn_file) - if self.input.hdf5==True: - orbfile = self.get_prefix()+'.orbs.h5' - result.orbfile = os.path.join(self.locdir,orbfile) - #end if + orbfile = self.get_prefix()+'.orbs.h5' + result.orbfile = os.path.join(self.locdir,orbfile) elif result_name=='particles': result.location = os.path.join(self.locdir,ptcl_file) else: @@ -841,7 +839,7 @@ def incorporate_result(self,result_name,result,sim): self.input_code = 'pyscf' if result_name=='orbitals': orbpath = os.path.relpath(result.h5_file,self.locdir) - input.pyscf = orbpath + input.orbitals = orbpath else: implemented = False #end if @@ -849,7 +847,7 @@ def incorporate_result(self,result_name,result,sim): self.input_code = 'qp' if result_name=='orbitals': orbpath = os.path.relpath(result.outfile,self.locdir) - input.qp = orbpath + input.orbitals = orbpath else: implemented = False #end if diff --git a/nexus/tests/unit/test_qmcpack_converter_simulations.py b/nexus/tests/unit/test_qmcpack_converter_simulations.py index 0704ab4176..ba82d7bc1b 100644 --- a/nexus/tests/unit/test_qmcpack_converter_simulations.py +++ b/nexus/tests/unit/test_qmcpack_converter_simulations.py @@ -251,6 +251,7 @@ def test_convert4qmc_get_result(): result_ref = obj( location = './runs/sample.wfj.xml', + orbfile = './runs/sample.orbs.h5', ) assert(object_eq(result,result_ref)) @@ -338,7 +339,7 @@ def test_convert4qmc_incorporate_result(): sim.incorporate_result('orbitals',pscf_result,pscf) assert(sim.input_code=='pyscf') - assert(sim.input.pyscf=='../scf.h5') + assert(sim.input.orbitals=='../scf.h5') # incorporate orbitals from quantum package sim = sim_start.copy() @@ -349,7 +350,8 @@ def test_convert4qmc_incorporate_result(): sim.incorporate_result('orbitals',qp_result,qp) assert(sim.input_code=='qp') - assert(sim.input.qp=='../qp_savewf.out') + #assert(sim.input.qp=='../qp_savewf.out') + assert(sim.input.orbitals=='../qp_savewf.out') clear_all_sims() #end def test_convert4qmc_incorporate_result diff --git a/nexus/tests/unit/test_qmcpack_simulation.py b/nexus/tests/unit/test_qmcpack_simulation.py index 2a3fdaa523..4c8f7c7237 100644 --- a/nexus/tests/unit/test_qmcpack_simulation.py +++ b/nexus/tests/unit/test_qmcpack_simulation.py @@ -272,7 +272,8 @@ def test_incorporate_result(): result = c4q_orb.get_result('orbitals',None) - wfn_file = os.path.join(tpath,'c4q_orbitals.wfj.xml') + wfn_file = os.path.join(tpath,'c4q_orbitals.wfj.xml') + wfn_file2 = os.path.join(tpath,'c4q_orbitals.orbs.h5') input = sim.input.copy() dset = input.get('determinantset') dset.href = 'orbs.h5' @@ -281,6 +282,8 @@ def test_incorporate_result(): input.qmcsystem = qs input.write(wfn_file) assert(os.path.exists(wfn_file)) + open(wfn_file2,'w').write('fake') + assert(os.path.exists(wfn_file2)) from qmcpack_input import QmcpackInput inp = QmcpackInput(wfn_file) @@ -291,7 +294,7 @@ def test_incorporate_result(): sim.incorporate_result('orbitals',result,c4q_orb) dset = sim.input.get('determinantset') - assert(dset.href=='orbs.h5') + assert(dset.href=='c4q_orbitals.orbs.h5') # incorporate qmcpack jastrow