29 SPOSet::SPOSet(
const std::string& my_name) : my_name_(my_name), OrbitalSetSize(0) {}
35 "::extractOptimizableObjectRefs " 36 "must be overloaded when the SPOSet is optimizable.");
43 "::checkOutVariables " 44 "must be overloaded when the SPOSet is optimizable.");
50 std::vector<ValueType>& ratios)
52 assert(psi.size() == psiinv.size());
56 ratios[iat] =
simd::dot(psi.data(), psiinv.data(), psi.size());
62 const std::pair<ValueVector, ValueVector>& spinor_multiplier,
64 std::vector<ValueType>& ratios)
66 throw std::runtime_error(
"Need specialization of " +
getClassName() +
"::evaluateDetSpinorRatios");
72 const std::vector<const ValueType*>& invRow_ptr_list,
73 std::vector<std::vector<ValueType>>& ratios_list)
const 76 for (
int iw = 0; iw < spo_list.size(); iw++)
79 spo_list[iw].evaluateDetRatios(vp_list[iw], psi_list[iw], invRow, ratios_list[iw]);
90 throw std::runtime_error(
"Need specialization of SPOSet::evaluateVGL_spin");
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]);
111 for (
int iw = 0; iw < spo_list.size(); iw++)
123 throw std::runtime_error(
getClassName() +
"::mw_evaluateVGLWithSpin() is not supported. \n");
129 const std::vector<const ValueType*>& invRow_ptr_list,
131 std::vector<ValueType>& ratios,
132 std::vector<GradType>& grads)
const 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);
140 for (
int iw = 0; iw < nw; iw++)
144 spo_list[iw].evaluateVGL(P_list[iw], iat, phi_v, dphi_v, d2phi_v);
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];
150 for (
size_t idim = 0; idim <
DIM; idim++)
153 for (
size_t iorb = 0; iorb < norb_requested; iorb++)
154 phi_g[iorb] = dphi_v[iorb][idim];
163 const std::vector<const ValueType*>& invRow_ptr_list,
165 std::vector<ValueType>& ratios,
166 std::vector<GradType>& grads,
167 std::vector<ValueType>& spingrads)
const 169 throw std::runtime_error(
"Need specialization of " +
getClassName() +
170 "::mw_evaluateVGLandDetRatioGradsWithSpin(). \n");
175 throw std::runtime_error(
"Need specialization of SPOSet::evaluateThirdDeriv(). \n");
186 throw std::runtime_error(
"Need specialization of " +
getClassName() +
187 "::evaluate_notranspose_spin(P,iat,psi,dpsi,d2logdet, dspin_logdet) (vector quantities)\n");
199 for (
int iw = 0; iw < spo_list.size(); iw++)
200 spo_list[iw].
evaluate_notranspose(P_list[iw], first, last, logdet_list[iw], dlogdet_list[iw], d2logdet_list[iw]);
210 throw std::runtime_error(
"Need specialization of SPOSet::evaluate_notranspose() for grad_grad_logdet. \n");
221 throw std::runtime_error(
"Need specialization of SPOSet::evaluate_notranspose() for grad_grad_grad_logdet. \n");
227 throw std::runtime_error(
"Missing SPOSet::makeClone for " +
getClassName());
232 app_log() << pad <<
"size = " <<
size() << std::endl;
233 app_log() << pad <<
"state info:" << std::endl;
240 throw std::runtime_error(
"Need specialization of " +
getClassName() +
241 "::evaluate(P,iat,psi,dpsi,dhpsi) (vector quantities)\n");
251 throw std::runtime_error(
"Need specialization of " +
getClassName() +
252 "::evaluate(P,iat,psi,dpsi,dhpsi,dghpsi) (vector quantities)\n");
260 "must be overloaded when the SPOSet supports rotation.");
267 const int& FirstIndex,
268 const int& LastIndex)
272 "::evaluateDerivatives " 273 "must be overloaded when the SPOSet is optimizable.");
284 "::evaluateDerivativesWF " 285 "must be overloaded when the SPOSet is optimizable.");
292 std::vector<ValueType>& ratios,
302 "::evaluateDerivRatios " 303 "must be overloaded when the SPOSet is optimizable.");
315 const std::vector<ValueType>& Coeff,
316 const std::vector<size_t>& C2node_up,
317 const std::vector<size_t>& C2node_dn,
330 const std::vector<int>& detData_up,
335 const std::vector<std::vector<int>>& lookup_tbl)
339 "::evaluateDerivatives " 340 "must be overloaded when the SPOSet is optimizable.");
350 const std::vector<ValueType>& Coeff,
351 const std::vector<size_t>& C2node_up,
352 const std::vector<size_t>& C2node_dn,
359 const std::vector<int>& detData_up,
360 const std::vector<std::vector<int>>& lookup_tbl)
364 "::evaluateDerivativesWF " 365 "must be overloaded when the SPOSet is optimizable.");
378 "::evaluateGradSource " 379 "must be overloaded when the SPOSet has ion derivatives.");
393 "::evaluateGradSource " 394 "must be overloaded when the SPOSet has ion derivatives.");
405 "::evaluateGradSourceRow " 406 "must be overloaded when the SPOSet has ion derivatives.");
411 throw std::runtime_error(
"Need specialization of " +
getClassName() +
412 "::evaluate_spin(P,iat,psi,dpsi) (vector quantities)\n");
virtual void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet)=0
evaluate the values, gradients and laplacians of this single-particle orbital for [first...
SPOSet(const std::string &my_name)
constructor
OrbitalSetTraits< ValueType >::HessVector HessVector
helper functions for EinsplineSetBuilder
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
virtual void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, int FirstIndex, int LastIndex)
Parameter derivatives of the wavefunction.
virtual std::unique_ptr< SPOSet > makeClone() const
make a clone of itself every derived class must implement this to have threading working correctly...
Type_t * data_at(const std::array< SIZET, D > &indices)
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.
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
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
size_t getTotalNum() const
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
virtual void applyRotation(const ValueMatrix &rot_mat, bool use_stored_copy=false)
apply rotation to all the orbitals
void basic_report(const std::string &pad="") const
print basic SPOSet information
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
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 ra...
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
virtual void evaluateValue(const ParticleSet &P, int iat, ValueVector &psi)=0
evaluate the values of this single-particle orbital set
Specialized paritlce class for atomistic simulations.
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.
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
virtual std::string getClassName() const =0
return class name
virtual 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
QTBase::ValueType ValueType
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...
declaration of ProgressReportEngine
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 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 ...
class to handle a set of variables that can be modified during optimizations
virtual bool isOptimizable() const
Query if this SPOSet is optimizable.
virtual bool hasIonDerivs() const
Query if this SPOSet has an explicit ion dependence.
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
std::vector< std::reference_wrapper< T > > RefVector
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.
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
OrbitalSetTraits< ValueType >::GradHessVector GGGVector
OrbitalSetTraits< ValueType >::GradVector GradVector
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 ...
void updateTo(size_t size=0, std::ptrdiff_t offset=0)
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 ...
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...
virtual void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs)
extract underlying OptimizableObject references
virtual bool isRotationSupported() const
return true if this SPOSet can be wrappered by RotatedSPO
virtual void checkOutVariables(const opt_variables_type &active)
check out variational optimizable variables
OrbitalSetTraits< ValueType >::GradHessMatrix GGGMatrix
A D-dimensional Array class based on PETE.
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 ...
virtual void evaluateGradSource(const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &gradphi)
evaluate the gradients of this single-particle orbital for [first,last) target particles with respect...
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix
virtual void evaluate_spin(const ParticleSet &P, int iat, ValueVector &psi, ValueVector &dpsi)
evaluate the values of this single-particle orbital set