QMCPACK
BsplineSet Class Referenceabstract

BsplineSet is the base class for SplineC2C, SplineC2R, SplineR2R. More...

+ Inheritance diagram for BsplineSet:
+ Collaboration diagram for BsplineSet:

Public Member Functions

 BsplineSet (const std::string &my_name)
 
virtual bool isComplex () const =0
 
virtual std::string getKeyword () const =0
 
auto & getHalfG () const
 
void init_base (int n)
 
int remap_kpoints ()
 remap kpoints to group general kpoints & special kpoints More...
 
std::unique_ptr< SPOSetmakeClone () const override=0
 make a clone of itself every derived class must implement this to have threading working correctly. More...
 
void setOrbitalSetSize (int norbs) override
 set the OrbitalSetSize More...
 
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,last) particles More...
 
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
 
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 More...
 
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 [first,last) particles More...
 
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 to the given source particle More...
 
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,last) target particles with respect to the given source particle More...
 
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 More...
 
virtual void evaluateValue (const ParticleSet &P, int iat, ValueVector &psi)=0
 evaluate the values of this single-particle orbital set More...
 
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 More...
 
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 More...
 
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 More...
 
virtual void finalizeConstruction ()
 finalize the construction of SPOSet More...
 
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 More...
 
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 walkers More...
 
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 ratio and grads of multiple walkers. More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 acquire a shared resource from collection More...
 
virtual void createResource (ResourceCollection &collection) const
 initialize a shared resource and hand it to collection More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 return a shared resource to collection More...
 
- Public Member Functions inherited from SPOSet
 SPOSet (const std::string &my_name)
 constructor More...
 
virtual ~SPOSet ()=default
 destructor More...
 
int size () const
 return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); More...
 
void basic_report (const std::string &pad="") const
 print basic SPOSet information More...
 
virtual void report (const std::string &pad="") const
 print SPOSet information More...
 
int getOrbitalSetSize () const
 return the size of the orbitals More...
 
virtual bool isOptimizable () const
 Query if this SPOSet is optimizable. More...
 
virtual void extractOptimizableObjectRefs (UniqueOptObjRefs &opt_obj_refs)
 extract underlying OptimizableObject references More...
 
virtual void checkOutVariables (const opt_variables_type &active)
 check out variational optimizable variables More...
 
virtual bool isOMPoffload () const
 Query if this SPOSet uses OpenMP offload. More...
 
virtual bool hasIonDerivs () const
 Query if this SPOSet has an explicit ion dependence. More...
 
virtual void checkObject () const
 check a few key parameters before putting the SPO into a determinant More...
 
virtual bool isRotationSupported () const
 return true if this SPOSet can be wrappered by RotatedSPO More...
 
virtual void storeParamsBeforeRotation ()
 store parameters before getting destroyed by rotation. More...
 
virtual void applyRotation (const ValueMatrix &rot_mat, bool use_stored_copy=false)
 apply rotation to all the orbitals More...
 
virtual void evaluateDerivatives (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi, const int &FirstIndex, const int &LastIndex)
 Parameter derivatives of the wavefunction and the Laplacian of the wavefunction. More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, int FirstIndex, int LastIndex)
 Parameter derivatives of the wavefunction. More...
 
virtual void evaluateDerivatives (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi, const ValueType &psiCurrent, const std::vector< ValueType > &Coeff, const std::vector< size_t > &C2node_up, const std::vector< size_t > &C2node_dn, const ValueVector &detValues_up, const ValueVector &detValues_dn, const GradMatrix &grads_up, const GradMatrix &grads_dn, const ValueMatrix &lapls_up, const ValueMatrix &lapls_dn, const ValueMatrix &M_up, const ValueMatrix &M_dn, const ValueMatrix &Minv_up, const ValueMatrix &Minv_dn, const GradMatrix &B_grad, const ValueMatrix &B_lapl, const std::vector< int > &detData_up, const size_t N1, const size_t N2, const size_t NP1, const size_t NP2, const std::vector< std::vector< int >> &lookup_tbl)
 Evaluate the derivative of the optimized orbitals with respect to the parameters this is used only for MSD, to be refined for better serving both single and multi SD. More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, const QTFull::ValueType &psiCurrent, const std::vector< ValueType > &Coeff, const std::vector< size_t > &C2node_up, const std::vector< size_t > &C2node_dn, const ValueVector &detValues_up, const ValueVector &detValues_dn, const ValueMatrix &M_up, const ValueMatrix &M_dn, const ValueMatrix &Minv_up, const ValueMatrix &Minv_dn, const std::vector< int > &detData_up, const std::vector< std::vector< int >> &lookup_tbl)
 Evaluate the derivative of the optimized orbitals with respect to the parameters this is used only for MSD, to be refined for better serving both single and multi SD. More...
 
