21 #ifndef QMCPLUSPLUS_BSPLINESET_H 22 #define QMCPLUSPLUS_BSPLINESET_H 25 #include "spline/einspline_engine.hpp" 26 #include "spline/einspline_util.hpp" 71 for (
int i = 0; i <
n; i++)
78 std::vector<SPOSet::PosType> k_copy(
kPoints);
82 for (
int i = 0; i < nk; ++i)
91 for (
int i = 0; i < nk; ++i)
95 kPoints[nRealBands] = k_copy[i];
117 std::unique_ptr<SPOSet>
makeClone()
const override = 0;
130 for (
int iat = first, i = 0; iat < last; ++iat, ++i)
151 const size_t nw = spo_list.size();
152 std::vector<ValueVector> mw_psi_v;
153 std::vector<GradVector> mw_dpsi_v;
154 std::vector<ValueVector> mw_d2psi_v;
158 mw_psi_v.reserve(nw);
159 mw_dpsi_v.reserve(nw);
160 mw_d2psi_v.reserve(nw);
161 psi_v_list.reserve(nw);
162 dpsi_v_list.reserve(nw);
163 d2psi_v_list.reserve(nw);
165 for (
int iat = first, i = 0; iat < last; ++iat, ++i)
172 d2psi_v_list.clear();
174 for (
int iw = 0; iw < nw; iw++)
176 mw_psi_v.emplace_back(logdet_list[iw].
get()[i], logdet_list[iw].
get().cols());
177 mw_dpsi_v.emplace_back(dlogdet_list[iw].
get()[i], dlogdet_list[iw].
get().cols());
178 mw_d2psi_v.emplace_back(d2logdet_list[iw].
get()[i], d2logdet_list[iw].
get().cols());
179 psi_v_list.push_back(mw_psi_v.back());
180 dpsi_v_list.push_back(mw_dpsi_v.back());
181 d2psi_v_list.push_back(mw_d2psi_v.back());
184 mw_evaluateVGL(spo_list, P_list, iat, psi_v_list, dpsi_v_list, d2psi_v_list);
195 for (
int iat = first, i = 0; iat < last; ++iat, ++i)
199 HessVector h(grad_grad_logdet[i], grad_grad_logdet.cols());
210 GGGMatrix& grad_grad_grad_logdet)
override 212 for (
int iat = first, i = 0; iat < last; ++iat, ++i)
216 HessVector h(grad_grad_logdet[i], grad_grad_logdet.cols());
217 GGGVector gh(grad_grad_grad_logdet[i], grad_grad_grad_logdet.cols());
244 template<
class BSPLINESPO>
base class for Single-particle orbital sets
OrbitalSetTraits< ValueType >::HessVector HessVector
std::unique_ptr< SPOSet > makeClone() const override=0
make a clone of itself every derived class must implement this to have threading working correctly...
std::vector< T, aligned_allocator< T > > aligned_vector
helper functions for EinsplineSetBuilder
aligned_vector< int > BandIndexMap
remap splines to orbitals
BsplineSet is the base class for SplineC2C, SplineC2R, SplineR2R.
size_t MyIndex
Index of this adoptor, when multiple adoptors are used for NUMA or distributed cases.
virtual void evaluateVGH(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, HessVector &grad_grad_psi)
evaluate the values, gradients and hessians of this single-particle orbital set
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
BsplineSet(const std::string &my_name)
void evaluateGradSource(const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &grad_phi, HessMatrix &grad_grad_phi, GradMatrix &grad_lapl_phi) override
evaluate the gradients of values, gradients, laplacians of this single-particle orbital for [first...
virtual bool isComplex() const =0
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
virtual void evaluateValue(const ParticleSet &P, int iat, ValueVector &psi)=0
evaluate the values of this single-particle orbital set
Each SplineC2X needs a reader derived from BsplineReader.
Specialized paritlce class for atomistic simulations.
General SplineSetReader to handle any unitcell.
std::vector< int > offset
band offsets used for communication
virtual void mw_evaluateVGL(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list, const RefVector< GradVector > &dpsi_v_list, const RefVector< ValueVector > &d2psi_v_list) const
evaluate the values, gradients and laplacians of this single-particle orbital sets of multiple walker...
virtual void mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const std::vector< const ValueType *> &invRow_ptr_list, OffloadMWVGLArray &phi_vgl_v, std::vector< ValueType > &ratios, std::vector< GradType > &grads) const
evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ra...
OrbitalSetTraits< ValueType >::ValueVector ValueVector
virtual void evaluateVGL(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)=0
evaluate the values, gradients and laplacians of this single-particle orbital set ...
virtual void finalizeConstruction()
finalize the construction of SPOSet
void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, HessMatrix &grad_grad_logdet) override
evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles
virtual void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
acquire a shared resource from collection
IndexType OrbitalSetSize
number of Single-particle orbitals
void evaluateGradSource(const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &gradphi) override
evaluate the gradients of this single-particle orbital for [first,last) target particles with respect...
virtual void evaluateDetRatios(const VirtualParticleSet &VP, ValueVector &psi, const ValueVector &psiinv, std::vector< ValueType > &ratios)
evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP
virtual void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
return a shared resource to collection
std::vector< std::reference_wrapper< T > > RefVector
void setOrbitalSetSize(int norbs) override
set the OrbitalSetSize
void mw_evaluate_notranspose(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int first, int last, const RefVector< ValueMatrix > &logdet_list, const RefVector< GradMatrix > &dlogdet_list, const RefVector< ValueMatrix > &d2logdet_list) const override
OrbitalSetTraits< ValueType >::GradHessVector GGGVector
OrbitalSetTraits< ValueType >::GradVector GradVector
virtual void mw_evaluateDetRatios(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, const RefVector< ValueVector > &psi_list, const std::vector< const ValueType *> &invRow_ptr_list, std::vector< std::vector< ValueType >> &ratios_list) const
evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP, of multiple walkers ...
void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet) override
evaluate the values, gradients and laplacians of this single-particle orbital for [first...
void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, HessMatrix &grad_grad_logdet, GGGMatrix &grad_grad_grad_logdet) override
evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [f...
std::vector< bool > MakeTwoCopies
flags to unpack sin/cos
TinyVector< int, D > HalfG
sign bits at the G/2 boundaries
OrbitalSetTraits< ValueType >::GradHessMatrix GGGMatrix
size_t first_spo
first index of the SPOs this Spline handles
virtual void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to collection
int remap_kpoints()
remap kpoints to group general kpoints & special kpoints
QMCTraits::FullPrecRealType value_type
std::vector< SPOSet::PosType > kPoints
kpoints for each unique orbitals.
virtual void evaluateVGHGH(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, HessVector &grad_grad_psi, GGGVector &grad_grad_grad_psi)
evaluate the values, gradients, hessians, and grad hessians of this single-particle orbital set ...
size_t last_spo
last index of the SPOs this Spline handles
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix
virtual std::string getKeyword() const =0