37 APP_ABORT(
" L2Potential::resetTargetParticleSet found a different distance table index.");
44 for (
int iat = 0; iat <
PP.size(); iat++)
47 PPset[groupID] = std::move(ppot);
59 for (
size_t n = 0;
n <
N;
n++)
60 for (
size_t i = 0; i <
DIM; i++)
61 for (
size_t j = 0; j <
DIM; j++)
62 D2[
n](i, j) += P.
G[
n][i] * P.
G[
n][j];
68 for (
size_t iel = 0; iel < Nelec; ++iel)
70 const auto Le = P.
L[iel];
71 const auto& ge = P.
G[iel];
72 const auto& D2e = D2[iel];
73 const auto& dist = d_table.getDistRow(iel);
74 const auto& disp = d_table.getDisplRow(iel);
76 for (
size_t iat = 0; iat <
NumIons; ++iat)
79 if (
PP[iat] !=
nullptr && r <
PP[iat]->rcut)
83 for (
int i = 0; i <
DIM; ++i)
85 for (
int i = 0; i <
DIM; ++i)
86 for (
int j = 0; j <
DIM; ++j)
87 v += rv[i] *
std::real(D2e(i, j)) * rv[j];
88 esum += v *
PP[iat]->evaluate(dist[iat]);
105 for (
int iat = 0; iat <
NumIons; iat++)
110 RealType r = d_table.getTempDists()[iat];
113 PosType rv = -1 * d_table.getTempDispls()[iat];
116 for (
int i = 0; i <
DIM; ++i)
117 D(i, i) += 2 * vL2 * r * r;
118 for (
int i = 0; i <
DIM; ++i)
119 for (
int j = 0; j <
DIM; ++j)
120 D(i, j) -= 2 * vL2 * rv[i] * rv[j];
133 for (
int iat = 0; iat <
NumIons; iat++)
138 RealType r = d_table.getTempDists()[iat];
141 PosType rv = d_table.getTempDispls()[iat];
143 for (
int i = 0; i <
DIM; ++i)
144 D(i, i) += 2 * vL2 * r * r;
145 for (
int i = 0; i <
DIM; ++i)
146 for (
int j = 0; j <
DIM; ++j)
147 D(i, j) -= 2 * vL2 * rv[i] * rv[j];
155 std::unique_ptr<L2Potential> myclone = std::make_unique<L2Potential>(
IonConfig, qp, psi);
156 for (
int ig = 0; ig <
PPset.size(); ++ig)
160 myclone->add(ig, std::unique_ptr<L2RadialPotential>(
PPset[ig]->
makeClone()));
void twoBodyQuantumDomain(const ParticleSet &P)
set quantum domain for two-body operator
void resetTargetParticleSet(ParticleSet &P) override
Reset the data with the target ParticleSet.
void add(int groupID, std::unique_ptr< L2RadialPotential > &&ppot)
Add a RadialPotentialType of a species.
helper functions for EinsplineSetBuilder
QTBase::RealType RealType
size_t getTotalNum() const
void evaluateHessian(ParticleSet &P, HessVector &all_grad_grad_psi)
evaluate the hessian w.r.t.
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) final
TrialWaveFunction * psi_ref
Associated trial wavefunction.
const ParticleSet & IonConfig
reference to the ionic configuration
int myTableIndex
distance table index
ParticleLaplacian L
laplacians of the particles
ParticleIndex GroupID
Species ID.
int getTotalNum() const
return the number of species
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
int addTable(const ParticleSet &psrc, DTModes modes=DTModes::ALL_OFF)
add a distance table
Specialized paritlce class for atomistic simulations.
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
std::vector< std::unique_ptr< L2RadialPotential > > PPset
unique set of L2 PP to cleanup
ParticleGradient G
gradients of the particles
void evaluateD(ParticleSet &P, int iel, TensorType &D)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void setEnergyDomain(EnergyDomains edomain)
Set the Energy Domain.
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
void diagonal(const T &rhs)
WaveFunctionComponent::HessVector HessVector
FullPrecRealType Return_t
type of return value of evaluate
Class to represent a many-body trial wave function.
Return_t value_
current value
int NumIons
the number of ions
L2Potential(const ParticleSet &ions, ParticleSet &els, TrialWaveFunction &psi)
RealType evaluate(RealType r)
void evaluateDK(ParticleSet &P, int iel, TensorType &D, PosType &K)
std::vector< L2RadialPotential * > PP
PP[iat] is the L2 potential for the iat-th particle.