QMCPACK
SkPot Class Reference

SkPot evaluate the structure factor of the target particleset. More...

+ Inheritance diagram for SkPot:
+ Collaboration diagram for SkPot:

Public Member Functions

 SkPot (ParticleSet &elns)
 
std::string getClassName () const override
 return class name More...
 
void resetTargetParticleSet (ParticleSet &P) override
 Reset the data with the target ParticleSet. More...
 
Return_t evaluate (ParticleSet &P) override
 Evaluate the local energy contribution of this component. More...
 
bool put (xmlNodePtr cur) override
 Read the input parameter. More...
 
bool get (std::ostream &os) const override
 write about the class More...
 
std::unique_ptr< OperatorBasemakeClone (ParticleSet &qp, TrialWaveFunction &psi) final
 
void FillFk ()
 
- 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 addObservables (PropertySetType &plist, BufferType &collectables)
 named values to the property list Default implementaton uses addValue(plist_) 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 setObservables (PropertySetType &plist)
 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...
 
virtual void setParticlePropertyList (PropertySetType &plist, int offset)
 
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...
 

Protected Member Functions

void resize ()
 resize the internal data More...
 
- 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

ParticleSetsourcePtcl
 
int NumSpecies
 number of species More...
 
int NumK
 number of kpoints More...
 
int MaxKshell
 number of kshells More...
 
RealType OneOverN
 normalization factor More...
 
std::vector< int > Kshell
 kshell counters More...
 
std::vector< RealTypeKmag
 instantaneous structure factor More...
 
std::vector< RealTypeOneOverDnk
 1.0/degenracy for a ksell More...
 
Vector< ComplexTypeRhokTot
 $rho_k = \sum_{\alpha} \rho_k^{\alpha} $ for species index $\alpha$ More...
 
Vector< RealTypeFk
 
RealType V_0
 
RealType K_0
 
bool hdf5_out
 
- 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_
 

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 > >
 

Detailed Description

SkPot evaluate the structure factor of the target particleset.

<estimator name="sk" type="sk" debug="no">

Definition at line 27 of file SkPot.h.

Constructor & Destructor Documentation

◆ SkPot()

SkPot ( ParticleSet elns)

Definition at line 21 of file SkPot.cpp.

References SkPot::Fk, ParticleSet::getSimulationCell(), ParticleSet::getSpeciesSet(), SpeciesSet::getTotalNum(), ParticleSet::getTotalNum(), SkPot::Kmag, SkPot::Kshell, SkPot::MaxKshell, SkPot::NumK, SkPot::NumSpecies, SkPot::OneOverDnk, SkPot::OneOverN, Vector< T, Alloc >::resize(), SkPot::RhokTot, SkPot::sourcePtcl, and qmcplusplus::sqrt().

22 {
23  sourcePtcl = &source;
24  NumSpecies = source.getSpeciesSet().getTotalNum();
25  NumK = source.getSimulationCell().getKLists().numk;
26  OneOverN = 1.0 / static_cast<RealType>(source.getTotalNum());
27  Kshell = source.getSimulationCell().getKLists().kshell;
28  MaxKshell = Kshell.size() - 1;
30  Fk.resize(NumK);
31  Kmag.resize(MaxKshell);
32  OneOverDnk.resize(MaxKshell);
33  for (int ks = 0; ks < MaxKshell; ks++)
34  {
35  Kmag[ks] = std::sqrt(source.getSimulationCell().getKLists().ksq[Kshell[ks]]);
36  OneOverDnk[ks] = 1.0 / static_cast<RealType>(Kshell[ks + 1] - Kshell[ks]);
37  }
38 }
void resize(size_type n, Type_t val=Type_t())
Resize the container.
Definition: OhmmsVector.h:166
Vector< ComplexType > RhokTot
for species index
Definition: SkPot.h:71
int NumSpecies
number of species
Definition: SkPot.h:57
std::vector< RealType > OneOverDnk
1.0/degenracy for a ksell
Definition: SkPot.h:69
Vector< RealType > Fk
Definition: SkPot.h:72
std::vector< int > Kshell
kshell counters
Definition: SkPot.h:65
std::vector< RealType > Kmag
instantaneous structure factor
Definition: SkPot.h:67
RealType OneOverN
normalization factor
Definition: SkPot.h:63
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
int NumK
number of kpoints
Definition: SkPot.h:59
ParticleSet * sourcePtcl
Definition: SkPot.h:55
int MaxKshell
number of kshells
Definition: SkPot.h:61

Member Function Documentation

◆ evaluate()

SkPot::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 42 of file SkPot.cpp.

43 {
44  throw std::runtime_error("SkPot::evaluate not implemented. There was an implementation with"
45  " complex-valued storage that may be resurrected using real-valued storage.");
46 }

◆ FillFk()

void FillFk ( )
inline

Definition at line 41 of file SkPot.h.

References qmcplusplus::dot(), qmcplusplus::exp(), SkPot::Fk, ParticleSet::getSimulationCell(), SkPot::K_0, SkPot::NumK, SkPot::OneOverN, SkPot::sourcePtcl, qmcplusplus::sqrt(), and SkPot::V_0.

Referenced by SkPot::put().

