26 : UpdateMode(ORB_WALKER), Bytes_in_WFBuffer(0), my_name_(obj_name), log_value_(0.0)
37 for (
int iw = 0; iw < wfc_list.size(); iw++)
38 wfc_list[iw].
evaluateLog(p_list[iw], G_list[iw], L_list[iw]);
51 const std::vector<bool>& recompute)
const 54 for (
int iw = 0; iw < wfc_list.size(); iw++)
56 wfc_list[iw].recompute(p_list[iw]);
64 for (
int iw = 0; iw < wfc_list.size(); iw++)
68 template<CoordsType CT>
77 mw_evalGrad(wfc_list, p_list, iat, grad_now.grads_positions);
83 std::vector<GradType>& grad_now)
const 86 for (
int iw = 0; iw < wfc_list.size(); iw++)
87 grad_now[iw] = wfc_list[iw].
evalGrad(p_list[iw], iat);
93 std::vector<GradType>& grad_now,
94 std::vector<ComplexType>& spingrad_now)
const 97 for (
int iw = 0; iw < wfc_list.size(); iw++)
100 grad_now[iw] = wfc_list[iw].evalGradWithSpin(p_list[iw], iat, spingrad_now[iw]);
107 std::vector<PsiValue>& ratios)
const 110 for (
int iw = 0; iw < wfc_list.size(); iw++)
111 ratios[iw] = wfc_list[iw].
ratio(p_list[iw], iat);
121 template<CoordsType CT>
125 std::vector<PsiValue>& ratios,
129 mw_ratioGradWithSpin(wfc_list, p_list, iat, ratios, grad_new.grads_positions, grad_new.grads_spins);
131 mw_ratioGrad(wfc_list, p_list, iat, ratios, grad_new.grads_positions);
137 std::vector<PsiValue>& ratios,
138 std::vector<GradType>& grad_new)
const 141 for (
int iw = 0; iw < wfc_list.size(); iw++)
142 ratios[iw] = wfc_list[iw].
ratioGrad(p_list[iw], iat, grad_new[iw]);
148 std::vector<PsiValue>& ratios,
149 std::vector<GradType>& grad_new,
150 std::vector<ComplexType>& spingrad_new)
const 153 for (
int iw = 0; iw < wfc_list.size(); iw++)
154 ratios[iw] = wfc_list[iw].
ratioGradWithSpin(p_list[iw], iat, grad_new[iw], spingrad_new[iw]);
160 const std::vector<bool>& isAccepted,
161 bool safe_to_delay)
const 164 for (
int iw = 0; iw < wfc_list.size(); iw++)
166 wfc_list[iw].acceptMove(p_list[iw], iat, safe_to_delay);
168 wfc_list[iw].restore(iat);
174 for (
int iw = 0; iw < wfc_list.size(); iw++)
190 bool fromscratch)
const 193 for (
int iw = 0; iw < wfc_list.size(); iw++)
194 wfc_list[iw].
evaluateGL(p_list[iw], G_list[iw], L_list[iw], fromscratch);
201 "::extractOptimizableObjectRefs " 202 "must be overloaded when the WFC is optimizable.");
209 "::checkOutVariables " 210 "must be overloaded when the WFC is optimizable.");
217 throw std::runtime_error(
"WaveFunctionComponent::evaluateDerivativesWF is not implemented by " +
getClassName());
226 return std::unique_ptr<WaveFunctionComponent>();
235 ratios[i] =
ratio(P, i);
240 std::ostringstream o;
241 o <<
"WaveFunctionComponent::evaluateRatios is not implemented by " <<
getClassName();
252 std::vector<std::vector<ValueType>>& ratios)
const 255 for (
int iw = 0; iw < wfc_list.size(); iw++)
261 std::vector<ValueType>& ratios,
270 std::ostringstream o;
271 o <<
"WaveFunctionComponent::registerTWFFastDerivWrapper is not implemented by " <<
getClassName();
275 template void WaveFunctionComponent::mw_evalGrad<CoordsType::POS>(
280 template void WaveFunctionComponent::mw_evalGrad<CoordsType::POS_SPIN>(
285 template void WaveFunctionComponent::mw_ratioGrad<CoordsType::POS>(
289 std::vector<PsiValue>& ratios,
291 template void WaveFunctionComponent::mw_ratioGrad<CoordsType::POS_SPIN>(
295 std::vector<PsiValue>& ratios,
virtual bool isOptimizable() const
if true, this contains optimizable components
virtual LogValue evaluateLog(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L)=0
evaluate the value of the WaveFunctionComponent from scratch
virtual void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios)
evaluate ratios to evaluate the non-local PP
WaveFunctionComponent::PsiValue PsiValue
helper functions for EinsplineSetBuilder
virtual void mw_prepareGroup(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int ig) const
virtual void mw_recompute(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< bool > &recompute) const
QTBase::RealType RealType
virtual void registerTWFFastDerivWrapper(const ParticleSet &P, TWFFastDerivWrapper &twf) const
Register the component with the TWFFastDerivWrapper wrapper.
virtual void recompute(const ParticleSet &P)
recompute the value of the WaveFunctionComponents which require critical accuracy.
virtual std::string getClassName() const =0
return class name
size_t getTotalNum() const
virtual LogValue evaluateGL(const ParticleSet &P, ParticleSet::ParticleGradient &G, ParticleSet::ParticleLaplacian &L, bool fromscratch)
compute gradients and laplacian of the TWF with respect to each particle.
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
void mw_evalGrad(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, const int iat, TWFGrads< CT > &grads_now) const
compute the current gradients for the iat-th particle of multiple walkers
virtual 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
evaluate gradients and laplacian of the same type WaveFunctionComponent of multiple walkers ...
std::complex< QTFull::RealType > LogValue
virtual void mw_ratioGradWithSpin(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, std::vector< GradType > &grad_new, std::vector< ComplexType > &spingrad_new) const
compute the ratio of the new to old WaveFunctionComponent value and the new gradient/spingradient of ...
Specialized paritlce class for atomistic simulations.
virtual void checkOutVariables(const opt_variables_type &active)
check out variational optimizable variables
QTBase::ValueType ValueType
virtual void mw_completeUpdates(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list) const
complete all the delayed or asynchronous operations for all the walkers in a batch before leaving the...
class to handle a set of variables that can be modified during optimizations
virtual 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
compute the current gradients and spin gradients for the iat-th particle of multiple walkers ...
virtual GradType evalGrad(ParticleSet &P, int iat)
return the current gradient for the iat-th particle
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
QTFull::ValueType PsiValue
virtual void evaluateSpinorRatios(const VirtualParticleSet &VP, const std::pair< ValueVector, ValueVector > &spinor_multiplier, std::vector< ValueType > &ratios)
Used by SOECPComponent for faster SOC evaluation.
virtual void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi)
Compute the derivatives of the log of the wavefunction with respect to optimizable parameters...
virtual PsiValue ratio(ParticleSet &P, int iat)=0
evaluate the ratio of the new to old WaveFunctionComponent value
virtual void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios)
evaluate ratios to evaluate the non-local PP
virtual void prepareGroup(ParticleSet &P, int ig)
Prepare internal data for updating WFC correspond to a particle group It should be called before movi...
virtual void mw_accept_rejectMove(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool safe_to_delay=false) const
moves of the iat-th particle on some walkers in a batch is accepted.
std::vector< std::reference_wrapper< T > > RefVector
virtual void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs)
extract underlying OptimizableObject references
virtual 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
evaluate from scratch the same type WaveFunctionComponent of multiple walkers
void mw_ratioGrad(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CT > &grad_new) const
virtual void mw_evaluateRatios(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, std::vector< std::vector< ValueType >> &ratios) const
evaluate ratios to evaluate the non-local PP multiple walkers
virtual PsiValue ratioGradWithSpin(ParticleSet &P, int iat, GradType &grad_iat, ComplexType &spingrad_iat)
evaluate the ratio of the new to old WaveFunctionComponent value and the new spin gradient Default im...
virtual PsiValue ratioGrad(ParticleSet &P, int iat, GradType &grad_iat)
evaluate the ratio of the new to old WaveFunctionComponent value and the new gradient ...
virtual void completeUpdates()
complete all the delayed or asynchronous operations before leaving the p-by-p move region...
WaveFunctionComponent(const std::string &obj_name="")
default constructor
Declaration of WaveFunctionComponent.
virtual void mw_calcRatio(const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios) const
compute the ratio of the new to old WaveFunctionComponent value of multiple walkers ...
virtual void evaluateRatiosAlltoOne(ParticleSet &P, std::vector< ValueType > &ratios)
evaluate the ratios of one virtual move with respect to all the particles
virtual RealType KECorrection()
Return the Chiesa kinetic energy correction.
virtual std::unique_ptr< WaveFunctionComponent > makeClone(ParticleSet &tqp) const
make clone
virtual ~WaveFunctionComponent()
default destructor