QMCPACK
ForceChiesaPBCAA Struct Reference
+ Inheritance diagram for ForceChiesaPBCAA:
+ Collaboration diagram for ForceChiesaPBCAA:

Public Types

using LRHandlerType = LRCoulombSingleton::LRHandlerType
 
using GridType = LRCoulombSingleton::GridType
 
using RadFunctorType = LRCoulombSingleton::RadFunctorType
 
- 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...
 

Public Member Functions

 ForceChiesaPBCAA (ParticleSet &ions, ParticleSet &elns, bool firsttime=true)
 
std::string getClassName () const override
 return class name More...
 
Return_t evaluate (ParticleSet &P) override
 Evaluate the local energy contribution of this component. More...
 
void InitMatrix ()
 
void initBreakup (ParticleSet &P)
 
void evaluateLR (ParticleSet &)
 
void evaluateSR (ParticleSet &)
 
void evaluateSR_AA ()
 
void evaluateLR_AA ()
 
Return_t g_filter (RealType r)
 
void registerObservables (std::vector< ObservableHelper > &h5list, hdf_archive &file) const override
 add to observable descriptor for hdf5 The default implementation is to register a scalar for this->value_ More...
 
void addObservables (PropertySetType &plist, BufferType &collectables) override
 named values to the property list Default implementaton uses addValue(plist_) 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
 
void resetTargetParticleSet (ParticleSet &P) override
 Reset the data with the target ParticleSet. More...
 
std::unique_ptr< OperatorBasemakeClone (ParticleSet &qp, TrialWaveFunction &psi) final
 
bool put (xmlNodePtr cur) override
 Read the input parameter. More...
 
bool get (std::ostream &os) const override
 write about the class More...
 
int getDistanceTableAAID () const
 
- 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 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 evaluateWithIonDerivs (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 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 void updateSource (ParticleSet &s)
 Update data associated with a particleset. 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

RealType Rcut
 
int m_exp
 
int N_basis
 
Matrix< RealTypeSinv
 
Vector< RealTypeh
 
Vector< RealTypec
 
ParticleSetPtclA
 source particle set More...
 
std::unique_ptr< LRHandlerTypedAB
 long-range Handler More...
 
int NumSpeciesA
 number of species of A particle set More...
 
int NumSpeciesB
 number of species of B particle set More...
 
int NptclA
 number of particles of A More...
 
int NptclB
 number of particles of B More...
 
std::vector< RealTypeZat
 Zat[iat] charge for the iat-th particle of A. More...
 
std::vector< RealTypeQat
 Qat[iat] charge for the iat-th particle of B. More...
 
std::vector< RealTypeZspec
 Zspec[spec] charge for the spec-th species of A. More...
 
std::vector< RealTypeQspec
 Qspec[spec] charge for the spec-th species of B. More...
 
bool first_time
 

Private Attributes

const int d_aa_ID
 
const int d_ei_ID
 

Additional Inherited Members

- Protected Member Functions inherited from OperatorBase
virtual void contributeScalarQuantities ()
 
virtual void checkoutScalarQuantities (TraceManager &tm)
 
virtual void collectScalarQuantities ()
 
virtual void deleteScalarQuantities ()
 
virtual void contributeParticleQuantities ()
 
virtual void checkoutParticleQuantities (TraceManager &tm)
 
virtual void deleteParticleQuantities ()
 
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

Definition at line 25 of file ForceChiesaPBCAA.h.

Member Typedef Documentation

◆ GridType

Definition at line 28 of file ForceChiesaPBCAA.h.

◆ LRHandlerType

◆ RadFunctorType

Constructor & Destructor Documentation

◆ ForceChiesaPBCAA()

ForceChiesaPBCAA ( ParticleSet ions,
ParticleSet elns,
bool  firsttime = true 
)

Definition at line 25 of file ForceChiesaPBCAA.cpp.

References qmcplusplus::app_log(), ForceChiesaPBCAA::evaluateLR_AA(), ForceChiesaPBCAA::evaluateSR_AA(), ForceChiesaPBCAA::first_time, ForceBase::forces_, ForceBase::forces_ion_ion_, ForceChiesaPBCAA::initBreakup(), ForceChiesaPBCAA::m_exp, ForceChiesaPBCAA::N_basis, OperatorBase::name_, ForceBase::prefix_, ForceChiesaPBCAA::Rcut, ParticleSet::turnOnPerParticleSK(), and ParticleSet::update().

26  : ForceBase(ions, elns),
27  PtclA(ions),
28  first_time(firsttime),
29  d_aa_ID(ions.addTable(ions)),
30  d_ei_ID(elns.addTable(ions))
31 {
32  ReportEngine PRE("ForceChiesaPBCAA", "ForceChiesaPBCAA");
33  name_ = "Chiesa_Force_Base_PBCAB";
34  prefix_ = "FChiesaPBC";
35  //Defaults for the chiesa S-wave polynomial filtering.
36  Rcut = 0.4;
37  m_exp = 2;
38  N_basis = 4;
39  forces_ = 0.0;
40  forces_ion_ion_ = 0.0;
41  ions.turnOnPerParticleSK();
42  //This sets up the long range breakups.
43  initBreakup(elns);
44  if (first_time == true)
45  { // calculate ion-ion forces and print in output
46  ions.update();
47  evaluateLR_AA();
48  evaluateSR_AA();
49  app_log() << "IonIon Force" << std::endl;
50  app_log() << forces_ion_ion_ << std::endl;
51  first_time = false;
52  }
53 }
ParticleSet & PtclA
source particle set
ParticleSet::ParticlePos forces_
Definition: ForceBase.h:87
std::ostream & app_log()
Definition: OutputManager.h:65
ForceBase(ParticleSet &ions, ParticleSet &elns)
Definition: ForceBase.cpp:28
std::string prefix_
Definition: ForceBase.h:96
void initBreakup(ParticleSet &P)
std::string name_
name of this object
Definition: OperatorBase.h:527
ParticleSet::ParticlePos forces_ion_ion_
Definition: ForceBase.h:88

Member Function Documentation

◆ addObservables()

void addObservables ( PropertySetType plist,
BufferType collectables 
)
overridevirtual

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 226 of file ForceChiesaPBCAA.cpp.

References RecordNamedProperty< T >::add(), ForceBase::addObservablesF(), OperatorBase::my_index_, and OperatorBase::name_.

227 {
228  my_index_ = plist.add(name_.c_str());
229  addObservablesF(plist);
230 }
int my_index_
starting index of this object
Definition: OperatorBase.h:535
void addObservablesF(QMCTraits::PropertySetType &plist)
Definition: ForceBase.cpp:47
std::string name_
name of this object
Definition: OperatorBase.h:527

◆ evaluate()

ForceChiesaPBCAA::Return_t evaluate ( ParticleSet P)
overridevirtual

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 173 of file ForceChiesaPBCAA.cpp.

References ForceBase::add_ion_ion_, ForceChiesaPBCAA::evaluateLR(), ForceChiesaPBCAA::evaluateSR(), ForceBase::forces_, and ForceBase::forces_ion_ion_.

Referenced by qmcplusplus::TEST_CASE().

174 {
175  forces_ = 0.0;
176  evaluateLR(P);
177  evaluateSR(P);
178  if (add_ion_ion_ == true)
180  return 0.0;
181 }
ParticleSet::ParticlePos forces_
Definition: ForceBase.h:87
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.
Definition: ForceBase.h:84
ParticleSet::ParticlePos forces_ion_ion_
Definition: ForceBase.h:88

◆ evaluateLR()

void evaluateLR ( ParticleSet P)

Definition at line 104 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::dAB, ForceBase::forces_, ParticleSet::getTotalNum(), ForceChiesaPBCAA::NumSpeciesB, ForceChiesaPBCAA::PtclA, ForceChiesaPBCAA::Qspec, and ForceChiesaPBCAA::Zat.

Referenced by ForceChiesaPBCAA::evaluate(), and qmcplusplus::TEST_CASE().

105 {
106  std::vector<TinyVector<RealType, DIM>> grad(PtclA.getTotalNum());
107  for (int j = 0; j < NumSpeciesB; j++)
108  {
109  for (int iat = 0; iat < grad.size(); iat++)
110  grad[iat] = TinyVector<RealType, DIM>(0.0, 0.0, 0.0);
111  dAB->evaluateGrad(PtclA, P, j, Zat, grad);
112  for (int iat = 0; iat < grad.size(); iat++)
113  {
114  forces_[iat] += Qspec[j] * grad[iat];
115  }
116  } // electron species
117 }
std::unique_ptr< LRHandlerType > dAB
long-range Handler
ParticleSet & PtclA
source particle set
ParticleSet::ParticlePos forces_
Definition: ForceBase.h:87
size_t getTotalNum() const
Definition: ParticleSet.h:493
std::vector< RealType > Zat
Zat[iat] charge for the iat-th particle of A.
int NumSpeciesB
number of species of B particle set
std::vector< RealType > Qspec
Qspec[spec] charge for the spec-th species of B.

◆ evaluateLR_AA()

void evaluateLR_AA ( )

Definition at line 155 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::dAB, ForceBase::forces_ion_ion_, ParticleSet::getTotalNum(), ForceChiesaPBCAA::NumSpeciesA, ForceChiesaPBCAA::PtclA, ForceChiesaPBCAA::Zat, and ForceChiesaPBCAA::Zspec.

Referenced by ForceChiesaPBCAA::ForceChiesaPBCAA().

156 {
157  std::vector<TinyVector<RealType, DIM>> grad(PtclA.getTotalNum());
158  for (int spec2 = 0; spec2 < NumSpeciesA; spec2++)
159  {
160  RealType Z2 = Zspec[spec2];
161  for (int iat = 0; iat < grad.size(); iat++)
162  grad[iat] = TinyVector<RealType, DIM>(0.0);
163  dAB->evaluateGrad(PtclA, PtclA, spec2, Zat, grad);
164 
165  for (int iat = 0; iat < grad.size(); iat++)
166  {
167  forces_ion_ion_[iat] += Z2 * grad[iat];
168  }
169  } //spec2
170 }
std::unique_ptr< LRHandlerType > dAB
long-range Handler
ParticleSet & PtclA
source particle set
size_t getTotalNum() const
Definition: ParticleSet.h:493
std::vector< RealType > Zat
Zat[iat] charge for the iat-th particle of A.
int NumSpeciesA
number of species of A particle set
QMCTraits::RealType RealType
ParticleSet::ParticlePos forces_ion_ion_
Definition: ForceBase.h:88
std::vector< RealType > Zspec
Zspec[spec] charge for the spec-th species of A.

◆ evaluateSR()

void evaluateSR ( ParticleSet P)

Definition at line 119 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::d_ei_ID, ForceChiesaPBCAA::dAB, ForceBase::forces_, ForceChiesaPBCAA::g_filter(), ParticleSet::getDistTableAB(), ForceChiesaPBCAA::NptclA, ForceChiesaPBCAA::NptclB, ForceChiesaPBCAA::Qat, and ForceChiesaPBCAA::Zat.

Referenced by ForceChiesaPBCAA::evaluate(), and qmcplusplus::TEST_CASE().

120 {
121  const auto& d_ab(P.getDistTableAB(d_ei_ID));
122  for (size_t jat = 0; jat < NptclB; ++jat)
123  {
124  const auto& dist = d_ab.getDistRow(jat);
125  const auto& displ = d_ab.getDisplRow(jat);
126  for (size_t iat = 0; iat < NptclA; ++iat)
127  {
128  const RealType r = dist[iat];
129  const RealType rinv = RealType(1) / r;
130  RealType g_f = g_filter(r);
131  RealType V = -dAB->srDf(r, rinv);
132  PosType drhat = rinv * displ[iat];
133  forces_[iat] += g_f * Zat[iat] * Qat[jat] * V * drhat;
134  }
135  }
136 }
std::unique_ptr< LRHandlerType > dAB
long-range Handler
QTBase::RealType RealType
Definition: Configuration.h:58
ParticleSet::ParticlePos forces_
Definition: ForceBase.h:87
int NptclA
number of particles of A
std::vector< RealType > Zat
Zat[iat] charge for the iat-th particle of A.
QMCTraits::PosType PosType
int NptclB
number of particles of B
std::vector< RealType > Qat
Qat[iat] charge for the iat-th particle of B.
QMCTraits::RealType RealType

◆ evaluateSR_AA()

void evaluateSR_AA ( )

Definition at line 138 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::d_aa_ID, ForceChiesaPBCAA::dAB, ForceBase::forces_ion_ion_, ParticleSet::getDistTableAA(), ForceChiesaPBCAA::NptclA, ForceChiesaPBCAA::PtclA, and ForceChiesaPBCAA::Zat.

Referenced by ForceChiesaPBCAA::ForceChiesaPBCAA().

139 {
140  const auto& d_aa(PtclA.getDistTableAA(d_aa_ID));
141  for (size_t ipart = 1; ipart < NptclA; ipart++)
142  {
143  const auto& dist = d_aa.getDistRow(ipart);
144  const auto& displ = d_aa.getDisplRow(ipart);
145  for (size_t jpart = 0; jpart < ipart; ++jpart)
146  {
147  RealType V = -dAB->srDf(dist[jpart], RealType(1) / dist[jpart]);
148  PosType grad = -Zat[jpart] * Zat[ipart] * V / dist[jpart] * displ[jpart];
149  forces_ion_ion_[ipart] += grad;
150  forces_ion_ion_[jpart] -= grad;
151  }
152  }
153 }
std::unique_ptr< LRHandlerType > dAB
long-range Handler
ParticleSet & PtclA
source particle set
const DistanceTableAA & getDistTableAA(int table_ID) const
get a distance table by table_ID and dyanmic_cast to DistanceTableAA
QTBase::RealType RealType
Definition: Configuration.h:58
int NptclA
number of particles of A
std::vector< RealType > Zat
Zat[iat] charge for the iat-th particle of A.
QMCTraits::PosType PosType
QMCTraits::RealType RealType
ParticleSet::ParticlePos forces_ion_ion_
Definition: ForceBase.h:88

◆ g_filter()

Definition at line 183 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::c, ForceChiesaPBCAA::m_exp, ForceChiesaPBCAA::N_basis, qmcplusplus::pow(), and ForceChiesaPBCAA::Rcut.

Referenced by ForceChiesaPBCAA::evaluateSR().

184 {
185  if (r >= Rcut)
186  {
187  return 1.0;
188  }
189  else
190  {
191  RealType g_q = 0.0;
192  for (int q = 0; q < N_basis; q++)
193  {
194  g_q += c[q] * std::pow(r, m_exp + q + 1);
195  }
196 
197  return g_q;
198  }
199 }
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
QMCTraits::RealType RealType

◆ get()

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

write about the class

Implements OperatorBase.

Definition at line 107 of file ForceChiesaPBCAA.h.

References ForceBase::pair_name_.

108  {
109  os << "Ceperley Force Estimator Hamiltonian: " << pair_name_;
110  return true;
111  }
std::string pair_name_
Definition: ForceBase.h:97

◆ getClassName()

std::string getClassName ( ) const
inlineoverridevirtual

return class name

Implements OperatorBase.

Definition at line 65 of file ForceChiesaPBCAA.h.

65 { return "ForceChiesaPBCAA"; }

◆ getDistanceTableAAID()

int getDistanceTableAAID ( ) const
inline

Definition at line 114 of file ForceChiesaPBCAA.h.

References ForceChiesaPBCAA::d_aa_ID.

Referenced by qmcplusplus::check_force_copy().

114 { return d_aa_ID; }

◆ initBreakup()

void initBreakup ( ParticleSet P)

Definition at line 74 of file ForceChiesaPBCAA.cpp.

References SpeciesSet::addAttribute(), ForceChiesaPBCAA::dAB, qmcplusplus::for(), LRCoulombSingleton::getDerivHandler(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ParticleSet::GroupID, ForceChiesaPBCAA::NptclA, ForceChiesaPBCAA::NptclB, ForceChiesaPBCAA::NumSpeciesA, ForceChiesaPBCAA::NumSpeciesB, ForceChiesaPBCAA::PtclA, ForceChiesaPBCAA::Qat, ForceChiesaPBCAA::Qspec, ForceChiesaPBCAA::Zat, and ForceChiesaPBCAA::Zspec.

Referenced by ForceChiesaPBCAA::ForceChiesaPBCAA().

75 {
76  SpeciesSet& tspeciesA(PtclA.getSpeciesSet());
77  SpeciesSet& tspeciesB(P.getSpeciesSet());
78  int ChargeAttribIndxA = tspeciesA.addAttribute("charge");
79  int ChargeAttribIndxB = tspeciesB.addAttribute("charge");
81  NptclB = P.getTotalNum();
82  NumSpeciesA = tspeciesA.TotalNum;
83  NumSpeciesB = tspeciesB.TotalNum;
84  //Store information about charges and number of each species
85  Zat.resize(NptclA);
86  Zspec.resize(NumSpeciesA);
87  Qat.resize(NptclB);
88  Qspec.resize(NumSpeciesB);
89  for (int spec = 0; spec < NumSpeciesA; spec++)
90  {
91  Zspec[spec] = tspeciesA(ChargeAttribIndxA, spec);
92  }
93  for (int spec = 0; spec < NumSpeciesB; spec++)
94  {
95  Qspec[spec] = tspeciesB(ChargeAttribIndxB, spec);
96  }
97  for (int iat = 0; iat < NptclA; iat++)
98  Zat[iat] = Zspec[PtclA.GroupID[iat]];
99  for (int iat = 0; iat < NptclB; iat++)
100  Qat[iat] = Qspec[P.GroupID[iat]];
102 }
static std::unique_ptr< LRHandlerType > getDerivHandler(ParticleSet &ref)
This returns a force/stress optimized LR handler. If non existent, it creates one.
std::unique_ptr< LRHandlerType > dAB
long-range Handler
ParticleSet & PtclA
source particle set
size_t getTotalNum() const
Definition: ParticleSet.h:493
int NptclA
number of particles of A
std::vector< RealType > Zat
Zat[iat] charge for the iat-th particle of A.
ParticleIndex GroupID
Species ID.
Definition: ParticleSet.h:77
for(int i=0;i< size_test;++i) CHECK(Approx(gauss_random_vals[offset_for_rs+i])
int NumSpeciesB
number of species of B particle set
int NptclB
number of particles of B
SpeciesSet & getSpeciesSet()
retrun the SpeciesSet of this particle set
Definition: ParticleSet.h:231
std::vector< RealType > Qat
Qat[iat] charge for the iat-th particle of B.
int NumSpeciesA
number of species of A particle set
std::vector< RealType > Zspec
Zspec[spec] charge for the spec-th species of A.
std::vector< RealType > Qspec
Qspec[spec] charge for the spec-th species of B.

◆ InitMatrix()

void InitMatrix ( )

Definition at line 55 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::c, ForceChiesaPBCAA::h, qmcplusplus::invert_matrix(), ForceChiesaPBCAA::m_exp, ForceChiesaPBCAA::N_basis, qmcplusplus::pow(), qmcplusplus::MatrixOperators::product(), ForceChiesaPBCAA::Rcut, Matrix< T, Alloc >::resize(), Vector< T, Alloc >::resize(), and ForceChiesaPBCAA::Sinv.

Referenced by ForceChiesaPBCAA::put(), and qmcplusplus::TEST_CASE().

56 {
58  h.resize(N_basis);
59  c.resize(N_basis);
60  for (int k = 0; k < N_basis; k++)
61  {
62  h[k] = std::pow(Rcut, (k + 2)) / static_cast<RealType>(k + 2);
63  for (int j = 0; j < N_basis; j++)
64  {
65  Sinv(k, j) = std::pow(Rcut, (m_exp + k + j + 3)) / static_cast<RealType>(m_exp + k + j + 3);
66  }
67  }
68  // in Numerics/DeterminantOperators.h
69  invert_matrix(Sinv, false);
70  // in Numerics/MatrixOperators.h
72 }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
MatrixA::value_type invert_matrix(MatrixA &M, bool getdet=true)
invert a matrix
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
void product(const Matrix< T > &A, const Matrix< T > &B, Matrix< T > &C)
static function to perform C=AB for real matrices
QMCTraits::RealType RealType

◆ makeClone()

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

Implements OperatorBase.

Definition at line 232 of file ForceChiesaPBCAA.cpp.

References ForceBase::add_ion_ion_, ForceChiesaPBCAA::c, ForceBase::forces_ion_ion_, ForceChiesaPBCAA::h, ForceChiesaPBCAA::m_exp, ForceChiesaPBCAA::N_basis, ForceChiesaPBCAA::PtclA, ForceChiesaPBCAA::Rcut, Matrix< T, Alloc >::resize(), Vector< T, Alloc >::resize(), and ForceChiesaPBCAA::Sinv.

Referenced by qmcplusplus::TEST_CASE().

233 {
234  std::unique_ptr<ForceChiesaPBCAA> tmp = std::make_unique<ForceChiesaPBCAA>(PtclA, qp, false);
235  tmp->Rcut = Rcut; // parameter: radial distance within which estimator is used
236  tmp->m_exp = m_exp; // parameter: exponent in polynomial fit
237  tmp->N_basis = N_basis; // parameter: size of polynomial basis set
238  tmp->Sinv.resize(N_basis, N_basis);
239  tmp->Sinv = Sinv; // terms in fitting polynomial
240  tmp->h.resize(N_basis);
241  tmp->h = h; // terms in fitting polynomial
242  tmp->c.resize(N_basis);
243  tmp->c = c; // polynomial coefficients
244  tmp->add_ion_ion_ = add_ion_ion_;
245  tmp->forces_ion_ion_ = forces_ion_ion_;
246  tmp->initBreakup(qp);
247  return tmp;
248 }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
ParticleSet & PtclA
source particle set
void resize(size_type n, size_type m)
Resize the container.
Definition: OhmmsMatrix.h:99
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.
Definition: ForceBase.h:84
ParticleSet::ParticlePos forces_ion_ion_
Definition: ForceBase.h:88

◆ put()

bool put ( xmlNodePtr  cur)
overridevirtual

Read the input parameter.

Parameters
curxml node for a OperatorBase object

Implements OperatorBase.

Definition at line 201 of file ForceChiesaPBCAA.cpp.

References OhmmsAttributeSet::add(), ParameterSet::add(), ForceBase::add_ion_ion_, qmcplusplus::app_log(), ForceChiesaPBCAA::InitMatrix(), ForceChiesaPBCAA::m_exp, ForceChiesaPBCAA::N_basis, ForceBase::prefix_, ParameterSet::put(), OhmmsAttributeSet::put(), and ForceChiesaPBCAA::Rcut.

202 {
203  std::string ionionforce("yes");
204  OhmmsAttributeSet attr;
205  attr.add(prefix_, "name");
206  attr.add(ionionforce, "add_ion_ion_");
207  attr.put(cur);
208  add_ion_ion_ = (ionionforce == "yes") || (ionionforce == "true");
209  app_log() << "ionionforce = " << ionionforce << std::endl;
210  app_log() << "add_ion_ion_=" << add_ion_ion_ << std::endl;
211  ParameterSet fcep_param_set;
212  fcep_param_set.add(Rcut, "rcut");
213  fcep_param_set.add(N_basis, "nbasis");
214  fcep_param_set.add(m_exp, "weight_exp");
215  fcep_param_set.put(cur);
216  app_log() << " ForceChiesaPBCAA Parameters" << std::endl;
217  app_log() << " ForceChiesaPBCAA::Rcut=" << Rcut << std::endl;
218  app_log() << " ForceChiesaPBCAA::N_basis=" << N_basis << std::endl;
219  app_log() << " ForceChiesaPBCAA::m_exp=" << m_exp << std::endl;
220  InitMatrix();
221  return true;
222 }
std::ostream & app_log()
Definition: OutputManager.h:65
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
std::string prefix_
Definition: ForceBase.h:96
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
class to handle a set of parameters
Definition: ParameterSet.h:27
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.
Definition: ForceBase.h:84
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42

◆ registerObservables()

void registerObservables ( std::vector< ObservableHelper > &  h5desc,
hdf_archive file 
) const
inlineoverridevirtual

add to observable descriptor for hdf5 The default implementation is to register a scalar for this->value_

Parameters
h5desccontains a set of hdf5 descriptors for a scalar observable
gidhdf5 group to which the observables belong

Reimplemented from OperatorBase.

Definition at line 79 of file ForceChiesaPBCAA.h.

References ForceBase::registerObservablesF().

80  {
81  registerObservablesF(h5list, file);
82  }
void registerObservablesF(std::vector< ObservableHelper > &h5list, hdf_archive &file) const
Definition: ForceBase.cpp:75

◆ resetTargetParticleSet()

void resetTargetParticleSet ( ParticleSet P)
overridevirtual

Reset the data with the target ParticleSet.

Parameters
Pnew target ParticleSet

Implements OperatorBase.

Definition at line 224 of file ForceChiesaPBCAA.cpp.

References ForceChiesaPBCAA::dAB.

224 { dAB->resetTargetParticleSet(P); }
std::unique_ptr< LRHandlerType > dAB
long-range Handler

◆ 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 87 of file ForceChiesaPBCAA.h.

References OperatorBase::setObservables(), and ForceBase::setObservablesF().

88  {
90  setObservablesF(plist);
91  }
void setObservablesF(QMCTraits::PropertySetType &plist)
Definition: ForceBase.cpp:86
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 93 of file ForceChiesaPBCAA.h.

References OperatorBase::setParticlePropertyList(), and ForceBase::setParticleSetF().

94  {
96  setParticleSetF(plist, offset);
97  }
void setParticleSetF(QMCTraits::PropertySetType &plist, int offset)
Definition: ForceBase.cpp:113
virtual void setParticlePropertyList(PropertySetType &plist, int offset)

Member Data Documentation

◆ c

◆ d_aa_ID

const int d_aa_ID
private

◆ d_ei_ID

const int d_ei_ID
private

Definition at line 119 of file ForceChiesaPBCAA.h.

Referenced by ForceChiesaPBCAA::evaluateSR().

◆ dAB

◆ first_time

bool first_time

Definition at line 61 of file ForceChiesaPBCAA.h.

Referenced by ForceChiesaPBCAA::ForceChiesaPBCAA().

◆ h

◆ m_exp

◆ N_basis

◆ NptclA

◆ NptclB

int NptclB

number of particles of B

Definition at line 50 of file ForceChiesaPBCAA.h.

Referenced by qmcplusplus::check_force_copy(), ForceChiesaPBCAA::evaluateSR(), and ForceChiesaPBCAA::initBreakup().

◆ NumSpeciesA

int NumSpeciesA

number of species of A particle set

Definition at line 44 of file ForceChiesaPBCAA.h.

Referenced by qmcplusplus::check_force_copy(), ForceChiesaPBCAA::evaluateLR_AA(), and ForceChiesaPBCAA::initBreakup().

◆ NumSpeciesB

int NumSpeciesB

number of species of B particle set

Definition at line 46 of file ForceChiesaPBCAA.h.

Referenced by qmcplusplus::check_force_copy(), ForceChiesaPBCAA::evaluateLR(), and ForceChiesaPBCAA::initBreakup().

◆ PtclA

◆ Qat

std::vector<RealType> Qat

Qat[iat] charge for the iat-th particle of B.

Definition at line 55 of file ForceChiesaPBCAA.h.

Referenced by qmcplusplus::check_force_copy(), ForceChiesaPBCAA::evaluateSR(), and ForceChiesaPBCAA::initBreakup().

◆ Qspec

std::vector<RealType> Qspec

Qspec[spec] charge for the spec-th species of B.

Definition at line 59 of file ForceChiesaPBCAA.h.

Referenced by qmcplusplus::check_force_copy(), ForceChiesaPBCAA::evaluateLR(), and ForceChiesaPBCAA::initBreakup().

◆ Rcut

◆ Sinv

◆ Zat

◆ Zspec

std::vector<RealType> Zspec

Zspec[spec] charge for the spec-th species of A.

Definition at line 57 of file ForceChiesaPBCAA.h.

Referenced by qmcplusplus::check_force_copy(), ForceChiesaPBCAA::evaluateLR_AA(), and ForceChiesaPBCAA::initBreakup().


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