42  {
43  for (int ki = 0; ki < NumK; ki++)
44  {
45  RealType k = dot(sourcePtcl->getSimulationCell().getKLists().kpts_cart[ki],
46  sourcePtcl->getSimulationCell().getKLists().kpts_cart[ki]);
47  k = std::sqrt(k) - K_0;
48  Fk[ki] = OneOverN * V_0 * std::exp(-k * k);
49  // app_log()<<ki<<": "<<Fk[ki] << std::endl;
50  }
51  }
RealType V_0
Definition: SkPot.h:73
const auto & getSimulationCell() const
Definition: ParticleSet.h:250
Vector< RealType > Fk
Definition: SkPot.h:72
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
RealType OneOverN
normalization factor
Definition: SkPot.h:63
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
int NumK
number of kpoints
Definition: SkPot.h:59
RealType K_0
Definition: SkPot.h:73
ParticleSet * sourcePtcl
Definition: SkPot.h:55
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ get()

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

write about the class

Implements OperatorBase.

Definition at line 62 of file SkPot.cpp.

62 { return true; }

◆ getClassName()

std::string getClassName ( ) const
inlineoverridevirtual

return class name

Implements OperatorBase.

Definition at line 32 of file SkPot.h.

32 { return "SkPot"; }

◆ makeClone()

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

Implements OperatorBase.

Definition at line 64 of file SkPot.cpp.

65 {
66  std::unique_ptr<SkPot> myclone = std::make_unique<SkPot>(*this);
67  myclone->FillFk();
68  return myclone;
69 }

◆ put()

bool put ( xmlNodePtr  cur)
overridevirtual

Read the input parameter.

Parameters
curxml node for a OperatorBase object

Implements OperatorBase.

Definition at line 48 of file SkPot.cpp.

References OhmmsAttributeSet::add(), qmcplusplus::app_log(), SkPot::FillFk(), SkPot::K_0, OhmmsAttributeSet::put(), and SkPot::V_0.

49 {
50  OhmmsAttributeSet Tattrib;
51  Tattrib.add(K_0, "k0");
52  Tattrib.add(V_0, "v0");
53  Tattrib.put(cur);
54  app_log() << "KSpacePot parameters" << std::endl;
55  app_log() << " k0: " << K_0 << std::endl;
56  app_log() << " v0: " << V_0 << std::endl;
57  FillFk();
58  return true;
59 }
void FillFk()
Definition: SkPot.h:41
std::ostream & app_log()
Definition: OutputManager.h:65
RealType V_0
Definition: SkPot.h:73
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
RealType K_0
Definition: SkPot.h:73
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

◆ resetTargetParticleSet()

void resetTargetParticleSet ( ParticleSet P)
overridevirtual

Reset the data with the target ParticleSet.

Parameters
Pnew target ParticleSet

Implements OperatorBase.

Definition at line 40 of file SkPot.cpp.

References SkPot::sourcePtcl.

40 { sourcePtcl = &P; }
ParticleSet * sourcePtcl
Definition: SkPot.h:55

◆ resize()

void resize ( )
protected

resize the internal data

The argument list is not completed

Member Data Documentation

◆ Fk

Vector<RealType> Fk
protected

Definition at line 72 of file SkPot.h.

Referenced by SkPot::FillFk(), and SkPot::SkPot().

◆ hdf5_out

bool hdf5_out
protected

Definition at line 80 of file SkPot.h.

◆ K_0

RealType K_0
protected

Definition at line 73 of file SkPot.h.

Referenced by SkPot::FillFk(), and SkPot::put().

◆ Kmag

std::vector<RealType> Kmag
protected

instantaneous structure factor

Definition at line 67 of file SkPot.h.

Referenced by SkPot::SkPot().

◆ Kshell

std::vector<int> Kshell
protected

kshell counters

Definition at line 65 of file SkPot.h.

Referenced by SkPot::SkPot().

◆ MaxKshell

int MaxKshell
protected

number of kshells

Definition at line 61 of file SkPot.h.

Referenced by SkPot::SkPot().

◆ NumK

int NumK
protected

number of kpoints

Definition at line 59 of file SkPot.h.

Referenced by SkPot::FillFk(), and SkPot::SkPot().

◆ NumSpecies

int NumSpecies
protected

number of species

Definition at line 57 of file SkPot.h.

Referenced by SkPot::SkPot().

◆ OneOverDnk

std::vector<RealType> OneOverDnk
protected

1.0/degenracy for a ksell

Definition at line 69 of file SkPot.h.

Referenced by SkPot::SkPot().

◆ OneOverN

RealType OneOverN
protected

normalization factor

Definition at line 63 of file SkPot.h.

Referenced by SkPot::FillFk(), and SkPot::SkPot().

◆ RhokTot

Vector<ComplexType> RhokTot
protected

$rho_k = \sum_{\alpha} \rho_k^{\alpha} $ for species index $\alpha$

Definition at line 71 of file SkPot.h.

Referenced by SkPot::SkPot().

◆ sourcePtcl

ParticleSet* sourcePtcl
protected

Definition at line 55 of file SkPot.h.

Referenced by SkPot::FillFk(), SkPot::resetTargetParticleSet(), and SkPot::SkPot().

◆ V_0

RealType V_0
protected

Definition at line 73 of file SkPot.h.

Referenced by SkPot::FillFk(), and SkPot::put().


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