QMCPACK
CoulombPotential< T > Struct Template Reference

CoulombPotential. More...

+ Inheritance diagram for CoulombPotential< T >:
+ Collaboration diagram for CoulombPotential< T >:

Public Member Functions

 CoulombPotential (ParticleSet &s, bool active, bool computeForces, bool copy=false)
 constructor for AA More...
 
 CoulombPotential (ParticleSet &s, ParticleSet &t, bool active, bool copy=false)
 constructor for AB More...
 
std::string getClassName () const override
 return class name More...
 
void contributeParticleQuantities () override
 
void checkoutParticleQuantities (TraceManager &tm) override
 
void deleteParticleQuantities () override
 
void addObservables (PropertySetType &plist, BufferType &collectables) override
 named values to the property list Default implementaton uses addValue(plist_) More...
 
evaluateAA (const DistanceTableAA &d, const ParticleScalar *restrict Z)
 evaluate AA-type interactions More...
 
void evaluateAAForces (const DistanceTableAA &d, const ParticleScalar *restrict Z)
 evaluate AA-type forces More...
 
evaluateAB (const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
 JNKIM: Need to check the precision. More...
 
evaluate_spAA (const DistanceTableAA &d, const ParticleScalar *restrict Z)
 evaluate AA-type interactions More...
 
evaluate_spAB (const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
 
void resetTargetParticleSet (ParticleSet &P) override
 Reset the data with the target ParticleSet. More...
 
 ~CoulombPotential () override
 
void updateSource (ParticleSet &s) override
 Update data associated with a particleset. More...
 
Return_t evaluate (ParticleSet &P) override
 Evaluate the local energy contribution of this component. More...
 
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. More...
 
bool put (xmlNodePtr cur) override
 Read the input parameter. More...
 
bool get (std::ostream &os) const override
 write about the class More...
 
void setObservables (PropertySetType &plist) override
 Set the values evaluated by this object to plist Default implementation is to assign Value which is updated by evaluate function using my_index_. More...
 
void setParticlePropertyList (PropertySetType &plist, int offset) override
 
std::unique_ptr< OperatorBasemakeClone (ParticleSet &qp, TrialWaveFunction &psi) override
 
- Public Member Functions inherited from OperatorBase
 OperatorBase ()
 Construct a new Operator Base object Default and unique empty constructor. More...
 
virtual ~OperatorBase ()=default
 
virtual bool dependsOnWaveFunction () const
 return true if this operator depends on a wavefunction More...
 
std::bitset< 8 > & getUpdateMode () noexcept
 get update_mode_ reference More...
 
Return_t getValue () const noexcept
 get a copy of value_ More...
 
std::string getName () const noexcept
 getter a copy of my_name_, rvalue small string optimization More...
 
void setName (const std::string name) noexcept
 Set my_name member, uses small string optimization (pass by value) More...
 
TraceRequestgetRequest () noexcept
 Get request_ member. More...
 
virtual void registerObservables (std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
 add to observable descriptor for hdf5 The default implementation is to register a scalar for this->value_ More...
 
virtual void registerCollectables (std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
 
virtual void setHistories (Walker_t &ThisWalker)
 
virtual Return_t evaluateDeterministic (ParticleSet &P)
 Evaluate the local energy contribution of this component, deterministically based on current state. More...
 
virtual void mw_evaluate (const RefVectorWithLeader< OperatorBase > &o_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list) const
 Evaluate the contribution of this component of multiple walkers. More...
 
virtual void mw_evaluatePerParticle (const RefVectorWithLeader< OperatorBase > &o_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< ListenerVector< RealType >> &listeners, const std::vector< ListenerVector< RealType >> &listeners_ions) const
 Evaluate the contribution of this component of multiple walkers per particle and report to registerd listeners from objects in Estimators. More...
 
virtual void mw_evaluateWithParameterDerivatives (const RefVectorWithLeader< OperatorBase > &o_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, const RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi) const
 TODO: add docs. More...
 
virtual Return_t rejectedMove (ParticleSet &P)
 TODO: add docs. More...
 
virtual Return_t evaluateWithToperator (ParticleSet &P)
 Evaluate the local energy contribution of this component with Toperators updated if requested. More...
 
virtual void mw_evaluateWithToperator (const RefVectorWithLeader< OperatorBase > &o_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list) const
 Evaluate the contribution of this component of multiple walkers. More...
 
virtual void mw_evaluatePerParticleWithToperator (const RefVectorWithLeader< OperatorBase > &o_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const std::vector< ListenerVector< RealType >> &listeners, const std::vector< ListenerVector< RealType >> &listeners_ions) const
 Evaluate the contribution of this component of multiple walkers per particle and report to registerd listeners from objects in Estimators. More...
 
virtual Return_t evaluateValueAndDerivatives (ParticleSet &P, const opt_variables_type &optvars, const Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
 Evaluate value and derivatives wrt the optimizables. More...
 
virtual Return_t evaluateWithIonDerivsDeterministic (ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_term, ParticleSet::ParticlePos &pulay_term)
 Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase. More...
 
virtual void evaluateOneBodyOpMatrix (ParticleSet &P, const TWFFastDerivWrapper &psi, std::vector< ValueMatrix > &B)
 Evaluate "B" matrix for observable. More...
 
virtual void evaluateOneBodyOpMatrixForceDeriv (ParticleSet &P, ParticleSet &source, const TWFFastDerivWrapper &psi, const int iat, std::vector< std::vector< ValueMatrix >> &Bforce)
 Evaluate "dB/dR" matrices for observable. More...
 
virtual Return_t getEnsembleAverage ()
 Return an average value by collective operation. More...
 
virtual void createResource (ResourceCollection &collection) const
 Initialize a shared resource and hand it to a collection. More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< OperatorBase > &o_list) const
 Acquire a shared resource from a collection. More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< OperatorBase > &o_list) const
 Return a shared resource to a collection. More...
 
virtual void setRandomGenerator (RandomBase< FullPrecRealType > *rng)
 Set the Random Generator object TODO: add docs. More...
 
virtual void add2Hamiltonian (ParticleSet &qp, TrialWaveFunction &psi, QMCHamiltonian &targetH)
 TODO: add docs. More...
 
virtual void getRequiredTraces (TraceManager &tm)
 TODO: add docs. More...
 
virtual void informOfPerParticleListener ()
 
bool isClassical () const noexcept
 
bool isQuantum () const noexcept
 
bool isClassicalClassical () const noexcept
 
bool isQuantumClassical () const noexcept
 
bool isQuantumQuantum () const noexcept
 
bool getMode (const int i) const noexcept
 Return the mode i. More...
 
bool isNonLocal () const noexcept
 TODO: add docs. More...
 
bool hasListener () const noexcept
 
void contributeTraceQuantities ()
 Make trace quantities available. More...
 
void checkoutTraceQuantities (TraceManager &tm)
 Checkout trace arrays Derived classes must guard individual checkouts using request info. More...
 
void collectScalarTraces ()
 Collect scalar trace data. More...
 
void deleteTraceQuantities ()
 delete trace arrays More...
 
- Public Member Functions inherited from ForceBase
Real g (Real r)
 
void initVarReduction (Real rcut, int m, int numFuncs)
 
 ForceBase (ParticleSet &ions, ParticleSet &elns)
 
virtual ~ForceBase ()
 
void registerObservablesF (std::vector< ObservableHelper > &h5list, hdf_archive &file) const
 
void addObservablesF (QMCTraits::PropertySetType &plist)
 
void addObservablesStress (QMCTraits::PropertySetType &plist)
 
void setObservablesF (QMCTraits::PropertySetType &plist)
 
void setObservablesStress (QMCTraits::PropertySetType &plist)
 
void setParticleSetF (QMCTraits::PropertySetType &plist, int offset)
 
void setParticleSetStress (QMCTraits::PropertySetType &plist, int offset)
 
bool getAddIonIon () const noexcept
 
void setAddIonIon (bool val) noexcept
 
const ParticleSet::ParticlePosgetForces () const noexcept
 
void setForces (const ParticleSet::ParticlePos &forces)
 
void setForces (Real val)
 
const ParticleSet::ParticlePosgetForcesIonIon () const noexcept
 
void setForcesIonIon (const ParticleSet::ParticlePos &forces_ion_ion)
 
const SymTensor< Real, OHMMS_DIM > & getStressIonIon () const noexcept
 
const SymTensor< Real, OHMMS_DIM > & getStressEE () const noexcept
 
const SymTensor< Real, OHMMS_DIM > & getStressEI () const noexcept
 
const SymTensor< Real, OHMMS_DIM > & getStressKin () const noexcept
 
const SymTensor< Real, OHMMS_DIM > & getStress () const noexcept
 

Public Attributes

ParticleSetPa
 source particle set More...
 
ParticleSetPb
 target particle set More...
 
const int myTableIndex
 distance table index More...
 
const bool is_AA
 true if the table is AA More...
 
bool is_active
 true, if CoulombAA for quantum particleset More...
 
int nCenters
 number of centers More...
 
Array< TraceReal, 1 > * Va_sample
 single particle trace samples More...
 
Array< TraceReal, 1 > * Vb_sample
 
bool ComputeForces
 Flag for whether to compute forces or not. More...
 

Additional Inherited Members

- Public Types inherited from OperatorBase
enum  EnergyDomains { KINETIC = 0, POTENTIAL, NO_ENERGY_DOMAIN }
 enum to denote energy domain of operators More...
 
enum  QuantumDomains {
  NO_QUANTUM_DOMAIN = 0, CLASSICAL, QUANTUM, CLASSICAL_CLASSICAL,
  QUANTUM_CLASSICAL, QUANTUM_QUANTUM
}
 
enum  {
  PRIMARY = 0, OPTIMIZABLE = 1, RATIOUPDATE = 2, PHYSICAL = 3,
  COLLECTABLE = 4, NONLOCAL = 5
}
 enum for update_mode More...
 
using Return_t = FullPrecRealType
 type of return value of evaluate More...
 
using ValueMatrix = SPOSet::ValueMatrix
 For fast derivative evaluation. More...
 
using GradMatrix = SPOSet::GradMatrix
 
using BufferType = ParticleSet::Buffer_t
 typedef for the serialized buffer More...
 
using Walker_t = ParticleSet::Walker_t
 typedef for the walker More...
 
using ParticleScalar = ParticleSet::Scalar_t
 typedef for the ParticleScalar More...
 
using SPOMap = SPOSet::SPOMap
 typedef for SPOMap More...
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 
- Public Types inherited from ForceBase
using Real = QMCTraits::RealType
 cheat, need to use virtual inheriance to clean up More...
 
- Protected Member Functions inherited from OperatorBase
virtual void contributeScalarQuantities ()
 
virtual void checkoutScalarQuantities (TraceManager &tm)
 
virtual void collectScalarQuantities ()
 
virtual void deleteScalarQuantities ()
 
virtual void setComputeForces (bool compute)
 
void setEnergyDomain (EnergyDomains edomain)
 Set the Energy Domain. More...
 
void setQuantumDomain (QuantumDomains qdomain)
 set quantum domain More...
 
void oneBodyQuantumDomain (const ParticleSet &P)
 set quantum domain for one-body operator More...
 
void twoBodyQuantumDomain (const ParticleSet &P)
 set quantum domain for two-body operator More...
 
void twoBodyQuantumDomain (const ParticleSet &P1, const ParticleSet &P2)
 set quantum domain for two-body operator More...
 
void addValue (PropertySetType &plist)
 named values to the property list More...
 
- Protected Attributes inherited from OperatorBase
std::bitset< 8 > update_mode_
 set the current update mode More...
 
Return_t value_
 current value More...
 
std::string name_
 name of this object More...
 
TraceRequest request_
 whether traces are being collected More...
 
int my_index_
 starting index of this object More...
 
Return_t new_value_
 a new value for a proposed move More...
 
Walker_tt_walker_
 reference to the current walker More...
 
bool streaming_particles_
 
bool have_required_traces_
 
- Protected Attributes inherited from ForceBase
int first_force_index_
 
int n_nuc_
 
int n_el_
 
int tries_
 
bool first_time_
 
bool add_ion_ion_
 Determines if ion-ion force will be added to electron-ion force in derived force estimators. If false, forces_ion_ion_=0.0. More...
 
ParticleSetions_
 
ParticleSet::ParticlePos forces_
 
ParticleSet::ParticlePos forces_ion_ion_
 
SymTensor< Real, OHMMS_DIMstress_ion_ion_
 
SymTensor< Real, OHMMS_DIMstress_ee_
 
SymTensor< Real, OHMMS_DIMstress_ei_
 
SymTensor< Real, OHMMS_DIMstress_kin_
 
SymTensor< Real, OHMMS_DIMstress_
 
std::string prefix_
 
std::string pair_name_
 
Real rcut_
 
int m_
 
std::vector< Realck_
 

Detailed Description

template<typename T>
struct qmcplusplus::CoulombPotential< T >

CoulombPotential.

Template Parameters
Ttype of the elementary data

Hamiltonian operator for the Coulomb interaction for both AA and AB type for open systems.

Definition at line 37 of file CoulombPotential.h.

Constructor & Destructor Documentation

◆ CoulombPotential() [1/2]

CoulombPotential ( ParticleSet s,
bool  active,
bool  computeForces,
bool  copy = false 
)
inline

constructor for AA

Parameters
ssource particleset
activeif true, new Value is computed whenver evaluate is used.
computeForcesif true, computes forces between inactive species

Definition at line 65 of file CoulombPotential.h.

References CoulombPotential< T >::ComputeForces, copy(), CoulombPotential< T >::evaluateAA(), CoulombPotential< T >::evaluateAAForces(), CoulombPotential< T >::is_active, CoulombPotential< T >::myTableIndex, CoulombPotential< T >::nCenters, OperatorBase::POTENTIAL, ForceBase::prefix_, qmcplusplus::Units::time::s, OperatorBase::setEnergyDomain(), OperatorBase::twoBodyQuantumDomain(), and OperatorBase::value_.

66  : ForceBase(s, s),
67  Pa(s),
68  Pb(s),
70  is_AA(true),
71  is_active(active),
72  ComputeForces(computeForces)
73  {
76  nCenters = s.getTotalNum();
77  prefix_ = "F_AA";
78 
79  if (!is_active) //precompute the value
80  {
81  if (!copy)
82  s.update();
83  value_ = evaluateAA(s.getDistTableAA(myTableIndex), s.Z.first_address());
84  if (ComputeForces)
85  evaluateAAForces(s.getDistTableAA(myTableIndex), s.Z.first_address());
86  }
87  }
void twoBodyQuantumDomain(const ParticleSet &P)
set quantum domain for two-body operator
const int myTableIndex
distance table index
ParticleSet & Pa
source particle set
const bool is_AA
true if the table is AA
ForceBase(ParticleSet &ions, ParticleSet &elns)
Definition: ForceBase.cpp:28
std::string prefix_
Definition: ForceBase.h:96
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
ParticleSet & Pb
target particle set
void setEnergyDomain(EnergyDomains edomain)
Set the Energy Domain.
bool is_active
true, if CoulombAA for quantum particleset
Return_t value_
current value
Definition: OperatorBase.h:524
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
bool ComputeForces
Flag for whether to compute forces or not.
int nCenters
number of centers
whether full table needs to be ready at anytime or not after donePbyP Optimization can be implemented...

◆ CoulombPotential() [2/2]

CoulombPotential ( ParticleSet s,
ParticleSet t,
bool  active,
bool  copy = false 
)
inline

constructor for AB

Parameters
ssource particleset
ttarget particleset
activeif true, new Value is computed whenver evaluate is used.
ComputeForcesis not implemented for AB

Definition at line 95 of file CoulombPotential.h.

References CoulombPotential< T >::nCenters, OperatorBase::POTENTIAL, qmcplusplus::Units::time::s, OperatorBase::setEnergyDomain(), and OperatorBase::twoBodyQuantumDomain().

96  : ForceBase(s, t),
97  Pa(s),
98  Pb(t),
99  myTableIndex(t.addTable(s)),
100  is_AA(false),
101  is_active(active),
102  ComputeForces(false)
103  {
106  nCenters = s.getTotalNum();
107  }
void twoBodyQuantumDomain(const ParticleSet &P)
set quantum domain for two-body operator
const int myTableIndex
distance table index
ParticleSet & Pa
source particle set
const bool is_AA
true if the table is AA
ForceBase(ParticleSet &ions, ParticleSet &elns)
Definition: ForceBase.cpp:28
ParticleSet & Pb
target particle set
void setEnergyDomain(EnergyDomains edomain)
Set the Energy Domain.
bool is_active
true, if CoulombAA for quantum particleset
bool ComputeForces
Flag for whether to compute forces or not.
int nCenters
number of centers

◆ ~CoulombPotential()

~CoulombPotential ( )
inlineoverride

Definition at line 321 of file CoulombPotential.h.

321 {}

Member Function Documentation

◆ addObservables()

void addObservables ( PropertySetType plist,
BufferType collectables 
)
inlineoverridevirtual

named values to the property list Default implementaton uses addValue(plist_)

Parameters
plistRecordNameProperty
collectablesObservables that are accumulated by evaluate

Reimplemented from OperatorBase.

Definition at line 140 of file CoulombPotential.h.

References ForceBase::addObservablesF(), OperatorBase::addValue(), and CoulombPotential< T >::ComputeForces.

141  {
142  addValue(plist);
143  if (ComputeForces)
144  addObservablesF(plist);
145  }
void addObservablesF(QMCTraits::PropertySetType &plist)
Definition: ForceBase.cpp:47
void addValue(PropertySetType &plist)
named values to the property list
bool ComputeForces
Flag for whether to compute forces or not.

◆ checkoutParticleQuantities()

void checkoutParticleQuantities ( TraceManager tm)
inlineoverridevirtual

Reimplemented from OperatorBase.

Definition at line 114 of file CoulombPotential.h.

References TraceManager::checkout_real(), CoulombPotential< T >::evaluate_spAA(), ParticleSet::getDistTableAA(), CoulombPotential< T >::is_AA, CoulombPotential< T >::is_active, CoulombPotential< T >::myTableIndex, OperatorBase::name_, CoulombPotential< T >::Pa, CoulombPotential< T >::Pb, OperatorBase::request_, TraceRequest::streaming_array(), OperatorBase::streaming_particles_, CoulombPotential< T >::Va_sample, CoulombPotential< T >::Vb_sample, and ParticleSet::Z.

115  {
118  {
119  Va_sample = tm.checkout_real<1>(name_, Pa);
120  if (!is_AA)
121  {
122  Vb_sample = tm.checkout_real<1>(name_, Pb);
123  }
124  else if (!is_active)
125  evaluate_spAA(Pa.getDistTableAA(myTableIndex), Pa.Z.first_address());
126  }
127  }
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)
Definition: TraceManager.h:249
const int myTableIndex
distance table index
ParticleSet & Pa
source particle set
const bool is_AA
true if the table is AA
T evaluate_spAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions
TraceRequest request_
whether traces are being collected
Definition: OperatorBase.h:531
std::string name_
name of this object
Definition: OperatorBase.h:527
Array< TraceReal, 1 > * Va_sample
single particle trace samples
ParticleSet & Pb
target particle set
Array< TraceReal, 1 > * Vb_sample
ParticleScalar Z
charge of each particle
Definition: ParticleSet.h:89
bool is_active
true, if CoulombAA for quantum particleset

◆ contributeParticleQuantities()

void contributeParticleQuantities ( )
inlineoverridevirtual

Reimplemented from OperatorBase.

Definition at line 112 of file CoulombPotential.h.

References TraceRequest::contribute_array(), OperatorBase::name_, and OperatorBase::request_.

TraceRequest request_
whether traces are being collected
Definition: OperatorBase.h:531
std::string name_
name of this object
Definition: OperatorBase.h:527
void contribute_array(const std::string &name, bool default_quantity=false)
Definition: TraceManager.h:198

◆ deleteParticleQuantities()

void deleteParticleQuantities ( )
inlineoverridevirtual

Reimplemented from OperatorBase.

Definition at line 129 of file CoulombPotential.h.

References CoulombPotential< T >::is_AA, OperatorBase::streaming_particles_, CoulombPotential< T >::Va_sample, and CoulombPotential< T >::Vb_sample.

130  {
132  {
133  delete Va_sample;
134  if (!is_AA)
135  delete Vb_sample;
136  }
137  }
const bool is_AA
true if the table is AA
Array< TraceReal, 1 > * Va_sample
single particle trace samples
Array< TraceReal, 1 > * Vb_sample

◆ evaluate()

Return_t evaluate ( ParticleSet P)
inlineoverridevirtual

Evaluate the local energy contribution of this component.

Parameters
Pinput configuration containing N particles
Returns
the value of the Hamiltonian component

Implements OperatorBase.

Definition at line 331 of file CoulombPotential.h.

References CoulombPotential< T >::evaluateAA(), CoulombPotential< T >::evaluateAB(), ParticleSet::getDistTableAA(), ParticleSet::getDistTableAB(), CoulombPotential< T >::is_AA, CoulombPotential< T >::is_active, CoulombPotential< T >::myTableIndex, CoulombPotential< T >::Pa, OperatorBase::value_, and ParticleSet::Z.

Referenced by CoulombPotential< T >::evaluateWithIonDerivs().

332  {
333  if (is_active)
334  {
335  if (is_AA)
336  value_ = evaluateAA(P.getDistTableAA(myTableIndex), P.Z.first_address());
337  else
338  value_ = evaluateAB(P.getDistTableAB(myTableIndex), Pa.Z.first_address(), P.Z.first_address());
339  }
340  return value_;
341  }
const int myTableIndex
distance table index
ParticleSet & Pa
source particle set
const bool is_AA
true if the table is AA
ParticleScalar Z
charge of each particle
Definition: ParticleSet.h:89
bool is_active
true, if CoulombAA for quantum particleset
Return_t value_
current value
Definition: OperatorBase.h:524
T evaluateAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions
T evaluateAB(const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
JNKIM: Need to check the precision.

◆ evaluate_spAA()

T evaluate_spAA ( const DistanceTableAA d,
const ParticleScalar *restrict  Z 
)
inline

evaluate AA-type interactions

Definition at line 212 of file CoulombPotential.h.

References qmcplusplus::abs(), APP_ABORT, qmcplusplus::app_log(), CoulombPotential< T >::evaluateAA(), DistanceTableAA::getDistRow(), CoulombPotential< T >::nCenters, OperatorBase::streaming_particles_, Array< T, D, ALLOC >::sum(), TraceManager::trace_tol, and CoulombPotential< T >::Va_sample.

Referenced by CoulombPotential< T >::checkoutParticleQuantities(), and CoulombPotential< T >::evaluateAA().

213  {
214  T res = 0.0;
215  T pairpot;
216  Array<RealType, 1>& Va_samp = *Va_sample;
217  Va_samp = 0.0;
218  for (size_t iat = 1; iat < nCenters; ++iat)
219  {
220  const auto& dist = d.getDistRow(iat);
221  T q = Z[iat];
222  for (size_t j = 0; j < iat; ++j)
223  {
224  pairpot = 0.5 * q * Z[j] / dist[j];
225  Va_samp(iat) += pairpot;
226  Va_samp(j) += pairpot;
227  res += pairpot;
228  }
229  }
230  res *= 2.0;
231 #if defined(TRACE_CHECK)
232  auto sptmp = streaming_particles_;
233  streaming_particles_ = false;
234  T Vnow = res;
235  T Vsum = Va_samp.sum();
236  T Vorig = evaluateAA(d, Z);
237  if (std::abs(Vorig - Vnow) > TraceManager::trace_tol)
238  {
239  app_log() << "versiontest: CoulombPotential::evaluateAA()" << std::endl;
240  app_log() << "versiontest: orig:" << Vorig << std::endl;
241  app_log() << "versiontest: mod:" << Vnow << std::endl;
242  APP_ABORT("Trace check failed");
243  }
244  if (std::abs(Vsum - Vnow) > TraceManager::trace_tol)
245  {
246  app_log() << "accumtest: CoulombPotential::evaluateAA()" << std::endl;
247  app_log() << "accumtest: tot:" << Vnow << std::endl;
248  app_log() << "accumtest: sum:" << Vsum << std::endl;
249  APP_ABORT("Trace check failed");
250  }
251  streaming_particles_ = sptmp;
252 #endif
253  return res;
254  }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::ostream & app_log()
Definition: OutputManager.h:65
Array< TraceReal, 1 > * Va_sample
single particle trace samples
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
Type_t sum() const
Definition: OhmmsArray.h:214
T evaluateAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions
int nCenters
number of centers

◆ evaluate_spAB()

T evaluate_spAB ( const DistanceTableAB d,
const ParticleScalar *restrict  Za,
const ParticleScalar *restrict  Zb 
)
inline

Definition at line 257 of file CoulombPotential.h.

References qmcplusplus::abs(), APP_ABORT, qmcplusplus::app_log(), CoulombPotential< T >::evaluateAB(), DistanceTableAB::getDistRow(), CoulombPotential< T >::nCenters, OperatorBase::streaming_particles_, Array< T, D, ALLOC >::sum(), DistanceTable::targets(), TraceManager::trace_tol, CoulombPotential< T >::Va_sample, and CoulombPotential< T >::Vb_sample.

Referenced by CoulombPotential< T >::evaluateAB().

258  {
259  T res = 0.0;
260  T pairpot;
261  Array<RealType, 1>& Va_samp = *Va_sample;
262  Array<RealType, 1>& Vb_samp = *Vb_sample;
263  Va_samp = 0.0;
264  Vb_samp = 0.0;
265  const size_t nTargets = d.targets();
266  for (size_t b = 0; b < nTargets; ++b)
267  {
268  const auto& dist = d.getDistRow(b);
269  T z = 0.5 * Zb[b];
270  for (size_t a = 0; a < nCenters; ++a)
271  {
272  pairpot = z * Za[a] / dist[a];
273  Va_samp(a) += pairpot;
274  Vb_samp(b) += pairpot;
275  res += pairpot;
276  }
277  }
278  res *= 2.0;
279 
280 #if defined(TRACE_CHECK)
281  auto sptmp = streaming_particles_;
282  streaming_particles_ = false;
283  T Vnow = res;
284  T Vasum = Va_samp.sum();
285  T Vbsum = Vb_samp.sum();
286  T Vsum = Vasum + Vbsum;
287  T Vorig = evaluateAB(d, Za, Zb);
288  if (std::abs(Vorig - Vnow) > TraceManager::trace_tol)
289  {
290  app_log() << "versiontest: CoulombPotential::evaluateAB()" << std::endl;
291  app_log() << "versiontest: orig:" << Vorig << std::endl;
292  app_log() << "versiontest: mod:" << Vnow << std::endl;
293  APP_ABORT("Trace check failed");
294  }
295  if (std::abs(Vsum - Vnow) > TraceManager::trace_tol)
296  {
297  app_log() << "accumtest: CoulombPotential::evaluateAB()" << std::endl;
298  app_log() << "accumtest: tot:" << Vnow << std::endl;
299  app_log() << "accumtest: sum:" << Vsum << std::endl;
300  APP_ABORT("Trace check failed");
301  }
302  if (std::abs(Vasum - Vbsum) > TraceManager::trace_tol)
303  {
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;
307  APP_ABORT("Trace check failed");
308  }
309  streaming_particles_ = sptmp;
310 #endif
311  return res;
312  }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::ostream & app_log()
Definition: OutputManager.h:65
Array< TraceReal, 1 > * Va_sample
single particle trace samples
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
Array< TraceReal, 1 > * Vb_sample
Type_t sum() const
Definition: OhmmsArray.h:214
T evaluateAB(const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
JNKIM: Need to check the precision.
int nCenters
number of centers

◆ evaluateAA()

T evaluateAA ( const DistanceTableAA d,
const ParticleScalar *restrict  Z 
)
inline

evaluate AA-type interactions

Definition at line 148 of file CoulombPotential.h.

References CoulombPotential< T >::evaluate_spAA(), DistanceTableAA::getDistRow(), CoulombPotential< T >::nCenters, and OperatorBase::streaming_particles_.

Referenced by CoulombPotential< T >::CoulombPotential(), CoulombPotential< T >::evaluate(), CoulombPotential< T >::evaluate_spAA(), and CoulombPotential< T >::updateSource().

149  {
150  T res = 0.0;
151 #if !defined(REMOVE_TRACEMANAGER)
153  res = evaluate_spAA(d, Z);
154  else
155 #endif
156  for (size_t iat = 1; iat < nCenters; ++iat)
157  {
158  const auto& dist = d.getDistRow(iat);
159  T q = Z[iat];
160  for (size_t j = 0; j < iat; ++j)
161  res += q * Z[j] / dist[j];
162  }
163  return res;
164  }
T evaluate_spAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions
int nCenters
number of centers

◆ evaluateAAForces()

void evaluateAAForces ( const DistanceTableAA d,
const ParticleScalar *restrict  Z 
)
inline

evaluate AA-type forces

Definition at line 168 of file CoulombPotential.h.

References ForceBase::forces_, DistanceTableAA::getDisplRow(), DistanceTableAA::getDistRow(), and CoulombPotential< T >::nCenters.

Referenced by CoulombPotential< T >::CoulombPotential().

169  {
170  forces_ = 0.0;
171  for (size_t iat = 1; iat < nCenters; ++iat)
172  {
173  const auto& dist = d.getDistRow(iat);
174  const auto& displ = d.getDisplRow(iat);
175  T q = Z[iat];
176  for (size_t j = 0; j < iat; ++j)
177  {
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]);
180  }
181  }
182  }
ParticleSet::ParticlePos forces_
Definition: ForceBase.h:87
int nCenters
number of centers

◆ evaluateAB()

T evaluateAB ( const DistanceTableAB d,
const ParticleScalar *restrict  Za,
const ParticleScalar *restrict  Zb 
)
inline

JNKIM: Need to check the precision.

Definition at line 186 of file CoulombPotential.h.

References BLAS::czero, qmcplusplus::Units::charge::e, CoulombPotential< T >::evaluate_spAB(), DistanceTableAB::getDistRow(), CoulombPotential< T >::nCenters, OperatorBase::streaming_particles_, and DistanceTable::targets().

Referenced by CoulombPotential< T >::evaluate(), and CoulombPotential< T >::evaluate_spAB().

187  {
188  constexpr T czero(0);
189  T res = czero;
190 #if !defined(REMOVE_TRACEMANAGER)
192  res = evaluate_spAB(d, Za, Zb);
193  else
194 #endif
195  {
196  const size_t nTargets = d.targets();
197  for (size_t b = 0; b < nTargets; ++b)
198  {
199  const auto& dist = d.getDistRow(b);
200  T e = czero;
201  for (size_t a = 0; a < nCenters; ++a)
202  e += Za[a] / dist[a];
203  res += e * Zb[b];
204  }
205  }
206  return res;
207  }
T evaluate_spAB(const DistanceTableAB &d, const ParticleScalar *restrict Za, const ParticleScalar *restrict Zb)
constexpr std::complex< float > czero
Definition: BLAS.hpp:51
int nCenters
number of centers

◆ evaluateWithIonDerivs()

Return_t evaluateWithIonDerivs ( ParticleSet P,
ParticleSet ions,
TrialWaveFunction psi,
ParticleSet::ParticlePos hf_term,
ParticleSet::ParticlePos pulay_term 
)
inlineoverridevirtual

Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase.

Parameters
Ptarget particle set (electrons)
ionssource particle set (ions)
psiTrial wave function
hf_termsAdds OperatorBase's contribution to Re [(dH)Psi]/Psi
pulay_termsAdds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi
Returns
Contribution of OperatorBase to Local Energy.

Reimplemented from OperatorBase.

Definition at line 343 of file CoulombPotential.h.

References CoulombPotential< T >::evaluate(), ForceBase::forces_, CoulombPotential< T >::is_active, and OperatorBase::value_.

348  {
349  if (is_active)
350  value_ = evaluate(P); // No forces for the active
351  else
352  hf_terms -= forces_; // No Pulay here
353  return value_;
354  }
ParticleSet::ParticlePos forces_
Definition: ForceBase.h:87
Return_t evaluate(ParticleSet &P) override
Evaluate the local energy contribution of this component.
bool is_active
true, if CoulombAA for quantum particleset
Return_t value_
current value
Definition: OperatorBase.h:524

◆ get()

bool get ( std::ostream &  os) const
inlineoverridevirtual

write about the class

Implements OperatorBase.

Definition at line 358 of file CoulombPotential.h.

References OhmmsElementBase::getName(), CoulombPotential< T >::myTableIndex, and CoulombPotential< T >::Pa.

359  {
360  if (myTableIndex)
361  os << "CoulombAB source=" << Pa.getName() << std::endl;
362  else
363  os << "CoulombAA source/target " << Pa.getName() << std::endl;
364  return true;
365  }
const std::string & getName() const
return the name
const int myTableIndex
distance table index
ParticleSet & Pa
source particle set

◆ getClassName()

std::string getClassName ( ) const
inlineoverridevirtual

return class name

Implements OperatorBase.

Definition at line 109 of file CoulombPotential.h.

109 { return "CoulombPotential"; }

◆ makeClone()

std::unique_ptr<OperatorBase> makeClone ( ParticleSet qp,
TrialWaveFunction psi 
)
inlineoverridevirtual

Implements OperatorBase.

Definition at line 382 of file CoulombPotential.h.

References CoulombPotential< T >::ComputeForces, CoulombPotential< T >::is_AA, CoulombPotential< T >::is_active, and CoulombPotential< T >::Pa.

383  {
384  if (is_AA)
385  {
386  if (is_active)
387  return std::make_unique<CoulombPotential>(qp, true, ComputeForces);
388  else
389  // Ye Luo April 16th, 2015
390  // avoid recomputing ion-ion DistanceTable when reusing ParticleSet
391  return std::make_unique<CoulombPotential>(Pa, false, ComputeForces, true);
392  }
393  else
394  return std::make_unique<CoulombPotential>(Pa, qp, true);
395  }
ParticleSet & Pa
source particle set
const bool is_AA
true if the table is AA
bool is_active
true, if CoulombAA for quantum particleset
bool ComputeForces
Flag for whether to compute forces or not.

◆ put()

bool put ( xmlNodePtr  cur)
inlineoverridevirtual

Read the input parameter.

Parameters
curxml node for a OperatorBase object

Implements OperatorBase.

Definition at line 356 of file CoulombPotential.h.

356 { return true; }

◆ resetTargetParticleSet()

void resetTargetParticleSet ( ParticleSet P)
inlineoverridevirtual

Reset the data with the target ParticleSet.

Parameters
Pnew target ParticleSet

Implements OperatorBase.

Definition at line 316 of file CoulombPotential.h.

317  {
318  //myTableIndex is the same
319  }

◆ setObservables()

void setObservables ( PropertySetType plist)
inlineoverridevirtual

Set the values evaluated by this object to plist Default implementation is to assign Value which is updated by evaluate function using my_index_.

Parameters
plistRecordNameProperty

Reimplemented from OperatorBase.

Definition at line 367 of file CoulombPotential.h.

References CoulombPotential< T >::ComputeForces, OperatorBase::setObservables(), and ForceBase::setObservablesF().

368  {
370  if (ComputeForces)
371  setObservablesF(plist);
372  }
void setObservablesF(QMCTraits::PropertySetType &plist)
Definition: ForceBase.cpp:86
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...

◆ setParticlePropertyList()

void setParticlePropertyList ( PropertySetType plist,
int  offset 
)
inlineoverridevirtual

Reimplemented from OperatorBase.

Definition at line 374 of file CoulombPotential.h.

References CoulombPotential< T >::ComputeForces, OperatorBase::setParticlePropertyList(), and ForceBase::setParticleSetF().

375  {
377  if (ComputeForces)
378  setParticleSetF(plist, offset);
379  }
void setParticleSetF(QMCTraits::PropertySetType &plist, int offset)
Definition: ForceBase.cpp:113
virtual void setParticlePropertyList(PropertySetType &plist, int offset)
bool ComputeForces
Flag for whether to compute forces or not.

◆ updateSource()

void updateSource ( ParticleSet s)
inlineoverridevirtual

Update data associated with a particleset.

Default implementation does nothing. Only A-A interactions for s needs to implement its own method.

Parameters
ssource particle set

Reimplemented from OperatorBase.

Definition at line 323 of file CoulombPotential.h.

References CoulombPotential< T >::evaluateAA(), CoulombPotential< T >::is_AA, CoulombPotential< T >::myTableIndex, qmcplusplus::Units::time::s, and OperatorBase::value_.

324  {
325  if (is_AA)
326  {
327  value_ = evaluateAA(s.getDistTableAA(myTableIndex), s.Z.first_address());
328  }
329  }
const int myTableIndex
distance table index
const bool is_AA
true if the table is AA
Return_t value_
current value
Definition: OperatorBase.h:524
T evaluateAA(const DistanceTableAA &d, const ParticleScalar *restrict Z)
evaluate AA-type interactions

Member Data Documentation

◆ ComputeForces

◆ is_AA

◆ is_active

◆ myTableIndex

◆ nCenters

◆ Pa

◆ Pb

target particle set

Definition at line 42 of file CoulombPotential.h.

Referenced by CoulombPotential< T >::checkoutParticleQuantities().

◆ Va_sample

◆ Vb_sample


The documentation for this struct was generated from the following file: