22 #ifndef QMCPLUSPLUS_TRIALWAVEFUNCTION_H 23 #define QMCPLUSPLUS_TRIALWAVEFUNCTION_H 41 class MultiSlaterDetTableMethod;
105 inline int size()
const {
return Z.size(); }
109 void getLogs(std::vector<RealType>& lvals);
110 void getPhases(std::vector<RealType>& pvals);
120 void addComponent(std::unique_ptr<WaveFunctionComponent>&& aterm);
123 bool put(xmlNodePtr cur);
247 std::vector<RealType>& logpsi_fixed_list,
248 std::vector<RealType>& logpsi_opt_list,
277 std::vector<RealType>& logpsi_list,
296 std::vector<PsiValue>& ratios,
312 const RefVector<std::vector<ValueType>>& ratios_list,
318 std::vector<ValueType>& ratios,
359 template<CoordsType CT>
363 std::vector<PsiValue>& ratios,
399 template<CoordsType CT>
412 const std::vector<bool>& isAccepted,
413 bool safe_to_delay =
false);
477 std::vector<std::unique_ptr<WaveFunctionComponent>>
const&
getOrbitals() {
return Z; }
556 std::vector<std::unique_ptr<WaveFunctionComponent>>
Z;
const std::vector< RealType > & twist() const
base class for Single-particle orbital sets
size_t BufferCursor_scalar
starting index of the scalar buffer
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
WaveFunctionComponent::PsiValue PsiValue
WaveFunctionComponent::RealType RealType
TrialWaveFunction & operator=(const TrialWaveFunction &)=delete
void rejectMove(int iat)
restore to the original state
void evaluateSpinorRatios(const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multiplier, std::vector< ValueType > &ratios) const
Used by SOECPComponent to do faster SOC evaluation.
ValueType calcRatio(ParticleSet &P, int iat, ComputeType ct=ComputeType::ALL)
compute psi(R_new) / psi(R_current) ratio It returns a complex value if the wavefunction is complex...
void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios)
OrbitalSetTraits< ValueType >::ValueVector ValueVector
void copyFromBuffer(ParticleSet &P, WFBufferType &buf)
copy all the wavefunction components from buffer.
helper functions for EinsplineSetBuilder
QTBase::GradType GradType
void getLogs(std::vector< RealType > &lvals)
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate derivatives of KE wrt optimizable varibles
QTBase::RealType RealType
RealType getPhaseDiff() const
if(!okay) throw std xmlNodePtr node
xmlNodePtr getNode() const
~TrialWaveFunction()
Destructor.
Walker_t::Buffer_t BufferType
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false)
update the state with the new data
void evaluateHessian(ParticleSet &P, HessVector &all_grad_grad_psi)
evaluate the hessian w.r.t.
void setMassTerm(ParticleSet &P)
static void mw_prepareGroup(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int ig)
batched version of prepareGroup
void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
Walker_t::WFBuffer_t WFBufferType
static void mw_calcRatioGrad(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CT > &grads)
batched version of ratioGrad
void resetParameters(const opt_variables_type &active)
Set values of parameters in each component from the global list.
RealType PhaseDiff
diff of the phase of the trial wave function during ratio calls
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
RealType getReciprocalMass()
WaveFunctionComponent::LogValue LogValue
const bool use_tasking_
if true, using internal tasking implementation
const SPOSet & getSPOSet(const std::string &name) const
look up SPOSet named 'name', if not found, throw exception.
TrialWaveFunction(const RuntimeOptions &runtime_options, const std::string_view aname="psi0", bool tasking=false)
ParticleAttrib< QTFull::ValueType > ParticleLaplacian
LatticeGaussianProduct::GradType GradType
void printGL(ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, std::string tag="GL")
ParticleSet::ParticleLaplacian L
differential laplacians
QTBase::ComplexType ComplexType
const std::string & getName() const
std::vector< std::unique_ptr< T > > UPtrVector
declaration of MPIObjectBase
WaveFunctionComponent::ValueType ValueType
Attaches a unit to a Vector for IO.
static RefVectorWithLeader< WaveFunctionComponent > extractWFCRefList(const RefVectorWithLeader< TrialWaveFunction > &wf_list, int id)
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
static RefVector< ParticleSet::ParticleGradient > extractGRefList(const RefVectorWithLeader< TrialWaveFunction > &wf_list)
}@
static void mw_accept_rejectMove(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool safe_to_delay=false)
RealType updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false)
update all the wavefunction components in buffer.
OrbitalSetTraits< ValueType >::HessType HessType
A proxy class to the quantum ParticleSet.
std::unique_ptr< TrialWaveFunction > makeClone(ParticleSet &tqp) const
RefVector< MultiSlaterDetTableMethod > findMSD() const
find MSD WFCs if exist
WaveFunctionComponent::HessType HessType
void recompute(const ParticleSet &P)
recompute the value of the orbitals which require critical accuracy
void setLogPsi(RealType LogPsi_new)
std::complex< QTFull::RealType > LogValue
TWFFastDerivWrapper twf_prototype
For now, TrialWaveFunction will own the wrapper.
void evaluateDeltaLogSetup(ParticleSet &P, RealType &logpsi_fixed, RealType &logpsi_opt, ParticleSet::ParticleGradient &fixedG, ParticleSet::ParticleLaplacian &fixedL)
evaluate the sum of log value of optimizable many-body wavefunctions
UniqueOptObjRefs extractOptimizableObjectRefs()
extract underlying OptimizableObject references
ParticleSet::ParticleGradient G
differential gradients
RealType PhaseValue
sign of the trial wave function
static void mw_evaluateGL(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, bool fromscratch)
WaveFunctionComponent::ComplexType ComplexType
LogValue evaluateGL(ParticleSet &P, bool fromscratch)
compute gradients and laplacian of the TWF with respect to each particle.
Specialized paritlce class for atomistic simulations.
std::vector< std::unique_ptr< WaveFunctionComponent > > Z
a list of WaveFunctionComponents constituting many-body wave functions
WaveFunctionComponent::WFBufferType WFBufferType
void setTwist(const std::vector< RealType > &t)
GradType evalGradWithSpin(ParticleSet &P, int iat, ComplexType &spingrad)
compute d/ds ln(psi) spin gradient at current particle position for iat electron
QTBase::ValueType ValueType
void storeSPOMap(SPOMap &&spomap)
store an SPOSet map
void evaluateGradDerivatives(const ParticleSet::ParticleGradient &G_in, std::vector< ValueType > &dgradlogpsi)
WaveFunctionComponent::FullPrecRealType FullPrecRealType
static void mw_evaluateParameterDerivatives(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi)
static void mw_calcRatio(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, ComputeType ct=ComputeType::ALL)
batched version of calcRatio
const std::shared_ptr< SPOMap > spomap_
Owned SPOSets. Once a TWF is fully built, SPOSet lookup should be done via TWF.
RealType log_real_
real part of trial wave function log
class to handle a set of variables that can be modified during optimizations
GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat)
Returns the logarithmic gradient of the trial wave function with respect to the iat^th atom of the so...
static void mw_evaluateDeltaLog(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, std::vector< RealType > &logpsi_list, RefVector< ParticleSet::ParticleGradient > &dummyG_list, RefVector< ParticleSet::ParticleLaplacian > &dummyL_list, bool recompute=false)
evaluate the log value for optimizable parts of a many-body wave function
void registerData(ParticleSet &P, WFBufferType &buf)
register all the wavefunction components in buffer.
std::vector< std::unique_ptr< WaveFunctionComponent > > const & getOrbitals()
RealType getLogPsi() const
const SPOMap & getSPOMap() const
spomap_ reference accessor
ComputeType
enum type for computing partial WaveFunctionComponents
xmlNodePtr myNode_
XML input node for a many-body wavefunction.
QTFull::ValueType PsiValue
void checkOutVariables(const opt_variables_type &o)
Check out optimizable variables Assign index mappings from global list (o) to local values in each co...
static void mw_evalGrad(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CT > &grads)
batched version of evalGrad
static void mw_evaluateDeltaLogSetup(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, std::vector< RealType > &logpsi_fixed_list, std::vector< RealType > &logpsi_opt_list, RefVector< ParticleSet::ParticleGradient > &fixedG_list, RefVector< ParticleSet::ParticleLaplacian > &fixedL_list)
evaluate the sum of log value of optimizable many-body wavefunctions
static void debugOnlyCheckBuffer(WFBufferType &buffer)
static void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< TrialWaveFunction > &wf_list)
acquire external resource Note: use RAII ResourceCollectionLock whenever possible ...
static std::vector< WaveFunctionComponent * > extractWFCPtrList(const UPtrVector< TrialWaveFunction > &wf_list, int id)
helper function for extracting a list of WaveFunctionComponent from a list of TrialWaveFunction ...
WaveFunctionComponent::ValueVector ValueVector
void getPhases(std::vector< RealType > &pvals)
std::vector< RealType > myTwist
static void mw_completeUpdates(const RefVectorWithLeader< TrialWaveFunction > &wf_list)
WaveFunctionComponent::HessVector HessVector
TimerList_t TWF_timers_
timers at TrialWaveFunction function call level
RealType getPhase() const
std::vector< std::reference_wrapper< T > > RefVector
static void mw_recompute(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute)
batched version of recompute
void reportStatus(std::ostream &os)
print out state of the trial wavefunction
RealType evaluateDeltaLog(ParticleSet &P, bool recompute=false)
evaluate the log value of a many-body wave function
Class to represent a many-body trial wave function.
static RefVector< ParticleSet::ParticleLaplacian > extractLRefList(const RefVectorWithLeader< TrialWaveFunction > &wf_list)
ParticleScalar Mass
mass of each particle
GradType evalGrad(ParticleSet &P, int iat)
std::map< std::string, const std::unique_ptr< const SPOSet > > SPOMap
RealType OneOverM
One over mass of target particleset, needed for Local Energy Derivatives.
bool put(xmlNodePtr cur)
read from xmlNode
RealType KECorrection() const
void storeXMLNode(xmlNodePtr node)
QMCTraits::ComplexType ComplexType
OrbitalSetTraits< ValueType >::HessVector HessVector
LatticeGaussianProduct::ValueType ValueType
ParticleAttrib< QTFull::GradType > ParticleGradient
ValueType calcRatioGradWithSpin(ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad_iat)
compute psi(R_new) / psi(R_current) ratio and d/ds ln(psi(R_new)) spin gradient It returns a complex ...
const RuntimeOptions & runtime_options_
top-level runtime options from project data information > WaveFunctionPool
void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratio)
compute both ratios and deriatives of ratio with respect to the optimizables
QTFull::RealType FullPrecRealType
size_t BufferCursor
starting index of the buffer
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
static void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< TrialWaveFunction > &wf_list)
release external resource Note: use RAII ResourceCollectionLock whenever possible ...
void prepareGroup(ParticleSet &P, int ig)
Prepare internal data for updating WFC correspond to a particle group Particle groups usually corresp...
const std::string myName
getName is in the way
std::vector< std::reference_wrapper< NewTimer > > WFC_timers_
timers at WaveFunctionComponent function call level
void setTwist(std::vector< RealType > &&t)
void setPhase(RealType PhaseValue_new)
ValueType calcRatioGrad(ParticleSet &P, int iat, GradType &grad_iat)
compute psi(R_new) / psi(R_current) ratio and ln(psi(R_new)) gradients It returns a complex value if...
static void mw_evaluateRatios(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< const VirtualParticleSet > &Vp_list, const RefVector< std::vector< ValueType >> &ratios_list, ComputeType ct=ComputeType::ALL)
batched version of evaluateRatios Note: unlike other mw_ static functions, *this is the batch leader ...
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios, ComputeType ct=ComputeType::ALL)
compulte multiple ratios to handle non-local moves and other virtual moves
void completeUpdates()
complete all the delayed or asynchronous operations before leaving the p-by-p move region...
void addComponent(std::unique_ptr< WaveFunctionComponent > &&aterm)
add a WaveFunctionComponent
static void mw_evaluateLog(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
batched version of evaluateLog.
void checkInVariables(opt_variables_type &o)
Check in an optimizable parameter.
void initializeTWFFastDerivWrapper(const ParticleSet &P, TWFFastDerivWrapper &twf) const
Initialize a TWF wrapper for fast derivative evaluation.