14 #ifndef QMCPLUSPLUS_TWOBODYJASTROW_OMPTARGET_H 15 #define QMCPLUSPLUS_TWOBODYJASTROW_OMPTARGET_H 20 #if !defined(QMC_BUILD_SANDBOX_ONLY) 38 struct TwoBodyJastrowMultiWalkerMem;
109 std::map<std::string, std::unique_ptr<FT>>
J2Unique;
145 bool triangle =
false);
158 void addFunc(
int ia,
int ib, std::unique_ptr<FT> j);
195 const std::vector<bool>&
recompute)
const override;
201 std::vector<PsiValue>& ratios)
const override;
208 std::vector<std::vector<ValueType>>& ratios)
const override;
216 std::vector<PsiValue>& ratios,
217 std::vector<GradType>& grad_new)
const override;
223 const std::vector<bool>& isAccepted,
224 bool safe_to_delay =
false)
const override;
233 bool fromscratch =
false)
override;
238 bool fromscratch)
const override;
266 std::vector<ValueType>& ratios,
270 extern template class TwoBodyJastrow<BsplineFunctor<QMCTraits::RealType>>;
271 extern template class TwoBodyJastrow<PadeFunctor<QMCTraits::RealType>>;
272 extern template class TwoBodyJastrow<UserFunctor<QMCTraits::RealType>>;
273 extern template class TwoBodyJastrow<FakeFunctor<QMCTraits::RealType>>;
void resize(size_type n, Type_t val=Type_t())
Resize the container.
void checkSanity() const override
Validate the internal consistency of the object.
RealType ChiesaKEcorrection()
std::vector< T, aligned_allocator< T > > aligned_vector
WaveFunctionComponent::PsiValue PsiValue
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
helper functions for EinsplineSetBuilder
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
FakeFunctor for testing purpose.
void finalizeOptimization() override
void addFunc(int ia, int ib, std::unique_ptr< FT > j)
add functor for (ia,ib) pair
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...
const std::vector< FT * > & getPairFunctions() const
std::vector< std::pair< int, int > > OffSet
Map indices from subcomponent variables to component variables.
GradType evalGrad(ParticleSet &P, int iat) override
return the current gradient for the iat-th particle
VectorSoaContainer< RealType, DIM > DisplRow
LatticeGaussianProduct::GradType GradType
Vector< valT, aligned_allocator< valT > > d2Uat
SoA adaptor class for Vector<TinyVector<T,D> >
void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs) override
extract underlying OptimizableObject references
DistanceTable::DisplRow DisplRow
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const override
make clone
Attaches a unit to a Vector for IO.
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
const bool use_offload_
if true use offload
void resizeInternalStorage()
initialize storage Uat,dUat, d2Uat
aligned_vector< valT > DistCompressed
std::map< std::string, std::unique_ptr< FT > > J2Unique
Uniquue J2 set for cleanup.
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
return a shared resource to a collection
aligned_vector< valT > cur_u
std::vector< ValueDerivVec > lapLogPsi
opt_variables_type myVars
list of variables this WaveFunctionComponent handles
std::vector< FT * > F
Container for . treat every pointer as a reference.
void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &active, Vector< ValueType > &dlogpsi) override
QTFull::RealType computeGL(ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) const
compute G and L from internally stored data
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.
const size_t ndim
number of spatial dimensions
posT accumulateG(const valT *restrict du, const DisplRow &displ) const
compute gradient
Specialized paritlce class for atomistic simulations.
opt_variables_type & getComponentVars()
TwoBodyJastrow(const std::string &obj_name, ParticleSet &p, bool use_offload)
ParticleAttrib< QTFull::GradType > GradDerivVec
void recompute(const ParticleSet &P) override
recompute internal data assuming distance table is fully ready
RealType KECorrection() override
Return the Chiesa kinetic energy correction.
void mw_evaluateRatios(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const override
aligned_vector< valT > cur_du
aligned_vector< valT > old_du
aligned_vector< valT > cur_d2u
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
DistanceTable::DistRow DistRow
use the same container
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to a collection
ResourceHandle< TwoBodyJastrowMultiWalkerMem< RealType > > mw_mem_handle_
valT computeU(const ParticleSet &P, int iat, const DistRow &dist)
class to handle a set of variables that can be modified during optimizations
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 ...
Functors which implement Pade functions.
const int my_table_ID_
e-e table ID
const size_t N_padded
number of particles + padded
bool isOptimizable() const override
if true, this contains optimizable components
typename FT::real_type valT
type of each component U, dU, d2U;
PsiValue ratio(ParticleSet &P, int iat) override
evaluate the ratio of the new to old WaveFunctionComponent value
void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios) override
~TwoBodyJastrow() override
size_type size() const
return the size
Specialization for two-body Jastrow function using multiple functors.
aligned_vector< int > DistIndice
void resizeWFOptVectors()
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
void evaluateHessian(ParticleSet &P, HessVector &grad_grad_psi) override
void computeU3(const ParticleSet &P, int iat, const DistRow &dist, RealType *restrict u, RealType *restrict du, RealType *restrict d2u, bool triangle=false)
intenal function to compute
const valT lapfac
laplacian prefactor
std::vector< std::reference_wrapper< T > > RefVector
OHMMS_PRECISION real_type
Vector< int, OffloadPinnedAllocator< int > > grp_ids
the group_id of each particle
Vector< RealType, aligned_allocator< RealType > > DistRow
aligned_vector< valT > old_u
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
acquire a shared resource from a collection
const size_t NumGroups
number of groups of the target particleset
VectorSoaContainer< valT, DIM, aligned_allocator< valT > > dUat
LogValue evaluateGL(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, bool fromscratch=false) override
compute G and L after the sweep
void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios) override
Vector< RealType > dLogPsi
J2KECorrection< RealType, FT > j2_ke_corr_helper
std::pair< int, int > getComponentOffset(int index)
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &active, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi) override
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios) override
OrbitalSetTraits< ValueType >::HessVector HessVector
void checkOutVariables(const opt_variables_type &active) override
check out optimizable variables
std::vector< GradDerivVec > gradLogPsi
void mw_recompute(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const override
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
RealType DiffVal
diff value
TinyVector< valT, DIM > posT
element position type
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.
RealType KEcorr
Correction.
FT FuncType
alias FuncType
ParticleAttrib< QTFull::ValueType > ValueDerivVec
const size_t N
number of particles
void mw_calcRatio(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios) const override
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
aligned_vector< valT > old_d2u
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false) override
a move for iat-th particle is accepted.
std::string getClassName() const override
return class name
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
Vector< valT, aligned_allocator< valT > > Uat