virtual void evaluateValue (const ParticleSet &P, int iat, ValueVector &psi)=0
 evaluate the values of this single-particle orbital set More...
 
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 More...
 
virtual void evaluateDetSpinorRatios (const VirtualParticleSet &VP, ValueVector &psi, const std::pair< ValueVector, ValueVector > &spinor_multiplier, const ValueVector &invrow, std::vector< ValueType > &ratios)
 evaluate determinant ratios for virtual moves, specifically for Spinor SPOSets More...
 
virtual void evaluateDerivRatios (const VirtualParticleSet &VP, const opt_variables_type &optvars, ValueVector &psi, const ValueVector &psiinv, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios, int FirstIndex, int LastIndex)
 Determinant ratios and parameter derivatives of the wavefunction for virtual moves. More...
 
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 More...
 
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 More...
 
virtual void evaluateVGL_spin (const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi, ValueVector &dspin)
 evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital set More...
 
virtual void mw_evaluateValue (const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list) const
 evaluate the values this single-particle orbital sets of multiple walkers More...
 
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 walkers More...
 
virtual void mw_evaluateVGLWithSpin (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, OffloadMatrix< ComplexType > &mw_dspin) const
 evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital sets of multiple walkers More...
 
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 ratio and grads of multiple walkers. More...
 
virtual void mw_evaluateVGLandDetRatioGradsWithSpin (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, std::vector< ValueType > &spingrads) const
 evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ratio and grads of multiple walkers. More...
 
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 More...
 
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 More...
 
virtual void evaluate_spin (const ParticleSet &P, int iat, ValueVector &psi, ValueVector &dpsi)
 evaluate the values of this single-particle orbital set More...
 
virtual void evaluateThirdDeriv (const ParticleSet &P, int first, int last, GGGMatrix &grad_grad_grad_logdet)
 evaluate the third derivatives of this single-particle orbital set More...
 
virtual void evaluate_notranspose_spin (const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet, ValueMatrix &dspinlogdet)
 evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles, including the spin gradient More...
 
virtual void evaluateGradSourceRow (const ParticleSet &P, int iel, const ParticleSet &source, int iat_src, GradVector &gradphi)
 Returns a row of d/dR_iat phi_j(r) evaluated at position r. More...
 
virtual PosType get_k (int orb)
 access the k point related to the given orbital More...
 
virtual void createResource (ResourceCollection &collection) const
 initialize a shared resource and hand it to collection More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 acquire a shared resource from collection More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 return a shared resource to collection More...
 
virtual bool transformSPOSet ()
 Used only by cusp correction in AOS LCAO. More...
 
virtual void finalizeConstruction ()
 finalize the construction of SPOSet More...
 
const std::string & getName () const
 return object name More...
 
virtual std::string getClassName () const =0
 return class name More...
 

Protected Attributes

size_t MyIndex
 Index of this adoptor, when multiple adoptors are used for NUMA or distributed cases. More...
 
size_t first_spo
 first index of the SPOs this Spline handles More...
 
size_t last_spo
 last index of the SPOs this Spline handles More...
 
TinyVector< int, DHalfG
 sign bits at the G/2 boundaries More...
 
std::vector< bool > MakeTwoCopies
 flags to unpack sin/cos More...
 
std::vector< SPOSet::PosTypekPoints
 kpoints for each unique orbitals. More...
 
aligned_vector< int > BandIndexMap
 remap splines to orbitals More...
 
std::vector< int > offset
 band offsets used for communication More...
 
- Protected Attributes inherited from SPOSet
const std::string my_name_
 name of the object, unique identifier More...
 
IndexType OrbitalSetSize
 number of Single-particle orbitals More...
 
