32 for (
int i = 0; i < nl_ecpc.
nlpp_m.size(); ++i)
40 for (
int ip = 0; ip <
nlpp_m.size(); ip++)
69 wgt_angpp_m.push_back(static_cast<RealType>(2 * l + 1));
85 lpol.resize(l + 1, 1.0);
88 dlpol.resize(l + 2, 0.0);
102 APP_ABORT(
"Increase the maximum angular momentum implemented.");
106 for (
int nl = 0; nl <
lmax; nl++)
116 os <<
" Maximum angular momentum = " <<
lmax << std::endl;
117 os <<
" Number of non-local channels = " <<
nchannel << std::endl;
119 os <<
" l(" << l <<
")=" <<
angpp_m[l] << std::endl;
120 os <<
" Cutoff radius = " <<
Rmax << std::endl;
121 os <<
" Number of spherical integration grid points = " <<
nknot << std::endl;
124 os <<
" Spherical grid and weights: " << std::endl;
125 for (
int ik = 0; ik <
nknot; ik++)
152 for (
int j = 0; j <
nknot; j++)
169 for (
int j = 0; j <
nknot; j++)
173 for (
int ip = 0; ip <
nchannel; ip++)
182 for (
int j = 0; j <
nknot; j++)
188 for (
int l = 0; l <
lmax; l++)
208 std::vector<RealType>& pairpots,
212 auto& ecp_component_leader = ecp_component_list.
getLeader();
213 if (ecp_component_leader.VP)
220 vp_list.reserve(ecp_component_list.size());
221 const_vp_list.reserve(ecp_component_list.size());
222 deltaV_list.reserve(ecp_component_list.size());
223 psiratios_list.reserve(ecp_component_list.size());
225 for (
size_t i = 0; i < ecp_component_list.size(); i++)
232 vp_list.push_back(*component.
VP);
233 const_vp_list.push_back(*component.
VP);
234 deltaV_list.push_back(component.
deltaV);
235 psiratios_list.push_back(component.
psiratio);
251 for (
size_t i = 0; i < p_list.size(); i++)
261 for (
int j = 0; j < component.
getNknot(); j++)
274 for (
size_t i = 0; i < p_list.size(); i++)
295 for (
int j = 0; j <
nknot; j++)
297 100 * std::numeric_limits<RealType>::epsilon());
300 for (
int j = 0; j <
nknot; j++)
316 APP_ABORT(
"NonLocalECPComponent::evaluateOneWithForces(...): Forces not implemented with virtual particle moves\n");
324 for (
int j = 0; j <
nknot; j++)
332 #if defined(QMC_COMPLEX) 346 for (
int j = 0; j <
nknot; j++)
355 for (
int ip = 0; ip <
nchannel; ip++)
364 for (
int j = 0; j <
nknot; j++)
369 cosgrad[j] = rinv * uminusrvec;
383 for (
int l = 0; l <
lmax; l++)
392 dlpolprev =
dlpol[l];
410 force_iat += gradpotterm_ + gradlpolyterm_ - gradwfnterm_;
431 for (
int j = 0; j <
nknot; j++)
433 100 * std::numeric_limits<RealType>::epsilon());
435 for (
int j = 0; j <
nknot; j++)
454 std::vector<ParticleSet::ParticlePos> pulay_quad(
nknot);
461 for (
size_t j = 0; j <
nknot; j++)
466 APP_ABORT(
"NonLocalECPComponent::evaluateOneWithForces(...): Forces not implemented with virtual particle moves\n");
474 for (
int j = 0; j <
nknot; j++)
482 #if defined(QMC_COMPLEX) 496 for (
int j = 0; j <
nknot; j++)
505 for (
int ip = 0; ip <
nchannel; ip++)
514 for (
size_t jat = 0; jat < ions.
getTotalNum(); jat++)
518 for (
size_t j = 0; j <
nknot; j++)
546 for (
int j = 0; j <
nknot; j++)
551 cosgrad[j] = rinv * uminusrvec;
565 for (
int l = 0; l <
lmax; l++)
574 dlpolprev =
dlpol[l];
597 force_iat += gradpotterm_ + gradlpolyterm_ - gradwfnterm_;
598 pulay_terms += pulaytmp_;
610 std::vector<ValueMatrix>&
B)
618 const IndexType thisIndex = iel - firstIndex;
624 phi_row.resize(numOrbs);
625 temp_row.resize(numOrbs);
635 for (
int ip = 0; ip <
nchannel; ip++)
638 for (
int j = 0; j <
nknot; j++)
649 for (
int l = 0; l <
lmax; l++)
659 for (
int iorb = 0; iorb < numOrbs; iorb++)
660 B[sid][thisIndex][iorb] += temp_row[iorb];
673 std::vector<std::vector<ValueMatrix>>& dB)
682 for (
int j = 0; j <
nknot; j++)
684 100 * std::numeric_limits<RealType>::epsilon());
686 for (
int j = 0; j <
nknot; j++)
695 for (
int ip = 0; ip <
nchannel; ip++)
712 GradVector iongrad_phi;
722 jgrad_quad.resize(
nknot);
724 wfgradmat.resize(
nknot, norbs);
726 iongrad_phimat.resize(
nknot, norbs);
727 laplphimat.resize(
nknot, norbs);
729 phimat.resize(
nknot, norbs);
730 gradphimat.resize(
nknot, norbs);
731 iongrad_phi.resize(norbs);
733 gradphi.resize(norbs);
734 laplphi.resize(norbs);
736 GradVector udotgradpsi, wfgradrow;
738 GradVector gpot, glpoly, gwfn;
740 GradVector dlpoly_prefactor;
741 GradVector dvdr_prefactor;
743 nlpp_prefactor.resize(
nknot);
744 dlpoly_prefactor.resize(
nknot);
745 dvdr_prefactor.resize(
nknot);
747 udotgradpsimat.resize(
nknot, norbs);
748 wfgradrow.resize(norbs);
749 udotgradpsi.resize(norbs);
751 glpoly.resize(norbs);
763 for (
int j = 0; j <
nknot; j++)
772 for (
int j = 0; j <
nknot; j++)
776 spo.evaluateGradSourceRow(W, iel, ions, iat_src, iongrad_phi);
783 spo.evaluateVGL(W, iel, phi, gradphi, laplphi);
791 for (
int iorb = 0; iorb < norbs; iorb++)
794 phimat[j][iorb] = jratio * phi[iorb];
796 gradphimat[j][iorb] = jratio * (gradphi[iorb] +
GradType(jegrad) * phi[iorb]);
797 laplphimat[j][iorb] = laplphi[iorb];
800 for (
int iorb = 0; iorb < norbs; iorb++)
803 iongrad_phimat[j][iorb] = jratio * (iongrad_phi[iorb] + phi[iorb] * (
GradType(jgrad_quad[j]) - jigradref));
808 for (
int j = 0; j <
nknot; j++)
813 cosgrad[j] = rinv * uminusrvec;
824 for (
int l = 0; l <
lmax; l++)
835 dlpolprev =
dlpol[l];
850 for (
int j = 0; j <
nknot; j++)
851 for (
int iorb = 0; iorb < norbs; iorb++)
852 gwfn[iorb] += nlpp_prefactor[j] * (iongrad_phimat[j][iorb]);
856 for (
int j = 0; j <
nknot; j++)
857 for (
int iorb = 0; iorb < norbs; iorb++)
863 wfgradmat[j][iorb] = gradphimat[j][iorb] - dr * (udotgradpsimat[j][iorb] * rinv);
864 gpot[iorb] += dvdr_prefactor[j] * phimat[j][iorb];
865 glpoly[iorb] += dlpoly_prefactor[j] * phimat[j][iorb];
866 gwfn[iorb] += nlpp_prefactor[j] * (wfgradmat[j][iorb]);
869 for (
int idim = 0; idim <
OHMMS_DIM; idim++)
870 for (
int iorb = 0; iorb < norbs; iorb++)
871 dB[idim][sid][thisEIndex][iorb] +=
RealType(-1.0) * gpot[iorb][idim] - glpoly[iorb][idim] + gwfn[iorb][idim];
887 SpherGridType::iterator it(
sgridxyz_m.begin());
888 SpherGridType::iterator it_end(
sgridxyz_m.end());
893 *jt =
dot(rmat, *it);
907 std::vector<PosType>& deltaV)
const 909 for (
int j = 0; j <
nknot; j++)
915 for (
int j = 0; j <
nknot; j++)
base class for Single-particle orbital sets
void resize(size_type n, Type_t val=Type_t())
Resize the container.
void contributeTxy(int iel, std::vector< NonLocalData > &Txy) const
contribute local non-local move data
Contains a set of radial grid potentials around a center.
aligned_vector< RealType > wgt_angpp_m
Weight of the angular momentum.
std::vector< PosType > deltaV
int nknot
the number of nknot
ValueType calcRatio(ParticleSet &P, int iat, ComputeType ct=ComputeType::ALL)
compute psi(R_new) / psi(R_current) ratio It returns a complex value if the wavefunction is complex...
void pause()
Pause the summary and log streams.
void add(int l, RadialPotentialType *pp)
add a new Non Local component
std::vector< PosType > cosgrad
std::vector< RadialPotentialType * > nlpp_m
Non-Local part of the pseudo-potential.
helper functions for EinsplineSetBuilder
QTBase::GradType GradType
QTBase::RealType RealType
std::vector< PosType > vgrad
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
int nchannel
the number of non-local channels
size_t getTotalNum() const
void acceptMove(ParticleSet &P, int iat, bool safe_to_delay=false)
update the state with the new data
constexpr std::complex< float > czero
std::vector< ValueType > psiratio
constexpr std::complex< float > cone
void evaluateOneBodyOpMatrixdRContribution(ParticleSet &P, ParticleSet &source, const int iat, const int iat_src, const TWFFastDerivWrapper &psi, const int iel, const RealType r, const PosType &dr, std::vector< std::vector< ValueMatrix >> &dB)
Evaluate contribution to dB/dR of election iel and ion iat.
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
void makeMoves(const ParticleSet &refp, int jel, const std::vector< PosType > &deltaV, bool sphere=false, int iat=-1)
move virtual particles to new postions and update distance tables
RealType evaluateJastrowRatio(ParticleSet &P, const int iel) const
Given a proposed move of electron iel from r->r', computes exp(J')/exp(J)
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
GradType evaluateJastrowGradSource(ParticleSet &P, ParticleSet &source, const int iat) const
Return ionic gradient of J(r).
bool do_randomize_grid_
Can disable grid randomization for testing.
int getNumDistTables() const
std::vector< RealType > dvrad
int first(int igroup) const
return the first index of a group i
RealType Rmax
Maximum cutoff the non-local pseudopotential.
void print(std::ostream &os)
IndexType numOrbitals(const IndexType sid) const
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
OrbitalSetTraits< ValueType >::ValueVector ValueVector
RealType Lfactor2[8]
Lfactor1[l]=(l)/(l+1)
std::vector< RealType > lpol
SPOSet::GradMatrix GradMatrix
OutputManagerClass outputManager(Verbosity::HIGH)
void evaluateOneBodyOpMatrixContribution(ParticleSet &P, const int iat, const TWFFastDerivWrapper &psi, const int iel, const RealType r, const PosType &dr, std::vector< ValueMatrix > &B)
Evaluate contribution to B of election iel and ion iat.
std::vector< ValueType > wvec
Working arrays.
SPOSet::ValueMatrix ValueMatrix
For fast derivative evaluation.
void resume()
Resume the summary and log streams.
Specialized paritlce class for atomistic simulations.
SpherGridType rrotsgrid_m
randomized spherical grid
RealType calcJastrowRatioGrad(ParticleSet &P, const int iel, GradType &grad) const
Given a proposed move of electron iel from r->r', computes exp(J(r'))/exp(J(r)) and grad_iel(J(r'))...
void rejectMove(Index_t iat)
reject a proposed move in regular mode
static void mw_evaluateOne(const RefVectorWithLeader< NonLocalECPComponent > &ecp_component_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVectorWithLeader< TrialWaveFunction > &psi_list, const RefVector< const NLPPJob< RealType >> &joblist, std::vector< RealType > &pairpots, ResourceCollection &collection, bool use_DLA)
Evaluate the nonlocal pp contribution via randomized quadrature grid to total energy from ion "iat" a...
OrbitalSetTraits< ValueType >::ValueVector ValueVector
RealType Lfactor1[8]
Lfactor1[l]=(2*l+1)/(l+1)
GradType evalGradSource(ParticleSet &P, ParticleSet &source, int iat)
Returns the logarithmic gradient of the trial wave function with respect to the iat^th atom of the so...
VirtualParticleSet * VP
virtual particle set: delayed initialization
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
int last(int igroup) const
return the last index of a group i
RealType evaluateOne(ParticleSet &W, int iat, TrialWaveFunction &Psi, int iel, RealType r, const PosType &dr, bool use_DLA)
Evaluate the nonlocal pp contribution via randomized quadrature grid to total energy from ion "iat" a...
std::vector< RealType > vrad
static void mw_makeMoves(const RefVectorWithLeader< VirtualParticleSet > &vp_list, const RefVectorWithLeader< ParticleSet > &p_list, const RefVector< const std::vector< PosType >> &deltaV_list, const RefVector< const NLPPJob< RealType >> &joblist, bool sphere)
OHMMS_INDEXTYPE IndexType
define other types
const RealType ion_elec_dist
std::vector< RealType > dlpol
std::vector< PosType > gradpsiratio
std::vector< std::reference_wrapper< T > > RefVector
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
OrbitalSetTraits< ValueType >::GradVector GradVector
int lmax
Non Local part: angular momentum, potential and grid.
Class to represent a many-body trial wave function.
void deleteVirtualParticle()
void makeMove(Index_t iat, const SingleParticlePos &displ, bool maybe_accept=true)
move the iat-th particle to active_pos_
void set_randomize_grid(bool do_randomize_grid_)
IndexType getRowM(const ParticleSet &P, const IndexType iel, ValueVector &val) const
Returns value of all orbitals (relevant to given species/group) at a particular particle coordinate...
RealType evaluateOneWithForces(ParticleSet &W, int iat, TrialWaveFunction &Psi, int iel, RealType r, const PosType &dr, PosType &force_iat)
Evaluate the nonlocal pp contribution via randomized quadrature grid to total energy from ion "iat" a...
handles acquire/release resource by the consumer (RefVectorWithLeader type).
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
LatticeGaussianProduct::ValueType ValueType
ParticleAttrib< QTFull::GradType > ParticleGradient
meta data for NLPP calculation of a pair of ion and electron This is not just meta data...
void initVirtualParticle(const ParticleSet &qp)
std::vector< PosType > wfngrad
IndexType getTWFGroupIndex(const IndexType gid) const
Takes particle set groupID and returns the TWF internal index for it.
std::vector< RealType > knot_pots
double B(double x, int k, int i, const std::vector< double > &t)
SPOSet * getSPOSet(const IndexType sid) const
void buildQuadraturePointDeltaPositions(RealType r, const PosType &dr, std::vector< PosType > &deltaV) const
build QP position deltas from the reference electron using internally stored random grid points ...
const PosType ion_elec_displ
void acceptMove(Index_t iat)
accept the move and update the particle attribute by the proposed move in regular mode ...
bool isActive(Verbosity level) const
void resize_warrays(int n, int m, int l)
RealType calculateProjector(RealType r, const PosType &dr)
finalize the calculation of ${V}{}$
ValueType calcRatioGrad(ParticleSet &P, int iat, GradType &grad_iat)
compute psi(R_new) / psi(R_current) ratio and ln(psi(R_new)) gradients It returns a complex value if...
static void mw_evaluateRatios(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< const VirtualParticleSet > &Vp_list, const RefVector< std::vector< ValueType >> &ratios_list, ComputeType ct=ComputeType::ALL)
batched version of evaluateRatios Note: unlike other mw_ static functions, *this is the batch leader ...
std::vector< RealType > sgridweight_m
weight of the spherical grid
aligned_vector< int > angpp_m
Angular momentum map.
void evaluateRatios(const VirtualParticleSet &VP, std::vector< ValueType > &ratios, ComputeType ct=ComputeType::ALL)
compulte multiple ratios to handle non-local moves and other virtual moves
SpherGridType sgridxyz_m
fixed Spherical Grid for species
int getGroupID(int iat) const
return the group id of a given particle in the particle set.
void rotateQuadratureGrid(const TensorType &rmat)
Randomly rotate sgrid_m.