17 #ifndef QMCPLUSPLUS_COULOMBPOTENTIAL_H 18 #define QMCPLUSPLUS_COULOMBPOTENTIAL_H 51 #if !defined(REMOVE_TRACEMANAGER) 109 std::string
getClassName()
const override {
return "CoulombPotential"; }
111 #if !defined(REMOVE_TRACEMANAGER) 151 #if !defined(REMOVE_TRACEMANAGER) 156 for (
size_t iat = 1; iat <
nCenters; ++iat)
160 for (
size_t j = 0; j < iat; ++j)
161 res += q * Z[j] / dist[j];
171 for (
size_t iat = 1; iat <
nCenters; ++iat)
176 for (
size_t j = 0; j < iat; ++j)
178 forces_[iat] += -q * Z[j] * displ[j] / (dist[j] * dist[j] * dist[j]);
179 forces_[j] -= -q * Z[j] * displ[j] / (dist[j] * dist[j] * dist[j]);
188 constexpr T
czero(0);
190 #if !defined(REMOVE_TRACEMANAGER) 196 const size_t nTargets = d.
targets();
197 for (
size_t b = 0; b < nTargets; ++b)
201 for (
size_t a = 0; a <
nCenters; ++a)
202 e += Za[a] / dist[a];
210 #if !defined(REMOVE_TRACEMANAGER) 218 for (
size_t iat = 1; iat <
nCenters; ++iat)
222 for (
size_t j = 0; j < iat; ++j)
224 pairpot = 0.5 * q * Z[j] / dist[j];
225 Va_samp(iat) += pairpot;
226 Va_samp(j) += pairpot;
231 #if defined(TRACE_CHECK) 235 T Vsum = Va_samp.
sum();
239 app_log() <<
"versiontest: CoulombPotential::evaluateAA()" << std::endl;
240 app_log() <<
"versiontest: orig:" << Vorig << std::endl;
241 app_log() <<
"versiontest: mod:" << Vnow << std::endl;
246 app_log() <<
"accumtest: CoulombPotential::evaluateAA()" << std::endl;
247 app_log() <<
"accumtest: tot:" << Vnow << std::endl;
248 app_log() <<
"accumtest: sum:" << Vsum << std::endl;
265 const size_t nTargets = d.
targets();
266 for (
size_t b = 0; b < nTargets; ++b)
270 for (
size_t a = 0; a <
nCenters; ++a)
272 pairpot = z * Za[a] / dist[a];
273 Va_samp(a) += pairpot;
274 Vb_samp(b) += pairpot;
280 #if defined(TRACE_CHECK) 284 T Vasum = Va_samp.
sum();
285 T Vbsum = Vb_samp.
sum();
286 T Vsum = Vasum + Vbsum;
290 app_log() <<
"versiontest: CoulombPotential::evaluateAB()" << std::endl;
291 app_log() <<
"versiontest: orig:" << Vorig << std::endl;
292 app_log() <<
"versiontest: mod:" << Vnow << std::endl;
297 app_log() <<
"accumtest: CoulombPotential::evaluateAB()" << std::endl;
298 app_log() <<
"accumtest: tot:" << Vnow << std::endl;
299 app_log() <<
"accumtest: sum:" << Vsum << std::endl;
304 app_log() <<
"sharetest: CoulombPotential::evaluateAB()" << std::endl;
305 app_log() <<
"sharetest: a share:" << Vasum << std::endl;
306 app_log() <<
"sharetest: b share:" << Vbsum << std::endl;
356 bool put(xmlNodePtr cur)
override {
return true; }
358 bool get(std::ostream& os)
const override 361 os <<
"CoulombAB source=" <<
Pa.
getName() << std::endl;
363 os <<
"CoulombAA source/target " <<
Pa.
getName() << std::endl;
387 return std::make_unique<CoulombPotential>(qp,
true,
ComputeForces);
391 return std::make_unique<CoulombPotential>(
Pa,
false,
ComputeForces,
true);
394 return std::make_unique<CoulombPotential>(
Pa, qp,
true);
void twoBodyQuantumDomain(const ParticleSet &P)
set quantum domain for two-body operator
T evaluate_spAB(const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
bool streaming_particles_
void deleteParticleQuantities() override
std::string getClassName() const override
return class name
const std::string & getName() const
return the name
void addObservables(PropertySetType &plist, BufferType &collectables) override
named values to the property list Default implementaton uses addValue(plist_)
Return_t evaluateWithIonDerivs(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_terms, ParticleSet::ParticlePos &pulay_terms) override
Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase...
helper functions for EinsplineSetBuilder
const DistanceTableAA & getDistTableAA(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAA
bool streaming_array(const std::string &name)
void contributeParticleQuantities() override
void checkoutParticleQuantities(TraceManager &tm) override
const DistRow & getDistRow(int iel) const
return a row of distances for a given target particle
ParticleSet::ParticlePos forces_
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
constexpr std::complex< float > czero
bool put(xmlNodePtr cur) override
Read the input parameter.
const int myTableIndex
distance table index
ParticleSet & Pa
source particle set
Declaration of OperatorBase.
const bool is_AA
true if the table is AA
void addObservablesF(QMCTraits::PropertySetType &plist)
Vectorized record engine for scalar properties.
T evaluate_spAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions
Attaches a unit to a Vector for IO.
void resetTargetParticleSet(ParticleSet &P) override
Reset the data with the target ParticleSet.
TraceRequest request_
whether traces are being collected
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
const DistanceTableAB & getDistTableAB(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAB
std::string name_
name of this object
Specialized paritlce class for atomistic simulations.
void setObservables(PropertySetType &plist) override
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
WalkerProperties::Indexes WP
CoulombPotential(ParticleSet &s, bool active, bool computeForces, bool copy=false)
constructor for AA
AB type of DistanceTable containing storage.
size_t targets() const
returns the number of centers
Array< TraceReal, 1 > * Va_sample
single particle trace samples
ParticleSet & Pb
target particle set
std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi) override
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
void setEnergyDomain(EnergyDomains edomain)
Set the Energy Domain.
void setParticleSetF(QMCTraits::PropertySetType &plist, int offset)
const DistRow & getDistRow(int iel) const
return a row of distances for a given target particle
void addValue(PropertySetType &plist)
named values to the property list
Array< TraceReal, 1 > * Vb_sample
ParticleScalar Z
charge of each particle
AA type of DistanceTable containing storage.
Array< TraceReal, D > * checkout_real(const std::string &name, int n1=1, int n2=0, int n3=0, int n4=0)
ParticleSet::Scalar_t ParticleScalar
typedef for the ParticleScalar
An abstract class for Local Energy operators.
FullPrecRealType Return_t
type of return value of evaluate
const DisplRow & getDisplRow(int iel) const
return a row of displacements for a given target particle
virtual void setParticlePropertyList(PropertySetType &plist, int offset)
void setObservablesF(QMCTraits::PropertySetType &plist)
Class to represent a many-body trial wave function.
bool is_active
true, if CoulombAA for quantum particleset
Return_t value_
current value
void setParticlePropertyList(PropertySetType &plist, int offset) override
Indexes
an enum denoting index of physical properties
void evaluateAAForces(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type forces
T evaluateAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions
CoulombPotential(ParticleSet &s, ParticleSet &t, bool active, bool copy=false)
constructor for AB
void contribute_array(const std::string &name, bool default_quantity=false)
bool ComputeForces
Flag for whether to compute forces or not.
virtual void setObservables(PropertySetType &plist)
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
T evaluateAB(const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
JNKIM: Need to check the precision.
int nCenters
number of centers
~CoulombPotential() override
whether full table needs to be ready at anytime or not after donePbyP Optimization can be implemented...
Declaration of a MCWalkerConfiguration.
void updateSource(ParticleSet &s) override
Update data associated with a particleset.