opt_variables_type myVars
 Optimizable variables. More...
 

Static Protected Attributes

static const int D = DIM
 

Friends

template<class BSPLINESPO >
class SplineSetReader
 
struct BsplineReader
 

Additional Inherited Members

- Public Types inherited from SPOSet
using ValueVector = OrbitalSetTraits< ValueType >::ValueVector
 
using ValueMatrix = OrbitalSetTraits< ValueType >::ValueMatrix
 
using GradVector = OrbitalSetTraits< ValueType >::GradVector
 
using GradMatrix = OrbitalSetTraits< ValueType >::GradMatrix
 
using HessVector = OrbitalSetTraits< ValueType >::HessVector
 
using HessMatrix = OrbitalSetTraits< ValueType >::HessMatrix
 
using GGGVector = OrbitalSetTraits< ValueType >::GradHessVector
 
using GGGMatrix = OrbitalSetTraits< ValueType >::GradHessMatrix
 
using SPOMap = std::map< std::string, const std::unique_ptr< const SPOSet > >
 
using OffloadMWVGLArray = Array< ValueType, 3, OffloadPinnedAllocator< ValueType > >
 
using OffloadMWVArray = Array< ValueType, 2, OffloadPinnedAllocator< ValueType > >
 
template<typename DT >
using OffloadMatrix = Matrix< DT, OffloadPinnedAllocator< DT > >
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 

Detailed Description

BsplineSet is the base class for SplineC2C, SplineC2R, SplineR2R.

Its derived template classes manage the storage and evaluation at given precision. BsplineSet also implements a few fallback routines in case optimized implementation is not necessary in the derived class.

Definition at line 34 of file BsplineSet.h.

Constructor & Destructor Documentation

◆ BsplineSet()

BsplineSet ( const std::string &  my_name)
inline

Definition at line 59 of file BsplineSet.h.

59 : SPOSet(my_name), MyIndex(0), first_spo(0), last_spo(0) {}
size_t last_spo
last index of the SPOs this Spline handles
Definition: BsplineSet.h:43
size_t MyIndex
Index of this adoptor, when multiple adoptors are used for NUMA or distributed cases.
Definition: BsplineSet.h:39
size_t first_spo
first index of the SPOs this Spline handles
Definition: BsplineSet.h:41
SPOSet(const std::string &my_name)
constructor
Definition: SPOSet.cpp:29

Member Function Documentation

◆ acquireResource()

virtual void acquireResource
inline

acquire a shared resource from collection

Definition at line 532 of file SPOSet.h.

532 {}

◆ createResource()

virtual void createResource
inline

initialize a shared resource and hand it to collection

Definition at line 528 of file SPOSet.h.

528 {}

◆ evaluate_notranspose() [1/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
ValueMatrix d2logdet 
)
inlineoverridevirtual

evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles

Parameters
[in]Pcurrent ParticleSet
[in]firststarting index of the particles
[in]lastending index of the particles
[out]logdetdeterminant matrix to be inverted
[out]dlogdetgradients
[out]d2logdetlaplacians

Implements SPOSet.

Reimplemented in SplineC2ROMPTarget< ST >, and SplineC2COMPTarget< ST >.

Definition at line 121 of file BsplineSet.h.

References SPOSet::evaluateVGL().

Referenced by HybridRepCplx< SPLINEBASE >::evaluate_notranspose(), and HybridRepReal< SPLINEBASE >::evaluate_notranspose().

127  {
129  using grad_type = GradMatrix::value_type;
130  for (int iat = first, i = 0; iat < last; ++iat, ++i)
131  {
132  ValueVector v(logdet[i], logdet.cols());
133  GradVector g(dlogdet[i], dlogdet.cols());
134  ValueVector l(d2logdet[i], d2logdet.cols());
135  evaluateVGL(P, iat, v, g, l);
136  }
137  }
QMCTraits::FullPrecRealType value_type
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 ...
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49

◆ evaluate_notranspose() [2/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
HessMatrix grad_grad_logdet 
)
inlineoverridevirtual

evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
logdetdeterminant matrix to be inverted
dlogdetgradients
grad_grad_logdethessians

Reimplemented from SPOSet.

Definition at line 188 of file BsplineSet.h.

