18 #ifndef QMCPLUSPLUS_SLATERDETERMINANT_WITHBASE_H 19 #define QMCPLUSPLUS_SLATERDETERMINANT_WITHBASE_H 26 class TWFFastDerivWrapper;
33 const std::vector<std::unique_ptr<Determinant_t>>
Dets;
39 std::vector<std::unique_ptr<Determinant_t>> dets,
40 const std::string& class_name =
"SlaterDet");
68 bool fromscratch)
override;
74 bool fromscratch)
const override;
80 const std::vector<bool>&
recompute)
const override;
85 inline int size()
const {
return Dets.size(); }
113 std::vector<ValueType>& ratios,
118 std::vector<std::vector<ValueType>>& ratios)
const override 123 const int det_id =
getDetID(vp_list[0].refPtcl);
135 std::vector<PsiValue>& ratios,
136 std::vector<GradType>& grad_now)
const override;
141 std::vector<PsiValue>& ratios,
142 std::vector<GradType>& grad_now,
143 std::vector<ComplexType>& spingrad_now)
const override;
149 return Dets[
getDetID(iat)]->evalGradWithSpin(P, iat, spingrad);
155 std::vector<GradType>& grad_now)
const override 164 std::vector<GradType>& grad_now,
165 std::vector<ComplexType>& spingrad_now)
const override;
170 for (
int iz = 0; iz <
size(); iz++)
182 for (
int iz = 0; iz <
size(); iz++)
194 for (
int i = 0; i <
Dets.size(); ++i)
201 const std::vector<bool>& isAccepted,
202 bool safe_to_delay =
false)
const override 209 for (
int iw = 0; iw < wfc_list.size(); iw++)
213 for (
int i = 0; i <
Dets.size(); ++i)
218 Dets[i]->mw_accept_rejectMove(Det_list, p_list, iat, isAccepted, safe_to_delay);
220 for (
int iw = 0; iw < wfc_list.size(); iw++)
228 for (
int i = 0; i <
Dets.size(); i++)
234 for (
int i = 0; i <
Dets.size(); i++)
243 std::vector<PsiValue>& ratios)
const override 267 dlogpsi[kk] = dhpsioverpsi[kk] = 0.0;
270 for (
int i = 0; i <
Dets.size(); i++)
286 for (
int i = 0; i <
Dets.size(); i++)
292 for (
int i = 0; i <
Dets.size(); i++)
301 while (iat >
Last[
id])
312 Det_list.reserve(wfc_list.size());
314 Det_list.push_back(*static_cast<SlaterDet&>(wfc).
Dets[det_id]);
base class for Single-particle orbital sets
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios) override
evaluate ratios to evaluate the non-local PP
Declaration of DiracDeterminantBase with a S(ingle)P(article)O(rbital)Set.
void evaluateHessian(ParticleSet &P, HessVector &grad_grad_psi) override
void checkOutVariables(const opt_variables_type &active) override
check out variational optimizable variables
LogValue evaluateGL(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, bool fromscratch) override
compute gradients and laplacian of the TWF with respect to each particle.
void evaluateGradDerivatives(const ParticleSet::ParticleGradient &G_in, std::vector< ValueType > &dgradlogpsi) override
Calculates the derivatives of with respect to the optimizable parameters, and the dot product of thi...
void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios) override
evaluate ratios to evaluate the non-local PP
std::string getClassName() const override
return class name
void mw_evaluateRatios(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const override
evaluate ratios to evaluate the non-local PP multiple walkers
WaveFunctionComponent::PsiValue PsiValue
helper functions for EinsplineSetBuilder
QTBase::GradType GradType
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const override
make clone
int size() const
return the total number of Dirac determinants
void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs) override
extract underlying OptimizableObject references
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
PsiValue ratio(ParticleSet &P, int iat) override
evaluate the ratio of the new to old WaveFunctionComponent value
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.
constexpr std::complex< float > czero
Walker_t::WFBuffer_t WFBufferType
void mw_ratioGradWithSpin(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_now, std::vector< ComplexType > &spingrad_now) const override
compute the ratio of the new to old WaveFunctionComponent value and the new gradient/spingradient of ...
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
GradType evalGradSource(ParticleSet &P, ParticleSet &src, int iat, TinyVector< ParticleSet::ParticleGradient, OHMMS_DIM > &grad_grad, TinyVector< ParticleSet::ParticleLaplacian, OHMMS_DIM > &lapl_grad) override
Adds the gradient w.r.t.
int getDetID(const int iat) const
int refPtcl
Reference particle.
LatticeGaussianProduct::GradType GradType
QTBase::ComplexType ComplexType
const std::vector< std::unique_ptr< Determinant_t > > Dets
container for the DiracDeterminants
GradType evalGradSource(ParticleSet &P, ParticleSet &src, int iat) override
return the logarithmic gradient for the iat-th particle of the source particleset ...
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to a collection
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
void mw_evaluateLog(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< ParticleSet::ParticleGradient > &G_list, const RefVector< ParticleSet::ParticleLaplacian > &L_list) const override
evaluate from scratch the same type WaveFunctionComponent of multiple walkers
void restore(int iat) override
If a move for iat-th particle is rejected, restore to the content.
opt_variables_type myVars
list of variables this WaveFunctionComponent handles
std::complex< QTFull::RealType > LogValue
void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios) override
evaluate the ratios of one virtual move with respect to all the particles
An abstract class for a component of a many-body trial wave function.
Specialized paritlce class for atomistic simulations.
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
return a shared resource to a collection
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...
RefVectorWithLeader< WaveFunctionComponent > extract_DetRef_list(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, int det_id) const
SPOSetPtr getPhi(int i=0)
void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &active, Vector< ValueType > &dlogpsi) override
Compute the derivatives of the log of the wavefunction with respect to optimizable parameters...
void recompute(const ParticleSet &P) override
recompute the value of the WaveFunctionComponents which require critical accuracy.
void registerTWFFastDerivWrapper(const ParticleSet &P, TWFFastDerivWrapper &twf) const override
Register the component with the TWFFastDerivWrapper wrapper.
void mw_ratioGrad(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_now) const override
compute the ratio of the new to old WaveFunctionComponent value and the new gradient of multiple walk...
CASTTYPE & getCastedElement(size_t i) const
class to handle a set of variables that can be modified during optimizations
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
int where(int i) const
return the locator of the i-th Index
bool isFermionic() const final
true, if this component is fermionic
bool isOptimizable() const override
if true, this contains optimizable components
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
acquire a shared resource from a collection
QTFull::ValueType PsiValue
void completeUpdates() override
complete all the delayed or asynchronous operations before leaving the p-by-p move region...
size_type size() const
return the size
LogValue log_value_
Current .
~SlaterDet() override
destructor
GradType evalGradWithSpin(ParticleSet &P, int iat, ComplexType &spingrad) override
return the current spin gradient for the iat-th particle Default implementation assumes that WaveFunc...
std::vector< std::reference_wrapper< T > > RefVector
CASTTYPE & getCastedLeader() const
const LogValue & get_log_value() const
void evaluateSpinorRatios(const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multiplier, std::vector< ValueType > &ratios) override
Used by SOECPComponent for faster SOC evaluation.
std::vector< int > Last
the last particle of each group
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &active, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimi...
void mw_evalGradWithSpin(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< GradType > &grad_now, std::vector< ComplexType > &spingrad_now) const override
compute the current gradients and spin gradients for the iat-th particle of multiple walkers ...
void mw_completeUpdates(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
complete all the delayed or asynchronous operations for all the walkers in a batch before leaving the...
QMCTraits::ComplexType ComplexType
OrbitalSetTraits< ValueType >::HessVector HessVector
void mw_recompute(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const override
void mw_evaluateGL(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< ParticleSet::ParticleGradient > &G_list, const RefVector< ParticleSet::ParticleLaplacian > &L_list, bool fromscratch) const override
evaluate gradients and laplacian of the same type WaveFunctionComponent of multiple walkers ...
std::complex< double > LogValue
SlaterDet(ParticleSet &targetPtcl, std::vector< std::unique_ptr< Determinant_t >> dets, const std::string &class_name="SlaterDet")
constructor
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
a move for iat-th particle is accepted.
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 mw_calcRatio(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios) const override
compute the ratio of the new to old WaveFunctionComponent value of multiple walkers ...