16 #ifndef QMCPLUSPLUS_MULTISLATERDETERMINANTFAST_ORBITAL_H 17 #define QMCPLUSPLUS_MULTISLATERDETERMINANTFAST_ORBITAL_H 92 std::vector<std::unique_ptr<MultiDiracDeterminant>>&& dets,
93 bool use_pre_computing);
98 std::string
getClassName()
const override {
return "MultiSlaterDetTableMethod"; }
131 int ig)
const override;
140 std::vector<GradType>& grad_now)
const override;
145 std::vector<PsiValue>& ratios,
146 std::vector<GradType>& grad_new)
const override;
151 std::vector<PsiValue>& ratios)
const override;
164 throw std::runtime_error(
" Need to implement MultiSlaterDetTableMethod::evaluateRatiosAlltoOne. \n");
168 void restore(
int iat)
override;
173 const std::vector<bool>& isAccepted,
174 bool safe_to_delay =
false)
const override;
196 std::vector<ValueType>& ratios,
205 void initialize(std::unique_ptr<std::vector<std::vector<size_t>>> C2node_in,
206 std::unique_ptr<std::vector<ValueType>> C_in,
207 std::unique_ptr<opt_variables_type> myVars_in,
208 std::unique_ptr<CSFData> csf_data_in,
210 bool CI_optimizable);
217 while (iat >
Last[
id])
231 std::vector<GradType>& grad_now,
232 std::vector<PsiValue>& psi_list);
272 std::optional<std::pair<unsigned, PsiValue>> move = std::nullopt)
const;
275 std::vector<std::unique_ptr<MultiDiracDeterminant>>
Dets;
280 std::shared_ptr<std::vector<std::vector<size_t>>>
C2node;
282 std::shared_ptr<std::vector<ValueType>>
C;
286 std::shared_ptr<opt_variables_type>
myVars;
315 std::vector<Array<GradType, OHMMS_DIM>>
dGa;
327 det_list.reserve(wfc_list.size());
329 det_list.push_back(*static_cast<MultiSlaterDetTableMethod&>(wfc).
Dets[det_id]);
const std::vector< ValueType > & getLinearExpansionCoefs() const
base class for Single-particle orbital sets
std::shared_ptr< CSFData > csf_data_
CSF data set. If nullptr, not using CSF.
std::vector< Matrix< RealType > > dpsia
Walker< QMCTraits, PtclOnLatticeTraits > Walker_t
walker type
ParticleSet::ParticleGradient myG_temp
OrbitalSetTraits< ValueType >::ValueVector ValueVector
WaveFunctionComponent::PsiValue PsiValue
std::vector< RealType > expansion
helper functions for EinsplineSetBuilder
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
bool CI_Optimizable
if true, the CI coefficients are optimized
void evaluateMultiDiracDeterminantDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
QTBase::RealType RealType
MultiSlaterDetTableMethod(ParticleSet &targetPtcl, std::vector< std::unique_ptr< MultiDiracDeterminant >> &&dets, bool use_pre_computing)
constructor
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
std::vector< ValueType > coeffs
std::shared_ptr< opt_variables_type > myVars
void mw_calcRatio(const RefVectorWithLeader< WaveFunctionComponent > &WFC_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, std::vector< PsiValue > &ratios) const override
std::shared_ptr< std::vector< ValueType > > C
CI coefficients.
ResourceHandle manages the temporary resource referenced from a collection.
Walker_t::WFBuffer_t WFBufferType
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
PsiValue evalGrad_impl_no_precompute(ParticleSet &P, int iat, bool newpos, GradType &g_at)
an implementation shared by evalGrad and ratioGrad.
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
LatticeGaussianProduct::GradType GradType
ParticleSet::ParticleGradient gmPG
void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs) override
extract underlying OptimizableObject references
Timer accumulates time and call counts.
void precomputeC_otherDs(const ParticleSet &P, int ig)
precompute C_otherDs for a given particle group
WaveFunctionComponent::ValueType ValueType
std::vector< Matrix< RealType > > dLa
void evaluateDerivativesMSD(Vector< ValueType > &dlogpsi, std::optional< std::pair< unsigned, PsiValue >> move=std::nullopt) const
compute parameter derivatives of CI/CSF coefficients
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const override
make clone
Attaches a unit to a Vector for IO.
void evaluateMultiDiracDeterminantDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
void resetParametersExclusive(const opt_variables_type &active) override
reset the parameters during optimizations.
OrbitalSetTraits< ValueType >::HessType HessType
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
return a shared resource to a collection
RefVectorWithLeader< MultiDiracDeterminant > extract_DetRef_list(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, int det_id) const
void prepareGroup(ParticleSet &P, int ig) override
Prepare internal data for updating WFC correspond to a particle group It should be called before movi...
void restore(int iat) override
If a move for iat-th particle is rejected, restore to the content.
An abstract class for a component of a many-body trial wave function.
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix
Specialized paritlce class for atomistic simulations.
PsiValue evalGradWithSpin_impl_no_precompute(ParticleSet &P, int iat, bool newpos, GradType &g_at, ComplexType &sg_at)
PsiValue ratioGradWithSpin(ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new spin gradient Default im...
void calcIndividualDetRatios(Vector< ValueType > &ratios)
Compute ratios of the individual Slater determinants and the total MSD value.
QTBase::ValueType ValueType
static void mw_evalGrad_impl(const RefVectorWithLeader< WaveFunctionComponent > &WFC_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, bool newpos, std::vector< GradType > &grad_now, std::vector< PsiValue > &psi_list)
multi walker version of evalGrad_impl
std::vector< OffloadVector< ValueType > > C_otherDs
C_n x D^1_n x D^2_n ... D^3_n with one D removed. Summed by group. [spin, unique det id]...
ParticleSet::ParticleGradient myG
std::vector< std::unique_ptr< MultiDiracDeterminant > > Dets
determinant collection
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to a collection
PsiValue evalGradWithSpin_impl(ParticleSet &P, int iat, bool newpos, GradType &g_at, ComplexType &sg_at)
std::vector< int > Last
the last particle of each group
std::vector< Array< GradType, OHMMS_DIM > > dGa
class to handle a set of variables that can be modified during optimizations
std::shared_ptr< std::vector< std::vector< size_t > > > C2node
map determinant in linear combination to unique det list map global det id to unique det id...
void initialize(std::unique_ptr< std::vector< std::vector< size_t >>> C2node_in, std::unique_ptr< std::vector< ValueType >> C_in, std::unique_ptr< opt_variables_type > myVars_in, std::unique_ptr< CSFData > csf_data_in, bool optimizable, bool CI_optimizable)
initialize a few objects and states by the builder YL: it should be part of the constructor.
QTFull::ValueType PsiValue
bool isOptimizable() const override
if true, this contains optimizable components
ParticleSet::ParticleLaplacian myL_temp
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios) override
bool isMultiDet() const final
true, if this component is multi-determinant
const bool use_pre_computing_
use pre-compute (fast) algorithm
OrbitalSetTraits< ValueType >::GradVector GradVector
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
PsiValue psi_ratio_to_ref_det_
current psi over ref single det
CASTTYPE & getCastedLeader() const
ResourceHandle< MultiSlaterDetTableMethodMultiWalkerResource > mw_res_handle_
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
acquire a shared resource from a collection
void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios) override
void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi) override
PsiValue evalGrad_impl(ParticleSet &P, int iat, bool newpos, GradType &g_at)
an implementation shared by evalGrad and ratioGrad.
~MultiSlaterDetTableMethod() override
destructor
std::vector< size_t > dets_per_csf
GradType evalGradWithSpin(ParticleSet &P, int iat, ComplexType &spingrad) override
return the current spin gradient for the iat-th particle Default implementation assumes that WaveFunc...
NewTimer & PrepareGroupTimer
void mw_evalGrad(const RefVectorWithLeader< WaveFunctionComponent > &WFC_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, std::vector< GradType > &grad_now) const override
compute the current gradients for the iat-th particle of multiple walkers
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios) override
WaveFunctionComponent::RealType RealType
QMCTraits::ComplexType ComplexType
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
void checkOutVariables(const opt_variables_type &active) override
check out variational optimizable variables
int getDetID(const int iat) const
PsiValue ratio(ParticleSet &P, int iat) override
evaluate the ratio of the new to old WaveFunctionComponent value
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
void mw_prepareGroup(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int ig) const override
trait class to handel a set of Orbitals
ParticleSet::ParticleLaplacian myL
void mw_ratioGrad(const RefVectorWithLeader< WaveFunctionComponent > &WFC_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_new) const override
PsiValue computeRatio_NewMultiDet_to_NewRefDet(int det_id) const
void mw_accept_rejectMove(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool safe_to_delay=false) const override
moves of the iat-th particle on some walkers in a batch is accepted.
OrbitalSetTraits< ValueType >::IndexVector IndexVector
A container class to represent a walker.
LogValue evaluate_vgl_impl(const ParticleSet &P, ParticleSet::ParticleGradient &g_tmp, ParticleSet::ParticleLaplacian &l_tmp)
Compute VGL of this MultiSlaterDetTableMethod.
std::vector< ValueVector > laplSum
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
PsiValue new_psi_ratio_to_new_ref_det_
new psi over new ref single det when one particle is moved
An AntiSymmetric WaveFunctionComponent composed of a linear combination of SlaterDeterminants.
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
a move for iat-th particle is accepted.
void checkInVariablesExclusive(opt_variables_type &active) override
check in variational parameters to the global list of parameters used by the optimizer.
NewTimer & RatioGradTimer
bool isFermionic() const final
true, if this component is fermionic
std::string getClassName() const override
return class name