References SPOSet::evaluateVGH().

194  {
195  for (int iat = first, i = 0; iat < last; ++iat, ++i)
196  {
197  ValueVector v(logdet[i], logdet.cols());
198  GradVector g(dlogdet[i], dlogdet.cols());
199  HessVector h(grad_grad_logdet[i], grad_grad_logdet.cols());
200  evaluateVGH(P, iat, v, g, h);
201  }
202  }
OrbitalSetTraits< ValueType >::HessVector HessVector
Definition: SPOSet.h:53
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
Definition: SPOSet.cpp:238
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49

◆ evaluate_notranspose() [3/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
HessMatrix grad_grad_logdet,
GGGMatrix grad_grad_grad_logdet 
)
inlineoverridevirtual

evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [first,last) particles

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
logdetdeterminant matrix to be inverted
dlogdetgradients
grad_grad_logdethessians
grad_grad_grad_logdetthird derivatives

Reimplemented from SPOSet.

Definition at line 204 of file BsplineSet.h.

References SPOSet::evaluateVGHGH().

211  {
212  for (int iat = first, i = 0; iat < last; ++iat, ++i)
213  {
214  ValueVector v(logdet[i], logdet.cols());
215  GradVector g(dlogdet[i], dlogdet.cols());
216  HessVector h(grad_grad_logdet[i], grad_grad_logdet.cols());
217  GGGVector gh(grad_grad_grad_logdet[i], grad_grad_grad_logdet.cols());
218  evaluateVGHGH(P, iat, v, g, h, gh);
219  }
220  }
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 ...
Definition: SPOSet.cpp:244
OrbitalSetTraits< ValueType >::HessVector HessVector
Definition: SPOSet.h:53
OrbitalSetTraits< ValueType >::GradHessVector GGGVector
Definition: SPOSet.h:55
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49

◆ evaluateDetRatios()

void evaluateDetRatios

evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP

Parameters
VPvirtual particle set
psivalues of the SPO, used as a scratch space if needed
psiinvthe row of inverse slater matrix corresponding to the particle moved virtually
ratiosreturn determinant ratios

Definition at line 47 of file SPOSet.cpp.

51 {
52  assert(psi.size() == psiinv.size());
53  for (int iat = 0; iat < VP.getTotalNum(); ++iat)
54  {
55  evaluateValue(VP, iat, psi);
56  ratios[iat] = simd::dot(psi.data(), psiinv.data(), psi.size());
57  }
58 }
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
virtual void evaluateValue(const ParticleSet &P, int iat, ValueVector &psi)=0
evaluate the values of this single-particle orbital set

◆ evaluateGradSource() [1/2]

void evaluateGradSource ( const ParticleSet P,
int  first,
int  last,
const ParticleSet source,
int  iat_src,
GradMatrix gradphi 
)
inlineoverridevirtual

evaluate the gradients of this single-particle orbital for [first,last) target particles with respect to the given source particle

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
iat_srcsource particle index
gradphigradients

Reimplemented from SPOSet.

Definition at line 222 of file BsplineSet.h.

228  {
229  //Do nothing, since Einsplines don't explicitly depend on ion positions.
230  }

◆ evaluateGradSource() [2/2]

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 
)
inlineoverridevirtual

evaluate the gradients of values, gradients, laplacians of this single-particle orbital for [first,last) target particles with respect to the given source particle

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
iat_srcsource particle index
gradphigradients of values
grad_grad_phigradients of gradients
grad_lapl_phigradients of laplacians

Reimplemented from SPOSet.

Definition at line 232 of file BsplineSet.h.

240  {
241  //Do nothing, since Einsplines don't explicitly depend on ion positions.
242  }

◆ evaluateValue()

virtual void evaluateValue

evaluate the values of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO

◆ evaluateVGH()

void evaluateVGH

evaluate the values, gradients and hessians of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO
dpsigradients of the SPO
grad_grad_psihessians of the SPO

Definition at line 238 of file SPOSet.cpp.

239 {
240  throw std::runtime_error("Need specialization of " + getClassName() +
241  "::evaluate(P,iat,psi,dpsi,dhpsi) (vector quantities)\n");
242 }
virtual std::string getClassName() const =0
return class name

◆ evaluateVGHGH()

