28 std::vector<std::unique_ptr<Determinant_t>> dets,
29 const std::string& class_name)
30 : Dets(
std::move(dets))
35 for (
int i = 0; i <
Last.size(); ++i)
44 return std::any_of(
Dets.begin(),
Dets.end(), [](
const auto&
det) {
return det->isOptimizable(); });
49 for (
int i = 0; i <
Dets.size(); i++)
57 for (
int i = 0; i <
Dets.size(); i++)
59 Dets[i]->checkOutVariables(active);
72 return Dets[
getDetID(iat)]->ratioGradWithSpin(P, iat, grad_iat, spingrad_iat);
78 std::vector<PsiValue>& ratios,
79 std::vector<GradType>& grad_now)
const 88 std::vector<PsiValue>& ratios,
89 std::vector<GradType>& grad_now,
90 std::vector<ComplexType>& spingrad_now)
const 101 std::vector<GradType>& grad_now,
102 std::vector<ComplexType>& spingrad_now)
const 110 for (
int i = 0; i <
Dets.size(); ++i)
116 std::vector<ValueType>& ratios,
127 for (
int i = 0; i <
Dets.size(); ++i)
139 for (
int iw = 0; iw < wfc_list.size(); iw++)
142 for (
int i = 0; i <
Dets.size(); ++i)
145 Dets[i]->mw_evaluateLog(Det_list, p_list, G_list, L_list);
146 for (
int iw = 0; iw < wfc_list.size(); iw++)
157 for (
int i = 0; i <
Dets.size(); ++i)
166 bool fromscratch)
const 170 for (
int iw = 0; iw < wfc_list.size(); iw++)
173 for (
int i = 0; i <
Dets.size(); ++i)
176 Dets[i]->mw_evaluateGL(Det_list, p_list, G_list, L_list, fromscratch);
177 for (
int iw = 0; iw < wfc_list.size(); iw++)
184 for (
int i = 0; i <
Dets.size(); ++i)
190 const std::vector<bool>& recompute)
const 192 for (
int i = 0; i <
Dets.size(); ++i)
204 for (
int i = 0; i <
Dets.size(); ++i)
207 Dets[i]->evaluateHessian(P, tmp);
211 grad_grad_psi += tmp;
217 for (
int i = 0; i <
Dets.size(); ++i)
224 for (
int i = 0; i <
Dets.size(); ++i)
227 Dets[i]->acquireResource(collection, det_list);
234 for (
int i = 0; i <
Dets.size(); ++i)
237 Dets[i]->releaseResource(collection, det_list);
244 for (
int i = 0; i <
Dets.size(); ++i)
253 for (
int i = 0; i <
Dets.size(); ++i)
262 for (
int i = 0; i <
Dets.size(); i++)
269 std::vector<std::unique_ptr<Determinant_t>> dets;
271 dets.emplace_back(
det->makeCopy(
det->getPhi()->makeClone()));
272 auto myclone = std::make_unique<SlaterDet>(tqp, std::move(dets));
279 for (
int i = 0; i <
Dets.size(); ++i)
281 Dets[i]->registerTWFFastDerivWrapper(P,
twf);
void evaluateHessian(ParticleSet &P, HessVector &grad_grad_psi) override
void checkOutVariables(const opt_variables_type &active) override
check out variational optimizable variables
LogValue evaluateGL(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, bool fromscratch) override
compute gradients and laplacian of the TWF with respect to each particle.
void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios) override
evaluate ratios to evaluate the non-local PP
WaveFunctionComponent::PsiValue PsiValue
helper functions for EinsplineSetBuilder
std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const override
make clone
Tensor< T, D >::Type_t det(const Tensor< T, D > &a)
void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs) override
extract underlying OptimizableObject references
size_t getTotalNum() const
void registerData(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
constexpr std::complex< float > czero
void mw_ratioGradWithSpin(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_now, std::vector< ComplexType > &spingrad_now) const override
compute the ratio of the new to old WaveFunctionComponent value and the new gradient/spingradient of ...
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
int getDetID(const int iat) const
int refPtcl
Reference particle.
QTBase::ComplexType ComplexType
const std::vector< std::unique_ptr< Determinant_t > > Dets
container for the DiracDeterminants
void createResource(ResourceCollection &collection) const override
initialize a shared resource and hand it to a collection
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
void mw_evaluateLog(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< ParticleSet::ParticleGradient > &G_list, const RefVector< ParticleSet::ParticleLaplacian > &L_list) const override
evaluate from scratch the same type WaveFunctionComponent of multiple walkers
opt_variables_type myVars
list of variables this WaveFunctionComponent handles
std::complex< QTFull::RealType > LogValue
void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios) override
evaluate the ratios of one virtual move with respect to all the particles
int groups() const
return the number of groups
Specialized paritlce class for atomistic simulations.
LogValue updateBuffer(ParticleSet &P, WFBufferType &buf, bool fromscratch=false) override
For particle-by-particle move.
void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
return a shared resource to a collection
PsiValue ratioGradWithSpin(ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new spin gradient Default im...
RefVectorWithLeader< WaveFunctionComponent > extract_DetRef_list(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, int det_id) const
void recompute(const ParticleSet &P) override
recompute the value of the WaveFunctionComponents which require critical accuracy.
void registerTWFFastDerivWrapper(const ParticleSet &P, TWFFastDerivWrapper &twf) const override
Register the component with the TWFFastDerivWrapper wrapper.
void mw_ratioGrad(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_now) const override
compute the ratio of the new to old WaveFunctionComponent value and the new gradient of multiple walk...
CASTTYPE & getCastedElement(size_t i) const
class to handle a set of variables that can be modified during optimizations
PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat) override
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
bool isOptimizable() const override
if true, this contains optimizable components
void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const override
acquire a shared resource from a collection
int last(int igroup) const
return the last index of a group i
QTFull::ValueType PsiValue
#define DEBUG_PSIBUFFER(who, msg)
void clear()
clear the variable set
LogValue log_value_
Current .
~SlaterDet() override
destructor
size_type current() const
std::vector< std::reference_wrapper< T > > RefVector
std::vector< int > Last
the last particle of each group
void mw_evalGradWithSpin(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< GradType > &grad_now, std::vector< ComplexType > &spingrad_now) const override
compute the current gradients and spin gradients for the iat-th particle of multiple walkers ...
OrbitalSetTraits< ValueType >::HessVector HessVector
void mw_recompute(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const override
void insertFrom(const VariableSet &input)
insert a VariableSet to the list
void mw_evaluateGL(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< ParticleSet::ParticleGradient > &G_list, const RefVector< ParticleSet::ParticleLaplacian > &L_list, bool fromscratch) const override
evaluate gradients and laplacian of the same type WaveFunctionComponent of multiple walkers ...
SlaterDet(ParticleSet &targetPtcl, std::vector< std::unique_ptr< Determinant_t >> dets, const std::string &class_name="SlaterDet")
constructor
LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L) override
evaluate the value of the WaveFunctionComponent from scratch
void copyFromBuffer(ParticleSet &P, WFBufferType &buf) override
For particle-by-particle move.
int getIndex(const std::string &vname) const
return the Index vaule for the named parameter