22 #ifndef QMCPLUSPLUS_DIRACDETERMINANT_H 23 #define QMCPLUSPLUS_DIRACDETERMINANT_H 27 #if defined(ENABLE_CUDA) 30 #if defined(ENABLE_SYCL) 36 template<
typename DU_TYPE = DelayedUpdate<QMCTraits::ValueType, QMCTraits::QTFull::ValueType>>
43 void resize(
int nel,
int morb);
72 std::string
getClassName()
const override {
return "DiracDeterminant"; }
113 std::vector<std::vector<ValueType>>& ratios)
const override;
117 std::vector<ValueType>& ratios,
127 std::vector<PsiValue>& ratios,
128 std::vector<GradType>& grad_new)
const override;
149 const std::vector<bool>& isAccepted,
150 bool safe_to_delay =
false)
const override 152 for (
int iw = 0; iw < wfc_list.size(); iw++)
154 wfc_list[iw].acceptMove(p_list[iw], iat, safe_to_delay);
156 wfc_list[iw].restore(iat);
163 for (
int iw = 0; iw < wfc_list.size(); iw++)
169 void restore(
int iat)
override;
187 bool fromscratch)
override;
204 std::unique_ptr<DiracDeterminantBase>
makeCopy(std::unique_ptr<SPOSet>&& spo)
const override;
279 #if defined(ENABLE_CUDA) 282 #if defined(ENABLE_SYCL) OrbitalSetTraits< ValueType >::HessVector HessVector
Declaration of DiracDeterminantBase with a S(ingle)P(article)O(rbital)Set.
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
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wf_list) const override
acquire a shared resource from a collection
void recompute(const ParticleSet &P) override
recompute the value of the WaveFunctionComponents which require critical accuracy.
WaveFunctionComponent::PsiValue PsiValue
helper functions for EinsplineSetBuilder
std::string getClassName() const override
return class name
void resizeScratchObjectsForIonDerivs()
Resize all temporary arrays required for force computation.
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
move was accepted, update the real container
void evaluateSpinorRatios(const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multipler, std::vector< ValueType > &ratios) override
Used by SOECPComponent for faster SOC evaluation.
void resize(int nel, int morb)
reset the size: with the number of particles and number of orbtials
Walker_t::WFBuffer_t WFBufferType
DetMatInvertor
determinant matrix inverter select
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
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 evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi) override
Compute the derivatives of the log of the wavefunction with respect to optimizable parameters...
GradType evalGradWithSpin(ParticleSet &P, int iat, ComplexType &spingrad) final
return the current spin gradient for the iat-th particle Default implementation assumes that WaveFunc...
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
LatticeGaussianProduct::GradType GradType
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
GradMatrix grad_lapl_source_psiM
ValueMatrix d2psiM
d2psiM(i,j)
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate log of a determinant for a particle set
ValueVector psiV
value of single-particle orbital for particle-by-particle update
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
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
compute the ratio of the new to old WaveFunctionComponent value and the new gradient of multiple walk...
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
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.
SPOSet::ValueMatrix ValueMatrix
DiracDeterminant(std::unique_ptr< SPOSet > &&spos, int first, int last, int ndelay=1, DetMatInvertor matrix_inverter_kind=DetMatInvertor::ACCEL)
constructor
int invRow_id
row id correspond to the up-to-date invRow.
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
GradMatrix dpsiM
dpsiM(i,j)
Specialized paritlce class for atomistic simulations.
const DetMatInvertor matrix_inverter_kind_
selected scheme for inversion
void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios) override
evaluate the ratios of one virtual move with respect to all the particles
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to a collection
void completeUpdates() override
complete all the delayed or asynchronous operations before leaving the p-by-p move region...
SPOSet::GradMatrix GradMatrix
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
void updateAfterSweep(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L)
void restore(int iat) override
move was rejected.
HessMatrix grad_phi_alpha_Minv
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios) override
compute multiple ratios for a particle move
HessMatrix grad_grad_source_psiM
SPOSet::HessVector HessVector
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wf_list) const override
return a shared resource to a collection
OrbitalSetTraits< ValueType >::ValueVector ValueVector
GradMatrix phi_alpha_Minv
SPOSet::HessMatrix HessMatrix
class to handle a set of variables that can be modified during optimizations
PsiValue ratioGrad_compute(int iat, GradType &grad_iat)
internal function computing ratio and gradients after computing the SPOs, used by ratioGrad...
QTFull::ValueType PsiValue
DU_TYPE updateEng
delayed update engine
GradMatrix grad_source_psiM
Used for force computations.
ValueMatrix psiM
inverse transpose of psiM(j,i)
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
PsiValue ratioGradWithSpin(ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad) final
evaluate the ratio of the new to old WaveFunctionComponent value and the new spin gradient Default im...
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
ValueMatrix & getPsiMinv() override
return for testing
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...
OrbitalSetTraits< ValueType >::GradVector GradVector
void registerTWFFastDerivWrapper(const ParticleSet &P, TWFFastDerivWrapper &twf) const final
Finds the SPOSet associated with this determinant, and registers it with WFN wrapper.
ValueMatrix psiMinv
temporary container for testing
ValueType * LastAddressOfdV
ValueMatrix lapl_phi_Minv
SPOSet::ValueVector ValueVector
QMCTraits::ComplexType ComplexType
DiracMatrix< QMCTraits::QTFull::ValueType > host_inverter_
slow but doesn't consume device memory
void invertPsiM(const ValueMatrix &logdetT, ValueMatrix &invMat)
invert psiM or its copies
LatticeGaussianProduct::ValueType ValueType
ValueMatrix psiM_temp
psiM(j,i)
std::complex< double > LogValue
QMCTraits::QTFull::ValueType mValueType
PsiValue ratio(ParticleSet &P, int iat) override
return the ratio only for the iat-th partcle move
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...
ValueVector invRow
the row of up-to-date inverse matrix
std::unique_ptr< DiracDeterminantBase > makeCopy(std::unique_ptr< SPOSet > &&spo) const override
cloning function
GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat) override
return the logarithmic gradient for the iat-th particle of the source particleset ...
void evaluateHessian(ParticleSet &P, HessVector &grad_grad_psi) override
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix
DiracDeterminant & operator=(const DiracDeterminant &s)=delete
ValueType * FirstAddressOfdV
SPOSet::GradVector GradVector