void evaluateVGHGH

evaluate the values, gradients, hessians, and grad hessians of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO
dpsigradients of the SPO
grad_grad_psihessians of the SPO
grad_grad_grad_psigrad hessians of the SPO

Definition at line 244 of file SPOSet.cpp.

250 {
251  throw std::runtime_error("Need specialization of " + getClassName() +
252  "::evaluate(P,iat,psi,dpsi,dhpsi,dghpsi) (vector quantities)\n");
253 }
virtual std::string getClassName() const =0
return class name

◆ evaluateVGL()

virtual void evaluateVGL

evaluate the values, gradients and laplacians of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO
dpsigradients of the SPO
d2psilaplacians of the SPO

◆ finalizeConstruction()

virtual void finalizeConstruction
inline

finalize the construction of SPOSet

for example, classes serving accelerators may need to transfer data from host to device after the host side objects are built.

Definition at line 554 of file SPOSet.h.

554 {}

◆ getHalfG()

auto& getHalfG ( ) const
inline

Definition at line 64 of file BsplineSet.h.

References BsplineSet::HalfG.

64 { return HalfG; }
TinyVector< int, D > HalfG
sign bits at the G/2 boundaries
Definition: BsplineSet.h:45

◆ getKeyword()

virtual std::string getKeyword ( ) const
pure virtual

◆ init_base()

void init_base ( int  n)
inline

Definition at line 66 of file BsplineSet.h.

References BsplineSet::BandIndexMap, BsplineSet::kPoints, BsplineSet::MakeTwoCopies, and qmcplusplus::n.

Referenced by SplineC2R< ST >::resizeStorage(), SplineR2R< ST >::resizeStorage(), SplineC2C< ST >::resizeStorage(), SplineC2COMPTarget< ST >::resizeStorage(), and SplineC2ROMPTarget< ST >::resizeStorage().

67  {
68  kPoints.resize(n);
69  MakeTwoCopies.resize(n);
70  BandIndexMap.resize(n);
71  for (int i = 0; i < n; i++)
72  BandIndexMap[i] = i;
73  }
aligned_vector< int > BandIndexMap
remap splines to orbitals
Definition: BsplineSet.h:54
std::vector< SPOSet::PosType > kPoints
kpoints for each unique orbitals.
Definition: BsplineSet.h:52
std::vector< bool > MakeTwoCopies
flags to unpack sin/cos
Definition: BsplineSet.h:47

◆ isComplex()

virtual bool isComplex ( ) const
pure virtual

◆ makeClone()

std::unique_ptr<SPOSet> makeClone ( ) const
overridepure virtual

make a clone of itself every derived class must implement this to have threading working correctly.

Reimplemented from SPOSet.

Implemented in SplineC2ROMPTarget< ST >, SplineC2COMPTarget< ST >, SplineC2R< ST >, SplineC2C< ST >, and SplineR2R< ST >.

◆ mw_evaluate_notranspose()

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
inlineoverridevirtual

Reimplemented from SPOSet.

Definition at line 139 of file BsplineSet.h.

References RefVectorWithLeader< T >::getLeader(), and SPOSet::mw_evaluateVGL().

146  {
147  assert(this == &spo_list.getLeader());
149  using grad_type = GradMatrix::value_type;
150 
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;
155  RefVector<ValueVector> psi_v_list;
156  RefVector<GradVector> dpsi_v_list;
157  RefVector<ValueVector> d2psi_v_list;
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);
164 
165  for (int iat = first, i = 0; iat < last; ++iat, ++i)
166  {
167  mw_psi_v.clear();
168  mw_dpsi_v.clear();
169  mw_d2psi_v.clear();
170  psi_v_list.clear();
171  dpsi_v_list.clear();
172  d2psi_v_list.clear();
173 
174  for (int iw = 0; iw < nw; iw++)
175  {
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());
182  }
183 
184  mw_evaluateVGL(spo_list, P_list, iat, psi_v_list, dpsi_v_list, d2psi_v_list);
185  }
186  }
QMCTraits::FullPrecRealType value_type
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...
Definition: SPOSet.cpp:93

◆ mw_evaluateDetRatios()

void mw_evaluateDetRatios

evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP, of multiple walkers

