From 7a7614a83b1e5ef1f5b558d72b03ba27c73525db Mon Sep 17 00:00:00 2001 From: William F Godoy Date: Wed, 25 Oct 2023 21:01:02 -0400 Subject: [PATCH] Fix ornl CI tests sulfur: Add missing SPOSet header in NiO tests nitrogen: Add missing memory header for std::unique_ptr --- src/Particle/WalkerConfigurationsT.h | 229 +++++++----------- .../tests/test_einset_NiO_a16.cpp | 1 + 2 files changed, 85 insertions(+), 145 deletions(-) diff --git a/src/Particle/WalkerConfigurationsT.h b/src/Particle/WalkerConfigurationsT.h index 7b9cae36d3a..207a8811940 100644 --- a/src/Particle/WalkerConfigurationsT.h +++ b/src/Particle/WalkerConfigurationsT.h @@ -26,6 +26,8 @@ #include "Particle/Walker.h" #include "Utilities/IteratorUtility.h" +#include + namespace qmcplusplus { /** Monte Carlo Data of an ensemble @@ -37,214 +39,151 @@ namespace qmcplusplus * - Variance variance * - LivingFraction fraction of walkers alive each step. */ -template +template struct MCDataType { - T NumSamples; - T RNSamples; - T Weight; - T Energy; - T AlternateEnergy; - T Variance; - T R2Accepted; - T R2Proposed; - T LivingFraction; + T NumSamples; + T RNSamples; + T Weight; + T Energy; + T AlternateEnergy; + T Variance; + T R2Accepted; + T R2Proposed; + T LivingFraction; }; /** A set of light weight walkers that are carried between driver sections and * restart */ -template +template class WalkerConfigurationsT { public: - /// walker type - using Walker_t = Walker, LatticeParticleTraits>; - using RealType = typename Walker_t::RealType; - using FullPrecRealType = typename ParticleSetTraits::FullPrecRealType; - /// container type of Walkers - using walker_list__t = std::vector>; - /// FIX: a type alias of iterator for an object should not be for just one - /// of many objects it holds. - using iterator = typename walker_list__t::iterator; - /// const_iterator of Walker container - using const_iterator = typename walker_list__t::const_iterator; - - MCDataType EnsembleProperty; - - WalkerConfigurationsT(); - ~WalkerConfigurationsT(); - WalkerConfigurationsT(const WalkerConfigurationsT&) = delete; - WalkerConfigurationsT& - operator=(const WalkerConfigurationsT&) = delete; - WalkerConfigurationsT(WalkerConfigurationsT&&) = default; - WalkerConfigurationsT& - operator=(WalkerConfigurationsT&&) = default; - - /** create numWalkers Walkers + /// walker type + using Walker_t = Walker, LatticeParticleTraits>; + using RealType = typename Walker_t::RealType; + using FullPrecRealType = typename ParticleSetTraits::FullPrecRealType; + /// container type of Walkers + using walker_list__t = std::vector>; + /// FIX: a type alias of iterator for an object should not be for just one + /// of many objects it holds. + using iterator = typename walker_list__t::iterator; + /// const_iterator of Walker container + using const_iterator = typename walker_list__t::const_iterator; + + MCDataType EnsembleProperty; + + WalkerConfigurationsT(); + ~WalkerConfigurationsT(); + WalkerConfigurationsT(const WalkerConfigurationsT&) = delete; + WalkerConfigurationsT& operator=(const WalkerConfigurationsT&) = delete; + WalkerConfigurationsT(WalkerConfigurationsT&&) = default; + WalkerConfigurationsT& operator=(WalkerConfigurationsT&&) = default; + + /** create numWalkers Walkers * * Append Walkers to walker_list_. */ - void - createWalkers(int numWalkers, size_t numPtcls); - /** create walkers + void createWalkers(int numWalkers, size_t numPtcls); + /** create walkers * @param first walker iterator * @param last walker iterator */ - void - createWalkers(iterator first, iterator last); - /** copy walkers + void createWalkers(iterator first, iterator last); + /** copy walkers * @param first input walker iterator * @param last input walker iterator * @param start first target iterator * * No memory allocation is allowed. */ - void - copyWalkers(iterator first, iterator last, iterator start); + void copyWalkers(iterator first, iterator last, iterator start); - /** destroy Walkers from itstart to itend + /** destroy Walkers from itstart to itend *@param first starting iterator of the walkers *@param last ending iterator of the walkers */ - iterator - destroyWalkers(iterator first, iterator last); + iterator destroyWalkers(iterator first, iterator last); - /** destroy Walkers + /** destroy Walkers *@param nw number of walkers to be destroyed */ - void - destroyWalkers(int nw); + void destroyWalkers(int nw); - /// clean up the walker list and make a new list - void - resize(int numWalkers, size_t numPtcls); + /// clean up the walker list and make a new list + void resize(int numWalkers, size_t numPtcls); - /// return the number of active walkers - inline size_t - getActiveWalkers() const - { - return walker_list_.size(); - } - /// return the total number of active walkers among a MPI group - inline size_t - getGlobalNumWalkers() const - { - return walker_offsets_.empty() ? 0 : walker_offsets_.back(); - } - /// return the total number of active walkers among a MPI group + /// return the number of active walkers + inline size_t getActiveWalkers() const { return walker_list_.size(); } + /// return the total number of active walkers among a MPI group + inline size_t getGlobalNumWalkers() const { return walker_offsets_.empty() ? 0 : walker_offsets_.back(); } + /// return the total number of active walkers among a MPI group - inline void - setWalkerOffsets(const std::vector& o) - { - walker_offsets_ = o; - } - inline const std::vector& - getWalkerOffsets() const - { - return walker_offsets_; - } + inline void setWalkerOffsets(const std::vector& o) { walker_offsets_ = o; } + inline const std::vector& getWalkerOffsets() const { return walker_offsets_; } - /// return the first iterator - inline iterator - begin() - { - return walker_list_.begin(); - } - /// return the last iterator, [begin(), end()) - inline iterator - end() - { - return walker_list_.end(); - } + /// return the first iterator + inline iterator begin() { return walker_list_.begin(); } + /// return the last iterator, [begin(), end()) + inline iterator end() { return walker_list_.end(); } - /// return the first const_iterator - inline const_iterator - begin() const - { - return walker_list_.begin(); - } + /// return the first const_iterator + inline const_iterator begin() const { return walker_list_.begin(); } - /// return the last const_iterator [begin(), end()) - inline const_iterator - end() const - { - return walker_list_.end(); - } - /**@}*/ + /// return the last const_iterator [begin(), end()) + inline const_iterator end() const { return walker_list_.end(); } + /**@}*/ - /** clear the walker_list_ without destroying them + /** clear the walker_list_ without destroying them * * Provide std::vector::clear interface */ - inline void - clear() - { - walker_list_.clear(); - } + inline void clear() { walker_list_.clear(); } - /** insert elements + /** insert elements * @param it locator where the inserting begins * @param first starting iterator * @param last ending iterator * * Provide std::vector::insert interface */ - template - inline void - insert(iterator it, INPUT_ITER first, INPUT_ITER last) - { - walker_list_.insert(it, first, last); - } + template + inline void insert(iterator it, INPUT_ITER first, INPUT_ITER last) + { + walker_list_.insert(it, first, last); + } - /** add Walker_t* at the end + /** add Walker_t* at the end * @param awalker pointer to a walker * * Provide std::vector::push_back interface */ - inline void - push_back(std::unique_ptr awalker) - { - walker_list_.push_back(std::move(awalker)); - } + inline void push_back(std::unique_ptr awalker) { walker_list_.push_back(std::move(awalker)); } - /** delete the last Walker_t* + /** delete the last Walker_t* * * Provide std::vector::pop_back interface */ - inline void - pop_back() - { - walker_list_.pop_back(); - } + inline void pop_back() { walker_list_.pop_back(); } - inline Walker_t* - operator[](int i) - { - return walker_list_[i].get(); - } + inline Walker_t* operator[](int i) { return walker_list_[i].get(); } - inline const Walker_t* - operator[](int i) const - { - return walker_list_[i].get(); - } + inline const Walker_t* operator[](int i) const { return walker_list_[i].get(); } - /** reset the Walkers + /** reset the Walkers */ - void - reset(); + void reset(); - /// save the particle positions of all the walkers into target - void - putConfigurations(RealType* target, FullPrecRealType* weights) const; + /// save the particle positions of all the walkers into target + void putConfigurations(RealType* target, FullPrecRealType* weights) const; protected: - /// a collection of walkers - walker_list__t walker_list_; + /// a collection of walkers + walker_list__t walker_list_; private: - /** starting index of the walkers in a processor group + /** starting index of the walkers in a processor group * * walker_offsets_[0]=0 and walker_offsets_[walker_offsets_.size()-1]=total * number of walkers in a group @@ -252,7 +191,7 @@ class WalkerConfigurationsT * the number of walkers on a processor, i.e., W.getActiveWalkers(). * walker_offsets_ is added to handle parallel I/O with hdf5 */ - std::vector walker_offsets_; + std::vector walker_offsets_; }; } // namespace qmcplusplus #endif diff --git a/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp b/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp index 6642f86761c..094276211bc 100644 --- a/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp +++ b/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp @@ -19,6 +19,7 @@ #include "QMCWaveFunctions/WaveFunctionComponent.h" #include "BsplineFactory/EinsplineSetBuilder.h" #include "BsplineFactory/EinsplineSpinorSetBuilder.h" +#include "QMCWaveFunctions/SPOSet.h" #include #include