Fix fast force bug. Improper inititalization of wrapper in QMCHamiltonian

This commit is contained in:
rcclay 2022-09-22 10:35:07 -06:00
parent 0463182966
commit a892addd8d
2 changed files with 12 additions and 4 deletions

View File

@ -1131,6 +1131,7 @@ QMCHamiltonian::FullPrecRealType QMCHamiltonian::evaluateIonDerivsDeterministicF
if (!psi_wrapper_.isInitialized())
{
psi_in.initializeTWFFastDerivWrapper(P, psi_wrapper_);
psi_wrapper_.finalizeConstruction();
}
P.update();
//resize everything;

View File

@ -40,7 +40,7 @@ public:
using ValueVector = SPOSet::ValueVector;
using GradVector = SPOSet::GradVector;
inline TWFFastDerivWrapper():is_initialized(false){};
inline TWFFastDerivWrapper():is_initialized_(false){};
/** @brief Add a particle group.
*
* Here, a "group" corresponds to a subset of particles which are antisymmetric with
@ -60,6 +60,13 @@ public:
jastrow_list_.push_back(j);
};
//This function gets called after all the Jastrow and SPOSet objects have been registered.
//Not pretty, but plays nicest with the fact that TrialWavefunction handles the construction
//of the wrapper.
inline void finalizeConstruction()
{
is_initialized_=true;
}
/** @brief Takes particle set groupID and returns the TWF internal index for it.
*
* ParticleSet groups can be registered in whichever order. However, the internal indexing
@ -86,7 +93,7 @@ public:
inline IndexType numGroups() const { return spos_.size(); };
SPOSet* getSPOSet(const IndexType sid) const { return spos_[sid]; };
inline IndexType numOrbitals(const IndexType sid) const { return spos_[sid]->size(); };
inline bool isInitialized(){return is_initialized;};
inline bool isInitialized(){return is_initialized_;};
/** @} */
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -272,7 +279,7 @@ public:
private:
bool is_initialized;
bool is_initialized_;
std::vector<SPOSet*> spos_;
std::vector<IndexType> groups_;
std::vector<ValueMatrix> psi_M_;