diff --git a/src/Configuration.h b/src/Configuration.h index 0244546422..42ba461299 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -50,8 +50,7 @@ struct QMCTraits { enum { - DIM = OHMMS_DIM, - DIM_VGL = OHMMS_DIM + 2 // Value(1) + Gradients(OHMMS_DIM) + Laplacian(1) + DIM = OHMMS_DIM }; using QTBase = QMCTypes; using QTFull = QMCTypes; diff --git a/src/QMCWaveFunctions/BsplineFactory/SplineR2R.cpp b/src/QMCWaveFunctions/BsplineFactory/SplineR2R.cpp index 9498f54f12..20961ef4c6 100644 --- a/src/QMCWaveFunctions/BsplineFactory/SplineR2R.cpp +++ b/src/QMCWaveFunctions/BsplineFactory/SplineR2R.cpp @@ -136,7 +136,7 @@ void SplineR2R::applyRotation(const ValueMatrix& rot_mat, bool use_stored_co for (IndexType j = 0; j < OrbitalSetSize; j++) { const auto cur_elem = Nsplines * i + j; - FullPrecValueType newval{0.}; + FullPrecValue newval{0.}; for (IndexType k = 0; k < OrbitalSetSize; k++) { const auto index = i * Nsplines + k; diff --git a/src/QMCWaveFunctions/Fermion/DiracDeterminantBatched.cpp b/src/QMCWaveFunctions/Fermion/DiracDeterminantBatched.cpp index 6faa1058a0..80d1d07a17 100644 --- a/src/QMCWaveFunctions/Fermion/DiracDeterminantBatched.cpp +++ b/src/QMCWaveFunctions/Fermion/DiracDeterminantBatched.cpp @@ -341,7 +341,7 @@ void DiracDeterminantBatched::mw_ratioGrad(const RefVectorWithLeader auto psiMinv_row_dev_ptr_list = DET_ENGINE::mw_getInvRow(engine_list, WorkingIndex, !Phi->isOMPoffload()); - phi_vgl_v.resize(DIM_VGL, wfc_list.size(), NumOrbitals); + phi_vgl_v.resize(SPOSet::DIM_VGL, wfc_list.size(), NumOrbitals); ratios_local.resize(wfc_list.size()); grad_new_local.resize(wfc_list.size()); @@ -391,7 +391,7 @@ void DiracDeterminantBatched::mw_ratioGradWithSpin( auto psiMinv_row_dev_ptr_list = DET_ENGINE::mw_getInvRow(engine_list, WorkingIndex, !Phi->isOMPoffload()); - phi_vgl_v.resize(DIM_VGL, wfc_list.size(), NumOrbitals); + phi_vgl_v.resize(SPOSet::DIM_VGL, wfc_list.size(), NumOrbitals); ratios_local.resize(wfc_list.size()); grad_new_local.resize(wfc_list.size()); spingrad_new_local.resize(wfc_list.size()); @@ -784,7 +784,7 @@ void DiracDeterminantBatched::mw_calcRatio(const RefVectorWithLeader auto psiMinv_row_dev_ptr_list = DET_ENGINE::mw_getInvRow(engine_list, WorkingIndex, !Phi->isOMPoffload()); - phi_vgl_v.resize(DIM_VGL, wfc_list.size(), NumOrbitals); + phi_vgl_v.resize(SPOSet::DIM_VGL, wfc_list.size(), NumOrbitals); ratios_local.resize(wfc_list.size()); grad_new_local.resize(wfc_list.size()); diff --git a/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.h b/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.h index e7513eeeae..2fe3169392 100644 --- a/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.h +++ b/src/QMCWaveFunctions/Fermion/SlaterDetBuilder.h @@ -28,7 +28,10 @@ class BackflowTransformation; class DiracDeterminantBase; class MultiSlaterDetTableMethod; struct CSFData; -class SPOSet; + +template +class SPOSetT; +using SPOSet = SPOSetT; class SPOSetBuilder; class SPOSetBuilderFactory; struct ci_configuration; diff --git a/src/QMCWaveFunctions/RotatedSPOs.cpp b/src/QMCWaveFunctions/RotatedSPOs.cpp index 0815484c5e..c1e26409de 100644 --- a/src/QMCWaveFunctions/RotatedSPOs.cpp +++ b/src/QMCWaveFunctions/RotatedSPOs.cpp @@ -957,7 +957,7 @@ void RotatedSPOs::evaluateDerivatives(ParticleSet& P, void RotatedSPOs::evaluateDerivativesWF(ParticleSet& P, const opt_variables_type& optvars, Vector& dlogpsi, - const QTFull::ValueType& psiCurrent, + const FullPrecValue& psiCurrent, const std::vector& Coeff, const std::vector& C2node_up, const std::vector& C2node_dn, diff --git a/src/QMCWaveFunctions/RotatedSPOs.h b/src/QMCWaveFunctions/RotatedSPOs.h index 6e4c45d525..1db4eecf7c 100644 --- a/src/QMCWaveFunctions/RotatedSPOs.h +++ b/src/QMCWaveFunctions/RotatedSPOs.h @@ -178,7 +178,7 @@ class RotatedSPOs : public SPOSet, public OptimizableObject void evaluateDerivativesWF(ParticleSet& P, const opt_variables_type& optvars, Vector& dlogpsi, - const QTFull::ValueType& psiCurrent, + const FullPrecValue& psiCurrent, const std::vector& Coeff, const std::vector& C2node_up, const std::vector& C2node_dn, diff --git a/src/QMCWaveFunctions/SPOSet.cpp b/src/QMCWaveFunctions/SPOSet.cpp index dacfd4423b..42b6cf9d98 100644 --- a/src/QMCWaveFunctions/SPOSet.cpp +++ b/src/QMCWaveFunctions/SPOSet.cpp @@ -26,28 +26,33 @@ namespace qmcplusplus { -SPOSet::SPOSet(const std::string& my_name) : my_name_(my_name), OrbitalSetSize(0) {} +template +SPOSetT::SPOSetT(const std::string& my_name) : my_name_(my_name), OrbitalSetSize(0) +{} -void SPOSet::extractOptimizableObjectRefs(UniqueOptObjRefs&) +template +void SPOSetT::extractOptimizableObjectRefs(UniqueOptObjRefs&) { if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::extractOptimizableObjectRefs " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } -void SPOSet::checkOutVariables(const opt_variables_type& active) +template +void SPOSetT::checkOutVariables(const opt_variables_type& active) { if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::checkOutVariables " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } -void SPOSet::evaluateDetRatios(const VirtualParticleSet& VP, - ValueVector& psi, - const ValueVector& psiinv, - std::vector& ratios) +template +void SPOSetT::evaluateDetRatios(const VirtualParticleSet& VP, + ValueVector& psi, + const ValueVector& psiinv, + std::vector& ratios) { assert(psi.size() == psiinv.size()); for (int iat = 0; iat < VP.getTotalNum(); ++iat) @@ -57,73 +62,79 @@ void SPOSet::evaluateDetRatios(const VirtualParticleSet& VP, } } -void SPOSet::mw_evaluateDetRatios(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& vp_list, - const RefVector& psi_list, - const std::vector& invRow_ptr_list, - std::vector>& ratios_list) const +template +void SPOSetT::mw_evaluateDetRatios(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& vp_list, + const RefVector& psi_list, + const std::vector& invRow_ptr_list, + std::vector>& ratios_list) const { assert(this == &spo_list.getLeader()); for (int iw = 0; iw < spo_list.size(); iw++) { - Vector invRow(const_cast(invRow_ptr_list[iw]), psi_list[iw].get().size()); + Vector invRow(const_cast(invRow_ptr_list[iw]), psi_list[iw].get().size()); spo_list[iw].evaluateDetRatios(vp_list[iw], psi_list[iw], invRow, ratios_list[iw]); } } -void SPOSet::evaluateVGL_spin(const ParticleSet& P, - int iat, - ValueVector& psi, - GradVector& dpsi, - ValueVector& d2psi, - ValueVector& dspin) +template +void SPOSetT::evaluateVGL_spin(const ParticleSet& P, + int iat, + ValueVector& psi, + GradVector& dpsi, + ValueVector& d2psi, + ValueVector& dspin) { - throw std::runtime_error("Need specialization of SPOSet::evaluateVGL_spin"); + throw std::runtime_error("Need specialization of SPOSetT::evaluateVGL_spin"); } -void SPOSet::mw_evaluateVGL(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& P_list, - int iat, - const RefVector& psi_v_list, - const RefVector& dpsi_v_list, - const RefVector& d2psi_v_list) const +template +void SPOSetT::mw_evaluateVGL(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& P_list, + int iat, + const RefVector& psi_v_list, + const RefVector& dpsi_v_list, + const RefVector& d2psi_v_list) const { assert(this == &spo_list.getLeader()); for (int iw = 0; iw < spo_list.size(); iw++) spo_list[iw].evaluateVGL(P_list[iw], iat, psi_v_list[iw], dpsi_v_list[iw], d2psi_v_list[iw]); } -void SPOSet::mw_evaluateValue(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& P_list, - int iat, - const RefVector& psi_v_list) const +template +void SPOSetT::mw_evaluateValue(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& P_list, + int iat, + const RefVector& psi_v_list) const { assert(this == &spo_list.getLeader()); for (int iw = 0; iw < spo_list.size(); iw++) spo_list[iw].evaluateValue(P_list[iw], iat, psi_v_list[iw]); } -void SPOSet::mw_evaluateVGLWithSpin(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& P_list, - int iat, - const RefVector& psi_v_list, - const RefVector& dpsi_v_list, - const RefVector& d2psi_v_list, - OffloadMatrix& mw_dspin) const +template +void SPOSetT::mw_evaluateVGLWithSpin(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& P_list, + int iat, + const RefVector& psi_v_list, + const RefVector& dpsi_v_list, + const RefVector& d2psi_v_list, + OffloadMatrix& mw_dspin) const { throw std::runtime_error(getClassName() + "::mw_evaluateVGLWithSpin() is not supported. \n"); } -void SPOSet::mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& P_list, - int iat, - const std::vector& invRow_ptr_list, - OffloadMWVGLArray& phi_vgl_v, - std::vector& ratios, - std::vector& grads) const +template +void SPOSetT::mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& P_list, + int iat, + const std::vector& invRow_ptr_list, + OffloadMWVGLArray& phi_vgl_v, + std::vector& ratios, + std::vector& grads) const { assert(this == &spo_list.getLeader()); - assert(phi_vgl_v.size(0) == DIM_VGL); + assert(phi_vgl_v.size(0) == SPOSet::DIM_VGL); assert(phi_vgl_v.size(1) == spo_list.size()); const size_t nw = spo_list.size(); const size_t norb_requested = phi_vgl_v.size(2); @@ -138,9 +149,9 @@ void SPOSet::mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader& s grads[iw] = simd::dot(invRow_ptr_list[iw], dphi_v.data(), norb_requested) / ratios[iw]; // transpose the array of gradients to SoA in phi_vgl_v - for (size_t idim = 0; idim < DIM; idim++) + for (size_t idim = 0; idim < QMCTraits::DIM; idim++) { - ValueType* phi_g = phi_vgl_v.data_at(idim + 1, iw, 0); + Value* phi_g = phi_vgl_v.data_at(idim + 1, iw, 0); for (size_t iorb = 0; iorb < norb_requested; iorb++) phi_g[iorb] = dphi_v[iorb][idim]; } @@ -148,77 +159,86 @@ void SPOSet::mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader& s phi_vgl_v.updateTo(); } -void SPOSet::mw_evaluateVGLandDetRatioGradsWithSpin(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& P_list, - int iat, - const std::vector& invRow_ptr_list, - OffloadMWVGLArray& phi_vgl_v, - std::vector& ratios, - std::vector& grads, - std::vector& spingrads) const +template +void SPOSetT::mw_evaluateVGLandDetRatioGradsWithSpin(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& P_list, + int iat, + const std::vector& invRow_ptr_list, + OffloadMWVGLArray& phi_vgl_v, + std::vector& ratios, + std::vector& grads, + std::vector& spingrads) const { throw std::runtime_error("Need specialization of " + getClassName() + "::mw_evaluateVGLandDetRatioGradsWithSpin(). \n"); } -void SPOSet::evaluateThirdDeriv(const ParticleSet& P, int first, int last, GGGMatrix& grad_grad_grad_logdet) +template +void SPOSetT::evaluateThirdDeriv(const ParticleSet& P, int first, int last, GGGMatrix& grad_grad_grad_logdet) { - throw std::runtime_error("Need specialization of SPOSet::evaluateThirdDeriv(). \n"); + throw std::runtime_error("Need specialization of SPOSetT::evaluateThirdDeriv(). \n"); } -void SPOSet::evaluate_notranspose_spin(const ParticleSet& P, - int first, - int last, - ValueMatrix& logdet, - GradMatrix& dlogdet, - ValueMatrix& d2logdet, - ValueMatrix& dspinlogdet) +template +void SPOSetT::evaluate_notranspose_spin(const ParticleSet& P, + int first, + int last, + ValueMatrix& logdet, + GradMatrix& dlogdet, + ValueMatrix& d2logdet, + ValueMatrix& dspinlogdet) { throw std::runtime_error("Need specialization of " + getClassName() + "::evaluate_notranspose_spin(P,iat,psi,dpsi,d2logdet, dspin_logdet) (vector quantities)\n"); } -void SPOSet::mw_evaluate_notranspose(const RefVectorWithLeader& spo_list, - const RefVectorWithLeader& P_list, - int first, - int last, - const RefVector& logdet_list, - const RefVector& dlogdet_list, - const RefVector& d2logdet_list) const +template +void SPOSetT::mw_evaluate_notranspose(const RefVectorWithLeader& spo_list, + const RefVectorWithLeader& P_list, + int first, + int last, + const RefVector& logdet_list, + const RefVector& dlogdet_list, + const RefVector& d2logdet_list) const { assert(this == &spo_list.getLeader()); for (int iw = 0; iw < spo_list.size(); iw++) spo_list[iw].evaluate_notranspose(P_list[iw], first, last, logdet_list[iw], dlogdet_list[iw], d2logdet_list[iw]); } -void SPOSet::evaluate_notranspose(const ParticleSet& P, - int first, - int last, - ValueMatrix& logdet, - GradMatrix& dlogdet, - HessMatrix& grad_grad_logdet) +template +void SPOSetT::evaluate_notranspose(const ParticleSet& P, + int first, + int last, + ValueMatrix& logdet, + GradMatrix& dlogdet, + HessMatrix& grad_grad_logdet) { - throw std::runtime_error("Need specialization of SPOSet::evaluate_notranspose() for grad_grad_logdet. \n"); + throw std::runtime_error("Need specialization of SPOSetT::evaluate_notranspose() for grad_grad_logdet. \n"); } -void SPOSet::evaluate_notranspose(const ParticleSet& P, - int first, - int last, - ValueMatrix& logdet, - GradMatrix& dlogdet, - HessMatrix& grad_grad_logdet, - GGGMatrix& grad_grad_grad_logdet) +template +void SPOSetT::evaluate_notranspose(const ParticleSet& P, + int first, + int last, + ValueMatrix& logdet, + GradMatrix& dlogdet, + HessMatrix& grad_grad_logdet, + GGGMatrix& grad_grad_grad_logdet) { - throw std::runtime_error("Need specialization of SPOSet::evaluate_notranspose() for grad_grad_grad_logdet. \n"); + throw std::runtime_error( + "Need specialization of SPOSetT::evaluate_notranspose() for grad_grad_grad_logdet. \n"); } -std::unique_ptr SPOSet::makeClone() const +template +std::unique_ptr> SPOSetT::makeClone() const { - throw std::runtime_error("Missing SPOSet::makeClone for " + getClassName()); + throw std::runtime_error("Missing SPOSetT::makeClone for " + getClassName()); } -void SPOSet::basic_report(const std::string& pad) const +template +void SPOSetT::basic_report(const std::string& pad) const { app_log() << pad << "size = " << size() << std::endl; app_log() << pad << "state info:" << std::endl; @@ -226,64 +246,74 @@ void SPOSet::basic_report(const std::string& pad) const app_log().flush(); } -void SPOSet::evaluateVGH(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, HessVector& grad_grad_psi) +template +void SPOSetT::evaluateVGH(const ParticleSet& P, + int iat, + ValueVector& psi, + GradVector& dpsi, + HessVector& grad_grad_psi) { throw std::runtime_error("Need specialization of " + getClassName() + "::evaluate(P,iat,psi,dpsi,dhpsi) (vector quantities)\n"); } -void SPOSet::evaluateVGHGH(const ParticleSet& P, - int iat, - ValueVector& psi, - GradVector& dpsi, - HessVector& grad_grad_psi, - GGGVector& grad_grad_grad_psi) +template +void SPOSetT::evaluateVGHGH(const ParticleSet& P, + int iat, + ValueVector& psi, + GradVector& dpsi, + HessVector& grad_grad_psi, + GGGVector& grad_grad_grad_psi) { throw std::runtime_error("Need specialization of " + getClassName() + "::evaluate(P,iat,psi,dpsi,dhpsi,dghpsi) (vector quantities)\n"); } -void SPOSet::applyRotation(const ValueMatrix& rot_mat, bool use_stored_copy) +template +void SPOSetT::applyRotation(const ValueMatrix& rot_mat, bool use_stored_copy) { if (isRotationSupported()) throw std::logic_error("Bug!! " + getClassName() + "::applyRotation " - "must be overloaded when the SPOSet supports rotation."); + "must be overloaded when the SPOSetT supports rotation."); } -void SPOSet::evaluateDerivatives(ParticleSet& P, - const opt_variables_type& optvars, - Vector& dlogpsi, - Vector& dhpsioverpsi, - const int& FirstIndex, - const int& LastIndex) +template +void SPOSetT::evaluateDerivatives(ParticleSet& P, + const opt_variables_type& optvars, + Vector& dlogpsi, + Vector& dhpsioverpsi, + const int& FirstIndex, + const int& LastIndex) { if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateDerivatives " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } -void SPOSet::evaluateDerivativesWF(ParticleSet& P, - const opt_variables_type& optvars, - Vector& dlogpsi, - int FirstIndex, - int LastIndex) +template +void SPOSetT::evaluateDerivativesWF(ParticleSet& P, + const opt_variables_type& optvars, + Vector& dlogpsi, + int FirstIndex, + int LastIndex) { if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateDerivativesWF " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } -void SPOSet::evaluateDerivRatios(const VirtualParticleSet& VP, - const opt_variables_type& optvars, - ValueVector& psi, - const ValueVector& psiinv, - std::vector& ratios, - Matrix& dratios, - int FirstIndex, - int LastIndex) +template +void SPOSetT::evaluateDerivRatios(const VirtualParticleSet& VP, + const opt_variables_type& optvars, + ValueVector& psi, + const ValueVector& psiinv, + std::vector& ratios, + Matrix& dratios, + int FirstIndex, + int LastIndex) { // Match the fallback in WaveFunctionComponent that evaluates just the ratios evaluateDetRatios(VP, psi, psiinv, ratios); @@ -291,116 +321,129 @@ void SPOSet::evaluateDerivRatios(const VirtualParticleSet& VP, if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateDerivRatios " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } /** 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 */ -void SPOSet::evaluateDerivatives(ParticleSet& P, - const opt_variables_type& optvars, - Vector& dlogpsi, - Vector& dhpsioverpsi, - const ValueType& psiCurrent, - const std::vector& Coeff, - const std::vector& C2node_up, - const std::vector& 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& detData_up, - const size_t N1, - const size_t N2, - const size_t NP1, - const size_t NP2, - const std::vector>& lookup_tbl) +template +void SPOSetT::evaluateDerivatives(ParticleSet& P, + const opt_variables_type& optvars, + Vector& dlogpsi, + Vector& dhpsioverpsi, + const Value& psiCurrent, + const std::vector& Coeff, + const std::vector& C2node_up, + const std::vector& 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& detData_up, + const size_t N1, + const size_t N2, + const size_t NP1, + const size_t NP2, + const std::vector>& lookup_tbl) { if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateDerivatives " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } /** 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 */ -void SPOSet::evaluateDerivativesWF(ParticleSet& P, - const opt_variables_type& optvars, - Vector& dlogpsi, - const QTFull::ValueType& psiCurrent, - const std::vector& Coeff, - const std::vector& C2node_up, - const std::vector& 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& detData_up, - const std::vector>& lookup_tbl) +template +void SPOSetT::evaluateDerivativesWF(ParticleSet& P, + const opt_variables_type& optvars, + Vector& dlogpsi, + const FullPrecValue& psiCurrent, + const std::vector& Coeff, + const std::vector& C2node_up, + const std::vector& 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& detData_up, + const std::vector>& lookup_tbl) { if (isOptimizable()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateDerivativesWF " - "must be overloaded when the SPOSet is optimizable."); + "must be overloaded when the SPOSetT is optimizable."); } -void SPOSet::evaluateGradSource(const ParticleSet& P, - int first, - int last, - const ParticleSet& source, - int iat_src, - GradMatrix& gradphi) +template +void SPOSetT::evaluateGradSource(const ParticleSet& P, + int first, + int last, + const ParticleSet& source, + int iat_src, + GradMatrix& gradphi) { if (hasIonDerivs()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateGradSource " - "must be overloaded when the SPOSet has ion derivatives."); + "must be overloaded when the SPOSetT has ion derivatives."); } -void SPOSet::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) +template +void SPOSetT::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) { if (hasIonDerivs()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateGradSource " - "must be overloaded when the SPOSet has ion derivatives."); + "must be overloaded when the SPOSetT has ion derivatives."); } -void SPOSet::evaluateGradSourceRow(const ParticleSet& P, - int iel, - const ParticleSet& source, - int iat_src, - GradVector& gradphi) +template +void SPOSetT::evaluateGradSourceRow(const ParticleSet& P, + int iel, + const ParticleSet& source, + int iat_src, + GradVector& gradphi) { if (hasIonDerivs()) throw std::logic_error("Bug!! " + getClassName() + "::evaluateGradSourceRow " - "must be overloaded when the SPOSet has ion derivatives."); + "must be overloaded when the SPOSetT has ion derivatives."); } -void SPOSet::evaluate_spin(const ParticleSet& P, int iat, ValueVector& psi, ValueVector& dpsi) +template +void SPOSetT::evaluate_spin(const ParticleSet& P, int iat, ValueVector& psi, ValueVector& dpsi) { throw std::runtime_error("Need specialization of " + getClassName() + "::evaluate_spin(P,iat,psi,dpsi) (vector quantities)\n"); } +#if !defined(MIXED_PRECISION) +template class SPOSetT; +template class SPOSetT>; +#endif +template class SPOSetT; +template class SPOSetT>; + } // namespace qmcplusplus diff --git a/src/QMCWaveFunctions/SPOSet.h b/src/QMCWaveFunctions/SPOSet.h index 4f7c8e8175..d86ba0a3c3 100644 --- a/src/QMCWaveFunctions/SPOSet.h +++ b/src/QMCWaveFunctions/SPOSet.h @@ -32,10 +32,12 @@ namespace qmcplusplus { class ResourceCollection; -class SPOSet; +template +class SPOSetT; namespace testing { -opt_variables_type& getMyVars(SPOSet& spo); +template +opt_variables_type& getMyVars(SPOSetT& spo); } @@ -44,31 +46,47 @@ opt_variables_type& getMyVars(SPOSet& spo); * SPOSet stands for S(ingle)P(article)O(rbital)Set which contains * a number of single-particle orbitals with capabilities of evaluating \f$ \psi_j({\bf r}_i)\f$ */ -class SPOSet : public QMCTraits +template +class SPOSetT { public: - using ValueVector = OrbitalSetTraits::ValueVector; - using ValueMatrix = OrbitalSetTraits::ValueMatrix; - using GradVector = OrbitalSetTraits::GradVector; - using GradMatrix = OrbitalSetTraits::GradMatrix; - using HessVector = OrbitalSetTraits::HessVector; - using HessMatrix = OrbitalSetTraits::HessMatrix; - using GGGVector = OrbitalSetTraits::GradHessVector; - using GGGMatrix = OrbitalSetTraits::GradHessMatrix; - using SPOMap = std::map>; - using OffloadMWVGLArray = Array>; // [VGL, walker, Orbs] - using OffloadMWVArray = Array>; // [walker, Orbs] + enum + { + DIM = OHMMS_DIM, + DIM_VGL = OHMMS_DIM + 2 // Value(1) + Gradients(OHMMS_DIM) + Laplacian(1) + }; + using PosType = QMCTraits::QTBase::PosType; + using IndexType = QMCTraits::IndexType; + using RealType = typename OrbitalSetTraits::RealType; + using Complex = std::complex; + using ComplexType = Complex; + using Value = VALUE; + using ValueType = Value; + using FullPrecValue = ValueAlias; + using Grad = typename OrbitalSetTraits::GradType; + using GradType = Grad; + using ValueVector = typename OrbitalSetTraits::ValueVector; + using ValueMatrix = typename OrbitalSetTraits::ValueMatrix; + using GradVector = typename OrbitalSetTraits::GradVector; + using GradMatrix = typename OrbitalSetTraits::GradMatrix; + using HessVector = typename OrbitalSetTraits::HessVector; + using HessMatrix = typename OrbitalSetTraits::HessMatrix; + using GGGVector = typename OrbitalSetTraits::GradHessVector; + using GGGMatrix = typename OrbitalSetTraits::GradHessMatrix; + using SPOMap = std::map>; + using OffloadMWVGLArray = Array>; // [VGL, walker, Orbs] + using OffloadMWVArray = Array>; // [walker, Orbs] template using OffloadMatrix = Matrix>; /** constructor */ - SPOSet(const std::string& my_name); + SPOSetT(const std::string& my_name); /** destructor * * Derived class destructor needs to pay extra attention to freeing memory shared among clones of SPOSet. */ - virtual ~SPOSet() = default; + virtual ~SPOSetT() = default; /** return the size of the orbital set * Ye: this needs to be replaced by getOrbitalSetSize(); @@ -121,56 +139,57 @@ class SPOSet : public QMCTraits /// Parameter derivatives of the wavefunction and the Laplacian of the wavefunction virtual void evaluateDerivatives(ParticleSet& P, const opt_variables_type& optvars, - Vector& dlogpsi, - Vector& dhpsioverpsi, + Vector& dlogpsi, + Vector& dhpsioverpsi, const int& FirstIndex, const int& LastIndex); /// Parameter derivatives of the wavefunction virtual void evaluateDerivativesWF(ParticleSet& P, const opt_variables_type& optvars, - Vector& dlogpsi, + Vector& dlogpsi, int FirstIndex, int LastIndex); /** 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 */ - virtual void evaluateDerivatives(ParticleSet& P, - const opt_variables_type& optvars, - Vector& dlogpsi, - Vector& dhpsioverpsi, - const ValueType& psiCurrent, - const std::vector& Coeff, - const std::vector& C2node_up, - const std::vector& 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& detData_up, - const size_t N1, - const size_t N2, - const size_t NP1, - const size_t NP2, - const std::vector>& lookup_tbl); + virtual void evaluateDerivatives( + ParticleSet& P, + const opt_variables_type& optvars, + Vector& dlogpsi, + Vector& dhpsioverpsi, + const Value& psiCurrent, //FIXME, why is this full precision as in evaluateDerivativesWF + const std::vector& Coeff, + const std::vector& C2node_up, + const std::vector& 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& detData_up, + const size_t N1, + const size_t N2, + const size_t NP1, + const size_t NP2, + const std::vector>& 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 */ virtual void evaluateDerivativesWF(ParticleSet& P, const opt_variables_type& optvars, - Vector& dlogpsi, - const QTFull::ValueType& psiCurrent, - const std::vector& Coeff, + Vector& dlogpsi, + const FullPrecValue& psiCurrent, //FIXME it is still a compile time type + const std::vector& Coeff, const std::vector& C2node_up, const std::vector& C2node_dn, const ValueVector& detValues_up, @@ -205,7 +224,7 @@ class SPOSet : public QMCTraits virtual void evaluateDetRatios(const VirtualParticleSet& VP, ValueVector& psi, const ValueVector& psiinv, - std::vector& ratios); + std::vector& ratios); /// Determinant ratios and parameter derivatives of the wavefunction for virtual moves @@ -213,8 +232,8 @@ class SPOSet : public QMCTraits const opt_variables_type& optvars, ValueVector& psi, const ValueVector& psiinv, - std::vector& ratios, - Matrix& dratios, + std::vector& ratios, + Matrix& dratios, int FirstIndex, int LastIndex); @@ -226,11 +245,11 @@ class SPOSet : public QMCTraits * @param invRow_ptr_list a list of pointers to the rows of inverse slater matrix corresponding to the particles moved virtually * @param ratios_list a list of returning determinant ratios */ - virtual void mw_evaluateDetRatios(const RefVectorWithLeader& spo_list, + virtual void mw_evaluateDetRatios(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& vp_list, const RefVector& psi_list, - const std::vector& invRow_ptr_list, - std::vector>& ratios_list) const; + const std::vector& invRow_ptr_list, + std::vector>& ratios_list) const; /** evaluate the values, gradients and laplacians of this single-particle orbital set * @param P current ParticleSet @@ -262,7 +281,7 @@ class SPOSet : public QMCTraits * @param iat active particle * @param psi_v_list the list of value vector pointers in a walker batch */ - virtual void mw_evaluateValue(const RefVectorWithLeader& spo_list, + virtual void mw_evaluateValue(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& P_list, int iat, const RefVector& psi_v_list) const; @@ -275,7 +294,7 @@ class SPOSet : public QMCTraits * @param dpsi_v_list the list of gradient vector pointers in a walker batch * @param d2psi_v_list the list of laplacian vector pointers in a walker batch */ - virtual void mw_evaluateVGL(const RefVectorWithLeader& spo_list, + virtual void mw_evaluateVGL(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& P_list, int iat, const RefVector& psi_v_list, @@ -292,13 +311,13 @@ class SPOSet : public QMCTraits * @param mw_dspin is a dual matrix of spin gradients [nw][norb] * Note that the device side of mw_dspin is up to date */ - virtual void mw_evaluateVGLWithSpin(const RefVectorWithLeader& spo_list, + virtual void mw_evaluateVGLWithSpin(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& P_list, int iat, const RefVector& psi_v_list, const RefVector& dpsi_v_list, const RefVector& d2psi_v_list, - OffloadMatrix& mw_dspin) const; + OffloadMatrix& mw_dspin) const; /** 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 @@ -308,13 +327,13 @@ class SPOSet : public QMCTraits * @param phi_vgl_v orbital values, gradients and laplacians of all the walkers * @param psi_ratio_grads_v determinant ratio and grads of all the walkers */ - virtual void mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader& spo_list, + virtual void mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& P_list, int iat, - const std::vector& invRow_ptr_list, + const std::vector& invRow_ptr_list, OffloadMWVGLArray& phi_vgl_v, - std::vector& ratios, - std::vector& grads) const; + std::vector& ratios, + std::vector& grads) const; /** 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. @@ -327,14 +346,14 @@ class SPOSet : public QMCTraits * @param grads, spatial gradients of all walkers * @param spingrads, spin gradients of all walkers */ - virtual void mw_evaluateVGLandDetRatioGradsWithSpin(const RefVectorWithLeader& spo_list, + virtual void mw_evaluateVGLandDetRatioGradsWithSpin(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& P_list, int iat, - const std::vector& invRow_ptr_list, + const std::vector& invRow_ptr_list, OffloadMWVGLArray& phi_vgl_v, - std::vector& ratios, - std::vector& grads, - std::vector& spingrads) const; + std::vector& ratios, + std::vector& grads, + std::vector& spingrads) const; /** evaluate the values, gradients and hessians of this single-particle orbital set * @param P current ParticleSet @@ -415,7 +434,7 @@ class SPOSet : public QMCTraits ValueMatrix& d2logdet, ValueMatrix& dspinlogdet); - virtual void mw_evaluate_notranspose(const RefVectorWithLeader& spo_list, + virtual void mw_evaluate_notranspose(const RefVectorWithLeader& spo_list, const RefVectorWithLeader& P_list, int first, int last, @@ -517,16 +536,16 @@ class SPOSet : public QMCTraits /** acquire a shared resource from collection */ - virtual void acquireResource(ResourceCollection& collection, const RefVectorWithLeader& spo_list) const {} + virtual void acquireResource(ResourceCollection& collection, const RefVectorWithLeader& spo_list) const {} /** return a shared resource to collection */ - virtual void releaseResource(ResourceCollection& collection, const RefVectorWithLeader& spo_list) const {} + virtual void releaseResource(ResourceCollection& collection, const RefVectorWithLeader& spo_list) const {} /** make a clone of itself * every derived class must implement this to have threading working correctly. */ - [[noreturn]] virtual std::unique_ptr makeClone() const; + [[noreturn]] virtual std::unique_ptr> makeClone() const; /** Used only by cusp correction in AOS LCAO. * Ye: the SoA LCAO moves all this responsibility to the builder. @@ -555,10 +574,17 @@ class SPOSet : public QMCTraits /// Optimizable variables opt_variables_type myVars; - friend opt_variables_type& testing::getMyVars(SPOSet& spo); + friend opt_variables_type& testing::getMyVars(SPOSetT& spo); }; -using SPOSetPtr = SPOSet*; +#if !defined(MIXED_PRECISION) +extern template class SPOSetT; +extern template class SPOSetT>; +#endif +extern template class SPOSetT; +extern template class SPOSetT>; +using SPOSet = SPOSetT; +using SPOSetPtr = SPOSet*; } // namespace qmcplusplus #endif diff --git a/src/QMCWaveFunctions/tests/FakeSPO.cpp b/src/QMCWaveFunctions/tests/FakeSPO.cpp index 5d572dd7f0..55fd1a9889 100644 --- a/src/QMCWaveFunctions/tests/FakeSPO.cpp +++ b/src/QMCWaveFunctions/tests/FakeSPO.cpp @@ -15,7 +15,8 @@ namespace qmcplusplus { -FakeSPO::FakeSPO() : SPOSet("one_FakeSPO") +template +FakeSPO::FakeSPO() : SPOSet("one_FakeSPO") { a.resize(3, 3); @@ -78,11 +79,20 @@ FakeSPO::FakeSPO() : SPOSet("one_FakeSPO") gv[3] = TinyVector(0.4, 0.3, 0.1); } -std::unique_ptr FakeSPO::makeClone() const { return std::make_unique(*this); } +template +std::unique_ptr> FakeSPO::makeClone() const +{ + return std::make_unique(*this); +} -void FakeSPO::setOrbitalSetSize(int norbs) { OrbitalSetSize = norbs; } +template +void FakeSPO::setOrbitalSetSize(int norbs) +{ + OrbitalSetSize = norbs; +} -void FakeSPO::evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) +template +void FakeSPO::evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) { if (iat < 0) for (int i = 0; i < psi.size(); i++) @@ -95,7 +105,8 @@ void FakeSPO::evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) psi[i] = a2(iat, i); } -void FakeSPO::evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, ValueVector& d2psi) +template +void FakeSPO::evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, ValueVector& d2psi) { if (OrbitalSetSize == 3) { @@ -115,12 +126,13 @@ void FakeSPO::evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradV } } -void FakeSPO::evaluate_notranspose(const ParticleSet& P, - int first, - int last, - ValueMatrix& logdet, - GradMatrix& dlogdet, - ValueMatrix& d2logdet) +template +void FakeSPO::evaluate_notranspose(const ParticleSet& P, + int first, + int last, + ValueMatrix& logdet, + GradMatrix& dlogdet, + ValueMatrix& d2logdet) { if (OrbitalSetSize == 3) { @@ -142,4 +154,11 @@ void FakeSPO::evaluate_notranspose(const ParticleSet& P, } } +#if !defined(MIXED_PRECISION) +template class FakeSPO; +template class FakeSPO>; +#endif +template class FakeSPO; +template class FakeSPO>; + } // namespace qmcplusplus diff --git a/src/QMCWaveFunctions/tests/FakeSPO.h b/src/QMCWaveFunctions/tests/FakeSPO.h index 5f8a328284..7d5a8a13c1 100644 --- a/src/QMCWaveFunctions/tests/FakeSPO.h +++ b/src/QMCWaveFunctions/tests/FakeSPO.h @@ -18,15 +18,28 @@ namespace qmcplusplus { -class FakeSPO : public SPOSet +template +class FakeSPO : public SPOSetT { public: + enum + { + DIM = OHMMS_DIM, + }; + using SPOSet = SPOSetT; + using ValueType = typename SPOSet::ValueType; + using GradType = typename SPOSet::GradType; + using ValueVector = typename SPOSet::ValueVector; + using GradVector = typename SPOSet::GradVector; + using ValueMatrix = typename SPOSet::ValueMatrix; + using GradMatrix = typename SPOSet::GradMatrix; + Matrix a; Matrix a2; Vector v; Matrix v2; - SPOSet::GradVector gv; + GradVector gv; FakeSPO(); ~FakeSPO() override {} @@ -47,7 +60,17 @@ class FakeSPO : public SPOSet ValueMatrix& logdet, GradMatrix& dlogdet, ValueMatrix& d2logdet) override; + +private: + using SPOSet::OrbitalSetSize; }; +#if !defined(MIXED_PRECISION) +extern template class FakeSPO; +extern template class FakeSPO>; +#endif +extern template class FakeSPO; +extern template class FakeSPO>; + } // namespace qmcplusplus #endif diff --git a/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp b/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp index 7a4de1225a..fa0de4cfeb 100644 --- a/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp +++ b/src/QMCWaveFunctions/tests/test_DiracDeterminant.cpp @@ -51,11 +51,11 @@ void check_matrix(Matrix& a, Matrix& b) template void test_DiracDeterminant_first(const DetMatInvertor inverter_kind) { - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 3; spo_init->setOrbitalSetSize(norb); DET ddb(std::move(spo_init), 0, norb, 1, inverter_kind); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -159,11 +159,11 @@ TEST_CASE("DiracDeterminant_first", "[wavefunction][fermion]") template void test_DiracDeterminant_second(const DetMatInvertor inverter_kind) { - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); DET ddb(std::move(spo_init), 0, norb, 1, inverter_kind); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -300,12 +300,12 @@ TEST_CASE("DiracDeterminant_second", "[wavefunction][fermion]") template void test_DiracDeterminant_delayed_update(const DetMatInvertor inverter_kind) { - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); // maximum delay 2 DET ddc(std::move(spo_init), 0, norb, 2, inverter_kind); - auto spo = dynamic_cast(ddc.getPhi()); + auto spo = dynamic_cast*>(ddc.getPhi()); // occurs in call to registerData ddc.dpsiV.resize(norb); diff --git a/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp b/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp index 4ce591df94..c53130dc38 100644 --- a/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp +++ b/src/QMCWaveFunctions/tests/test_DiracDeterminantBatched.cpp @@ -37,11 +37,11 @@ template void test_DiracDeterminantBatched_first() { using DetType = DiracDeterminantBatched; - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 3; spo_init->setOrbitalSetSize(norb); DetType ddb(std::move(spo_init), 0, norb); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -141,11 +141,11 @@ template void test_DiracDeterminantBatched_second() { using DetType = DiracDeterminantBatched; - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); DetType ddb(std::move(spo_init), 0, norb); - auto spo = dynamic_cast(ddb.getPhi()); + auto spo = dynamic_cast*>(ddb.getPhi()); // occurs in call to registerData ddb.dpsiV.resize(norb); @@ -277,11 +277,11 @@ template void test_DiracDeterminantBatched_delayed_update(int delay_rank, DetMatInvertor matrix_inverter_kind) { using DetType = DiracDeterminantBatched; - auto spo_init = std::make_unique(); + auto spo_init = std::make_unique>(); const int norb = 4; spo_init->setOrbitalSetSize(norb); DetType ddc(std::move(spo_init), 0, norb, delay_rank, matrix_inverter_kind); - auto spo = dynamic_cast(ddc.getPhi()); + auto spo = dynamic_cast*>(ddc.getPhi()); // occurs in call to registerData ddc.dpsiV.resize(norb); diff --git a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp index af6f5b9cf0..8b9065badc 100644 --- a/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp +++ b/src/QMCWaveFunctions/tests/test_RotatedSPOs.cpp @@ -644,7 +644,8 @@ TEST_CASE("RotatedSPOs construct delta matrix", "[wavefunction]") namespace testing { -opt_variables_type& getMyVars(SPOSet& rot) { return rot.myVars; } +template +opt_variables_type& getMyVars(SPOSetT& rot) { return rot.myVars; } opt_variables_type& getMyVarsFull(RotatedSPOs& rot) { return rot.myVarsFull; } std::vector>& getHistoryParams(RotatedSPOs& rot) { return rot.history_params_; } } // namespace testing @@ -652,7 +653,7 @@ std::vector>& getHistoryParams(RotatedSPOs& rot // Test using global rotation TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") { - auto fake_spo = std::make_unique(); + auto fake_spo = std::make_unique>(); fake_spo->setOrbitalSetSize(4); RotatedSPOs rot("fake_rot", std::move(fake_spo)); int nel = 2; @@ -673,7 +674,7 @@ TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") rot.writeVariationalParameters(hout); } - auto fake_spo2 = std::make_unique(); + auto fake_spo2 = std::make_unique>(); fake_spo2->setOrbitalSetSize(4); RotatedSPOs rot2("fake_rot", std::move(fake_spo2)); @@ -704,7 +705,7 @@ TEST_CASE("RotatedSPOs read and write parameters", "[wavefunction]") // Test using history list. TEST_CASE("RotatedSPOs read and write parameters history", "[wavefunction]") { - auto fake_spo = std::make_unique(); + auto fake_spo = std::make_unique>(); fake_spo->setOrbitalSetSize(4); RotatedSPOs rot("fake_rot", std::move(fake_spo)); rot.set_use_global_rotation(false); @@ -726,7 +727,7 @@ TEST_CASE("RotatedSPOs read and write parameters history", "[wavefunction]") rot.writeVariationalParameters(hout); } - auto fake_spo2 = std::make_unique(); + auto fake_spo2 = std::make_unique>(); fake_spo2->setOrbitalSetSize(4); RotatedSPOs rot2("fake_rot", std::move(fake_spo2)); diff --git a/src/QMCWaveFunctions/tests/test_einset.cpp b/src/QMCWaveFunctions/tests/test_einset.cpp index 8dd00c2621..0ad9e2dedd 100644 --- a/src/QMCWaveFunctions/tests/test_einset.cpp +++ b/src/QMCWaveFunctions/tests/test_einset.cpp @@ -441,7 +441,7 @@ TEST_CASE("Einspline SPO from HDF diamond_2x1x1 5 electrons", "[wavefunction]") std::vector inv_row_ptr(nw, inv_row.device_data()); SPOSet::OffloadMWVGLArray phi_vgl_v; - phi_vgl_v.resize(QMCTraits::DIM_VGL, nw, 5); + phi_vgl_v.resize(SPOSet::DIM_VGL, nw, 5); spo->mw_evaluateVGLandDetRatioGrads(spo_list, p_list, 0, inv_row_ptr, phi_vgl_v, ratio_v, grads_v); #if !defined(QMC_COMPLEX) CHECK(std::real(ratio_v[0]) == Approx(0.2365307168)); diff --git a/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp b/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp index 6642f86761..b44ad328d9 100644 --- a/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp +++ b/src/QMCWaveFunctions/tests/test_einset_NiO_a16.cpp @@ -242,7 +242,7 @@ TEST_CASE("Einspline SPO from HDF NiO a16 97 electrons", "[wavefunction]") std::vector inv_row_ptr(nw, inv_row.device_data()); SPOSet::OffloadMWVGLArray phi_vgl_v; - phi_vgl_v.resize(QMCTraits::DIM_VGL, nw, 5); + phi_vgl_v.resize(SPOSet::DIM_VGL, nw, 5); spo->mw_evaluateVGLandDetRatioGrads(spo_list, p_list, 0, inv_row_ptr, phi_vgl_v, ratio_v, grads_v); phi_vgl_v.updateFrom(); #if !defined(QMC_COMPLEX)