18 #ifndef QMCPLUSPLUS_WAVEFUNCTIONCOMPONENT_H 19 #define QMCPLUSPLUS_WAVEFUNCTIONCOMPONENT_H 39 class WaveFunctionComponent;
40 class ResourceCollection;
41 class TWFFastDerivWrapper;
83 using LogValue = std::complex<QTFull::RealType>;
175 const std::vector<bool>&
recompute)
const;
184 APP_ABORT(
"WaveFunctionComponent::evaluateHessian is not implemented in " +
getClassName() +
" class.");
208 APP_ABORT(
"WaveFunctionComponent::evalGradient is not implemented in " +
getClassName() +
" class.");
224 template<CoordsType CT>
239 std::vector<GradType>& grad_now)
const;
293 template<CoordsType CT>
297 std::vector<PsiValue>& ratios,
310 std::vector<PsiValue>& ratios,
311 std::vector<GradType>& grad_new)
const;
330 const std::vector<bool>& isAccepted,
331 bool safe_to_delay =
false)
const;
349 virtual void restore(
int iat) = 0;
369 std::vector<PsiValue>& ratios)
const;
396 bool fromscratch)
const;
498 APP_ABORT(
"Need specialization of WaveFunctionComponent::evaluateGradDerivatives in " +
getClassName() +
527 std::vector<std::vector<ValueType>>& ratios)
const;
536 std::vector<ValueType>& ratios,
550 std::vector<GradType>& grad_now,
551 std::vector<ComplexType>& spingrad_now)
const;
563 std::vector<PsiValue>& ratios,
564 std::vector<GradType>& grad_new,
565 std::vector<ComplexType>& spingrad_new)
const;
virtual void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
return a shared resource to a collection
Walker< QMCTraits, PtclOnLatticeTraits > Walker_t
walker type
const std::string & getName() const
return object name
virtual bool isOptimizable() const
if true, this contains optimizable components
Declaration of OptimizableObject.
OrbitalSetTraits< ValueType >::ValueVector ValueVector
virtual LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L)=0
evaluate the value of the WaveFunctionComponent from scratch
virtual void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios)
evaluate ratios to evaluate the non-local PP
WaveFunctionComponent::PsiValue PsiValue
static T convert(const std::complex< T1 > &logpsi)
const std::string my_name_
Name of the object It is required to be different for objects of the same derived type like multiple ...
virtual LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false)=0
For particle-by-particle move.
helper functions for EinsplineSetBuilder
QTBase::GradType GradType
virtual void mw_prepareGroup(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int ig) const
virtual void mw_recompute(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const
virtual void registerTWFFastDerivWrapper(const ParticleSet &P, TWFFastDerivWrapper &twf) const
Register the component with the TWFFastDerivWrapper wrapper.
virtual void recompute(const ParticleSet &P)
recompute the value of the WaveFunctionComponents which require critical accuracy.
virtual void evaluateHessian(ParticleSet &P, HessVector &grad_grad_psi_all)
virtual std::string getClassName() const =0
return class name
virtual GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat)
return the logarithmic gradient for the iat-th particle of the source particleset ...
virtual LogValue evaluateGL(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, bool fromscratch)
compute gradients and laplacian of the TWF with respect to each particle.
virtual bool isMultiDet() const
true, if this component is multi-determinant
Walker_t::WFBuffer_t WFBufferType
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
LatticeGaussianProduct::GradType GradType
virtual GradType evalGradWithSpin(ParticleSet &P, int iat, ComplexType &spingrad)
return the current spin gradient for the iat-th particle Default implementation assumes that WaveFunc...
QTBase::ComplexType ComplexType
virtual void checkSanity() const
Validate the internal consistency of the object.
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
virtual void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
acquire a shared resource from a collection
OrbitalSetTraits< ValueType >::HessType HessType
A proxy class to the quantum ParticleSet.
void mw_evalGrad(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const int iat, TWFGrads< CT > &grads_now) const
compute the current gradients for the iat-th particle of multiple walkers
virtual 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
evaluate gradients and laplacian of the same type WaveFunctionComponent of multiple walkers ...
opt_variables_type myVars
list of variables this WaveFunctionComponent handles
std::complex< QTFull::RealType > LogValue
virtual void mw_ratioGradWithSpin(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_new, std::vector< ComplexType > &spingrad_new) const
compute the ratio of the new to old WaveFunctionComponent value and the new gradient/spingradient of ...
PooledMemory< FullPrecRealType > WFBuffer_t
An abstract class for a component of a many-body trial wave function.
virtual void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)=0
Compute the derivatives of both the log of the wavefunction and kinetic energy with respect to optimi...
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
Specialized paritlce class for atomistic simulations.
virtual void finalizeOptimization()
virtual void checkOutVariables(const opt_variables_type &active)
check out variational optimizable variables
virtual void registerData(ParticleSet &P, WFBufferType &buf)=0
For particle-by-particle move.
virtual void mw_completeUpdates(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
complete all the delayed or asynchronous operations for all the walkers in a batch before leaving the...
class to handle a set of variables that can be modified during optimizations
virtual void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
virtual 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
compute the current gradients and spin gradients for the iat-th particle of multiple walkers ...
virtual GradType evalGrad(ParticleSet &P, int iat)
return the current gradient for the iat-th particle
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
QTFull::ValueType PsiValue
virtual void evaluateSpinorRatios(const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multiplier, std::vector< ValueType > &ratios)
Used by SOECPComponent for faster SOC evaluation.
virtual void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
Compute the derivatives of the log of the wavefunction with respect to optimizable parameters...
virtual PsiValue ratio(ParticleSet &P, int iat)=0
evaluate the ratio of the new to old WaveFunctionComponent value
virtual void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios)
evaluate ratios to evaluate the non-local PP
virtual void prepareGroup(ParticleSet &P, int ig)
Prepare internal data for updating WFC correspond to a particle group It should be called before movi...
LogValue log_value_
Current .
virtual 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
moves of the iat-th particle on some walkers in a batch is accepted.
std::vector< std::reference_wrapper< T > > RefVector
virtual void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs)
extract underlying OptimizableObject references
virtual 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
evaluate from scratch the same type WaveFunctionComponent of multiple walkers
const LogValue & get_log_value() const
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
void mw_ratioGrad(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CT > &grad_new) const
virtual GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat, TinyVector< ParticleSet::ParticleGradient, OHMMS_DIM > &grad_grad, TinyVector< ParticleSet::ParticleLaplacian, OHMMS_DIM > &lapl_grad)
Adds the gradient w.r.t.
virtual void mw_evaluateRatios(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const
evaluate ratios to evaluate the non-local PP multiple walkers
virtual void evaluateGradDerivatives(const ParticleSet::ParticleGradient &G_in, std::vector< ValueType > &dgradlogpsi)
Calculates the derivatives of with respect to the optimizable parameters, and the dot product of thi...
OrbitalSetTraits< ValueType >::HessVector HessVector
virtual PsiValue ratioGradWithSpin(ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad_iat)
evaluate the ratio of the new to old WaveFunctionComponent value and the new spin gradient Default im...
virtual PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat)
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
virtual void copyFromBuffer(ParticleSet &P, WFBufferType &buf)=0
For particle-by-particle move.
virtual void completeUpdates()
complete all the delayed or asynchronous operations before leaving the p-by-p move region...
WaveFunctionComponent(const std::string &obj_name="")
default constructor
std::complex< double > LogValue
virtual void mw_calcRatio(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios) const
compute the ratio of the new to old WaveFunctionComponent value of multiple walkers ...
trait class to handel a set of Orbitals
virtual void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios)
evaluate the ratios of one virtual move with respect to all the particles
virtual void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false)=0
a move for iat-th particle is accepted.
size_t Bytes_in_WFBuffer
Bytes in WFBuffer.
PooledData< RealType > Buffer_t
virtual RealType KECorrection()
Return the Chiesa kinetic energy correction.
virtual bool isFermionic() const
true, if this component is fermionic
virtual void restore(int iat)=0
If a move for iat-th particle is rejected, restore to the content.
virtual std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const
make clone
Declaration of a MCWalkerConfiguration.
A container class to represent a walker.
virtual ~WaveFunctionComponent()
default destructor
PsiValue getValue() const
assembles the full value
int UpdateMode
current update mode