Parameters
spo_listthe list of SPOSet pointers in a walker batch
vp_lista list of virtual particle sets in a walker batch
psi_lista list of values of the SPO, used as a scratch space if needed
invRow_ptr_lista list of pointers to the rows of inverse slater matrix corresponding to the particles moved virtually
ratios_lista list of returning determinant ratios

Definition at line 69 of file SPOSet.cpp.

74 {
75  assert(this == &spo_list.getLeader());
76  for (int iw = 0; iw < spo_list.size(); iw++)
77  {
78  Vector<ValueType> invRow(const_cast<ValueType*>(invRow_ptr_list[iw]), psi_list[iw].get().size());
79  spo_list[iw].evaluateDetRatios(vp_list[iw], psi_list[iw], invRow, ratios_list[iw]);
80  }
81 }
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75

◆ mw_evaluateVGL()

void mw_evaluateVGL

evaluate the values, gradients and laplacians of this single-particle orbital sets of multiple walkers

Parameters
spo_listthe list of SPOSet pointers in a walker batch
P_listthe list of ParticleSet pointers in a walker batch
iatactive particle
psi_v_listthe list of value vector pointers in a walker batch
dpsi_v_listthe list of gradient vector pointers in a walker batch
d2psi_v_listthe list of laplacian vector pointers in a walker batch

Definition at line 93 of file SPOSet.cpp.

99 {
100  assert(this == &spo_list.getLeader());
101  for (int iw = 0; iw < spo_list.size(); iw++)
102  spo_list[iw].evaluateVGL(P_list[iw], iat, psi_v_list[iw], dpsi_v_list[iw], d2psi_v_list[iw]);
103 }
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 ...

◆ mw_evaluateVGLandDetRatioGrads()

void mw_evaluateVGLandDetRatioGrads

evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ratio and grads of multiple walkers.

Device data of phi_vgl_v must be up-to-date upon return

Parameters
spo_listthe list of SPOSet pointers in a walker batch
P_listthe list of ParticleSet pointers in a walker batch
iatactive particle
phi_vgl_vorbital values, gradients and laplacians of all the walkers
psi_ratio_grads_vdeterminant ratio and grads of all the walkers

Definition at line 126 of file SPOSet.cpp.

133 {
134  assert(this == &spo_list.getLeader());
135  assert(phi_vgl_v.size(0) == DIM_VGL);
136  assert(phi_vgl_v.size(1) == spo_list.size());
137  const size_t nw = spo_list.size();
138  const size_t norb_requested = phi_vgl_v.size(2);
139  GradVector dphi_v(norb_requested);
140  for (int iw = 0; iw < nw; iw++)
141  {
142  ValueVector phi_v(phi_vgl_v.data_at(0, iw, 0), norb_requested);
143  ValueVector d2phi_v(phi_vgl_v.data_at(4, iw, 0), norb_requested);
144  spo_list[iw].evaluateVGL(P_list[iw], iat, phi_v, dphi_v, d2phi_v);
145 
146  ratios[iw] = simd::dot(invRow_ptr_list[iw], phi_v.data(), norb_requested);
147  grads[iw] = simd::dot(invRow_ptr_list[iw], dphi_v.data(), norb_requested) / ratios[iw];
148 
149  // transpose the array of gradients to SoA in phi_vgl_v
150  for (size_t idim = 0; idim < DIM; idim++)
151  {
152  ValueType* phi_g = phi_vgl_v.data_at(idim + 1, iw, 0);
153  for (size_t iorb = 0; iorb < norb_requested; iorb++)
154  phi_g[iorb] = dphi_v[iorb][idim];
155  }
156  }
157  phi_vgl_v.updateTo();
158 }
QTBase::ValueType ValueType
Definition: Configuration.h:60
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49

◆ releaseResource()

virtual void releaseResource
inline

return a shared resource to collection

Definition at line 536 of file SPOSet.h.

536 {}

◆ remap_kpoints()

int remap_kpoints ( )
inline

remap kpoints to group general kpoints & special kpoints

Definition at line 76 of file BsplineSet.h.

References BsplineSet::BandIndexMap, BsplineSet::kPoints, and BsplineSet::MakeTwoCopies.

Referenced by SplineC2R< ST >::resize_kpoints(), and SplineC2ROMPTarget< ST >::resize_kpoints().

77  {
78  std::vector<SPOSet::PosType> k_copy(kPoints);
79  const int nk = kPoints.size();
80  int nCB = 0;
81  //two pass
82  for (int i = 0; i < nk; ++i)
83  {
84  if (MakeTwoCopies[i])
85  {
86  kPoints[nCB] = k_copy[i];
87  BandIndexMap[nCB++] = i;
88  }
89  }
90  int nRealBands = nCB;
91  for (int i = 0; i < nk; ++i)
92  {
93  if (!MakeTwoCopies[i])
94  {
95  kPoints[nRealBands] = k_copy[i];
96  BandIndexMap[nRealBands++] = i;
97  }
98  }
99  return nCB; //return the number of complex bands
100  }
aligned_vector< int > BandIndexMap
remap splines to orbitals
Definition: BsplineSet.h:54
std::vector< SPOSet::PosType > kPoints
kpoints for each unique orbitals.
Definition: BsplineSet.h:52
std::vector< bool > MakeTwoCopies
flags to unpack sin/cos
Definition: BsplineSet.h:47

◆ setOrbitalSetSize()

void setOrbitalSetSize ( int  norbs)
inlineoverridevirtual

set the OrbitalSetSize

Parameters
norbsnumber of single-particle orbitals Ye: I prefer to remove this interface in the future. SPOSet builders need to handle the size correctly. It doesn't make sense allowing to set the value at any place in the code.

Implements SPOSet.

Definition at line 119 of file BsplineSet.h.

References SPOSet::OrbitalSetSize.

119 { OrbitalSetSize = norbs; }
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566

Friends And Related Function Documentation

◆ BsplineReader

friend struct BsplineReader
friend

Definition at line 246 of file BsplineSet.h.

◆ SplineSetReader

friend class SplineSetReader
friend

Definition at line 245 of file BsplineSet.h.

Member Data Documentation

◆ BandIndexMap

aligned_vector<int> BandIndexMap
protected

remap splines to orbitals

Definition at line 54 of file BsplineSet.h.

Referenced by BsplineSet::init_base(), and BsplineSet::remap_kpoints().

◆ D

const int D = DIM
staticprotected

Definition at line 37 of file BsplineSet.h.

Referenced by SplineR2R< ST >::convertPos().

◆ first_spo

size_t first_spo
protected

first index of the SPOs this Spline handles

Definition at line 41 of file BsplineSet.h.

◆ HalfG

TinyVector<int, D> HalfG
protected

sign bits at the G/2 boundaries

Definition at line 45 of file BsplineSet.h.

Referenced by SplineR2R< ST >::convertPos(), BsplineSet::getHalfG(), and SplineR2R< ST >::resizeStorage().

◆ kPoints

std::vector<SPOSet::PosType> kPoints
protected

kpoints for each unique orbitals.

Note: for historic reason, this sign is opposite to what was used in DFT when orbitals were generated. Changing the sign requires updating all the evaluation code.

Definition at line 52 of file BsplineSet.h.

Referenced by SplineC2R< ST >::gather_tables(), SplineR2R< ST >::gather_tables(), SplineC2C< ST >::gather_tables(), SplineC2COMPTarget< ST >::gather_tables(), SplineC2ROMPTarget< ST >::gather_tables(), BsplineSet::init_base(), BsplineSet::remap_kpoints(), SplineC2R< ST >::resize_kpoints(), SplineC2C< ST >::resize_kpoints(), SplineC2COMPTarget< ST >::resize_kpoints(), and SplineC2ROMPTarget< ST >::resize_kpoints().

◆ last_spo

size_t last_spo
protected

last index of the SPOs this Spline handles

Definition at line 43 of file BsplineSet.h.

◆ MakeTwoCopies

std::vector<bool> MakeTwoCopies
protected

flags to unpack sin/cos

Definition at line 47 of file BsplineSet.h.

Referenced by BsplineSet::init_base(), and BsplineSet::remap_kpoints().

◆ MyIndex

size_t MyIndex
protected

Index of this adoptor, when multiple adoptors are used for NUMA or distributed cases.

Definition at line 39 of file BsplineSet.h.

◆ offset

std::vector<int> offset
protected

The documentation for this class was generated from the following file: