QMCPACK
OperatorBase.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2022 QMCPACK developers.
6 //
7 // File developed by: D. Das, University of Illinois at Urbana-Champaign
8 // John R. Gergely, University of Illinois at Urbana-Champaign
9 // Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
10 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
11 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
13 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
14 // Peter W. Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
15 //
16 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
17 //////////////////////////////////////////////////////////////////////////////////////
18 
19 
20 /**@file
21  *@brief Declaration of OperatorBase
22  */
23 #ifndef QMCPLUSPLUS_HAMILTONIANBASE_H
24 #define QMCPLUSPLUS_HAMILTONIANBASE_H
25 
26 #include "Particle/ParticleSet.h"
32 #if !defined(REMOVE_TRACEMANAGER)
34 #endif
37 #include <bitset>
38 #include <memory> // std::unique_ptr
39 
40 namespace qmcplusplus
41 {
42 class MCWalkerConfiguration;
43 
44 /**@defgroup hamiltonian Hamiltonian group
45  * @brief QMCHamiltonian and its component, OperatorBase
46  *
47  */
48 class TrialWaveFunction;
49 class QMCHamiltonian;
50 class ResourceCollection;
51 struct NonLocalData;
52 
53 /** @ingroup hamiltonian
54  * @brief An abstract class for Local Energy operators
55  *
56  * Return_t is defined as RealTye.
57  * The types should be checked when using complex wave functions.
58  */
59 class OperatorBase : public QMCTraits
60 {
61 public:
62  /** type of return value of evaluate
63  */
65 
66  /** For fast derivative evaluation
67  */
70 
71  /** typedef for the serialized buffer
72  *
73  * PooledData<RealType> is used to serialized an anonymous buffer
74  */
76 
77  ///typedef for the walker
79 
80  ///typedef for the ParticleScalar
82 
83  ///typedef for SPOMap
85 
86  ///enum to denote energy domain of operators
88  {
89  KINETIC = 0,
92  };
93 
95  {
102  };
103 
104  ///enum for update_mode
105  enum
106  {
107  PRIMARY = 0,
110  PHYSICAL = 3,
112  NONLOCAL = 5,
113  };
114 
115  /**
116  * @brief Construct a new Operator Base object
117  * Default and unique empty constructor. Initializes with default values.
118  */
119  OperatorBase();
120 
121  virtual ~OperatorBase() = default;
122 
123  /// return true if this operator depends on a wavefunction
124  virtual bool dependsOnWaveFunction() const { return false; }
125 
126  //////// GETTER AND SETTER FUNCTIONS ////////////////
127 
128  /**
129  * @brief get update_mode_ reference
130  *
131  * @return std::bitset<8>& reference of get_update_mode_
132  */
133  std::bitset<8>& getUpdateMode() noexcept;
134 
135  /**
136  * @brief get a copy of value_
137  *
138  * @return Return_t copy of value_
139  */
140  Return_t getValue() const noexcept;
141 
142  /**
143  * @brief getter a copy of my_name_, rvalue small string optimization
144  *
145  * @return std::string copy of my_name_ member
146  */
147  std::string getName() const noexcept;
148 
149  /// return class name
150  virtual std::string getClassName() const = 0;
151 
152  /**
153  * @brief Set my_name member, uses small string optimization (pass by value)
154  *
155  * @param name input
156  */
157  void setName(const std::string name) noexcept;
158 
159 #if !defined(REMOVE_TRACEMANAGER)
160  /**
161  * @brief Get request_ member
162  *
163  * @return TraceRequest& reference to request_
164  */
165  TraceRequest& getRequest() noexcept;
166 #endif
167 
168  //////// PURELY VIRTUAL FUNCTIONS ////////////////
169  /**
170  * @brief Reset the data with the target ParticleSet
171  * @param P new target ParticleSet
172  */
173  virtual void resetTargetParticleSet(ParticleSet& P) = 0;
174 
175  /**
176  * @brief Evaluate the local energy contribution of this component
177  * @param P input configuration containing N particles
178  * @return the value of the Hamiltonian component
179  */
180  virtual Return_t evaluate(ParticleSet& P) = 0;
181 
182  /** write about the class */
183  virtual bool get(std::ostream& os) const = 0;
184 
185  // TODO: add docs
186  virtual std::unique_ptr<OperatorBase> makeClone(ParticleSet& qp, TrialWaveFunction& psi) = 0;
187 
188  //////// VIRTUAL FUNCTIONS ////////////////
189 
190  /**
191  * @brief named values to the property list
192  * Default implementaton uses addValue(plist_)
193  *
194  * @param plist RecordNameProperty
195  * @param collectables Observables that are accumulated by evaluate
196  */
197  virtual void addObservables(PropertySetType& plist, BufferType& collectables);
198 
199  /**
200  * @brief add to observable descriptor for hdf5
201  * The default implementation is to register a scalar for this->value_
202  *
203  * @param h5desc contains a set of hdf5 descriptors for a scalar observable
204  * @param gid hdf5 group to which the observables belong
205  */
206  virtual void registerObservables(std::vector<ObservableHelper>& h5desc, hdf_archive& file) const;
207 
208  /***
209  * @brief add to collectables descriptor for hdf5
210  * The default implementation does nothing. The derived classes which compute
211  * big data, e.g. density, should overwrite this function.
212  *
213  * @param h5desc contains a set of hdf5 descriptors for a scalar observable
214  * @param gid hdf5 group to which the observables belong
215  */
216  virtual void registerCollectables(std::vector<ObservableHelper>& h5desc, hdf_archive& file) const;
217 
218  /**
219  * @brief Set the values evaluated by this object to plist
220  * Default implementation is to assign Value which is updated
221  * by evaluate function using my_index_.
222  *
223  * @param plist RecordNameProperty
224  */
225  virtual void setObservables(PropertySetType& plist);
226 
227  // TODO: add docs
228  virtual void setParticlePropertyList(PropertySetType& plist, int offset);
229 
230  // TODO: add docs
231  virtual void setHistories(Walker_t& ThisWalker);
232 
233  /**
234  * @brief Evaluate the local energy contribution of this component, deterministically based on current state.
235  * The correct behavior of this routine requires estimators with non-deterministic components
236  * in their evaluate() function to override this function.
237 
238  * @param P input configuration containing N particles
239  * @return the value of the Hamiltonian component
240  */
242 
243  /**
244  * @brief Evaluate the contribution of this component of multiple walkers.
245  * Take o_list and p_list update evaluation result variables in o_list?
246  * really should reduce vector of local_energies. matching the ordering and size of o list
247  * the this can be call for 1 or more QMCHamiltonians
248 
249  * @param o_list
250  * @param wf_list
251  * @param p_list
252  */
253  virtual void mw_evaluate(const RefVectorWithLeader<OperatorBase>& o_list,
255  const RefVectorWithLeader<ParticleSet>& p_list) const;
256 
257  /**
258  * @brief Evaluate the contribution of this component of multiple walkers per particle and report
259  * to registerd listeners from objects in Estimators
260  *
261  * Base class implementation decays to the mw_evaluate so if not overridden the estimator doesn't
262  * hear from this operator.
263  *
264  * specialized versions of this should take advantage of multiwalker resources
265  * to reduce the resource cost of collecting these values.
266  */
269  const RefVectorWithLeader<ParticleSet>& p_list,
270  const std::vector<ListenerVector<RealType>>& listeners,
271  const std::vector<ListenerVector<RealType>>& listeners_ions) const;
272 
273  /**
274  * @brief TODO: add docs
275 
276  * @param o_list
277  * @param p_list
278  * @param optvars
279  * @param dlogpsi
280  * @param dhpsioverpsi
281  */
283  const RefVectorWithLeader<ParticleSet>& p_list,
284  const opt_variables_type& optvars,
285  const RecordArray<ValueType>& dlogpsi,
286  RecordArray<ValueType>& dhpsioverpsi) const;
287 
288  /**
289  * @brief TODO: add docs
290  *
291  * @param P
292  * @return Return_t
293  */
294  virtual Return_t rejectedMove(ParticleSet& P);
295 
296  /**
297  * @brief Evaluate the local energy contribution of this component with Toperators updated if requested
298 
299  * @param P input configuration containing N particles
300  * @return the value of the Hamiltonian component
301  */
303 
304  /**
305  * @brief Evaluate the contribution of this component of multiple walkers
306 
307  * @param o_list
308  * @param wf_list
309  * @param p_list
310  */
313  const RefVectorWithLeader<ParticleSet>& p_list) const;
314 
315  /**
316  * @brief Evaluate the contribution of this component of multiple walkers per particle and report
317  * to registerd listeners from objects in Estimators
318  *
319  * default implementation decays to the mw_evaluatePerParticle.
320  *
321  * specialized versions of this should take advantage of multiwalker resources
322  * to reduce the resource cost of collecting these values.
323  */
326  const RefVectorWithLeader<ParticleSet>& p_list,
327  const std::vector<ListenerVector<RealType>>& listeners,
328  const std::vector<ListenerVector<RealType>>& listeners_ions) const;
329 
330 
331  /**
332  * @brief Evaluate value and derivatives wrt the optimizables. Default uses evaluate.
333 
334  * @param P
335  * @param optvars
336  * @param dlogpsi
337  * @param dhpsioverpsi
338  * @return Return_t
339  */
341  const opt_variables_type& optvars,
342  const Vector<ValueType>& dlogpsi,
343  Vector<ValueType>& dhpsioverpsi);
344 
345  /**
346  * @brief Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase.
347 
348  * @param P target particle set (electrons)
349  * @param ions source particle set (ions)
350  * @param psi Trial wave function
351  * @param hf_terms Adds OperatorBase's contribution to Re [(dH)Psi]/Psi
352  * @param pulay_terms Adds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi
353  * @return Contribution of OperatorBase to Local Energy.
354  */
356  ParticleSet& ions,
357  TrialWaveFunction& psi,
358  ParticleSet::ParticlePos& hf_term,
359  ParticleSet::ParticlePos& pulay_term);
360 
361  /**
362  * @brief Evaluate contribution to local energy and derivatives w.r.t ionic coordinates from OperatorBase.
363  * If there's no stochastic component, defaults to evaluateWithIonDerivs.
364  * If not otherwise specified, this defaults to evaluate().
365 
366  * @param P target particle set (electrons)
367  * @param ions source particle set (ions)
368  * @param psi Trial wave function
369  * @param hf_terms Adds OperatorBase's contribution to Re [(dH)Psi]/Psi
370  * @param pulay_terms Adds OperatorBase's contribution to Re [(H-E_L)dPsi]/Psi
371  * @return Contribution of OperatorBase to Local Energy.
372  */
374  ParticleSet& ions,
375  TrialWaveFunction& psi,
376  ParticleSet::ParticlePos& hf_term,
377  ParticleSet::ParticlePos& pulay_term);
378 
379  /**
380  * @brief Evaluate "B" matrix for observable. Filippi scheme for computing fast derivatives.
381 
382  * @param[in] P target particle set (electrons)
383  * @param[in] psi, Trial Wavefunction wrapper for fast derivatives.
384  * @param[in,out] B. List of B matrices for each species.
385  * @return Void
386  */
387  inline virtual void evaluateOneBodyOpMatrix(ParticleSet& P,
388  const TWFFastDerivWrapper& psi,
389  std::vector<ValueMatrix>& B)
390  {}
391 
392  /**
393  * @brief Evaluate "dB/dR" matrices for observable. Filippi scheme for computing fast derivatives.
394 
395  * @param[in] P, target particle set (electrons)
396  * @param[in] source, ion particle set
397  * @param[in] psi, Trial Wavefunction wrapper for fast derivatives.
398  * @param[in] iat,
399  * @param[in,out] dB/dR. Specifically, [ dB/dx_iat, dB/dy_iat, dB/dz_iat ], B is defined above.
400  * @return Void
401  */
403  ParticleSet& source,
404  const TWFFastDerivWrapper& psi,
405  const int iat,
406  std::vector<std::vector<ValueMatrix>>& Bforce)
407  {}
408  /**
409  * @brief Update data associated with a particleset.
410  * Default implementation does nothing. Only A-A interactions for s needs to implement its own method.
411 
412  * @param s source particle set
413  */
414  virtual void updateSource(ParticleSet& s);
415 
416  /**
417  * @brief Return an average value by collective operation
418  */
419  virtual Return_t getEnsembleAverage();
420 
421  /**
422  * @brief Initialize a shared resource and hand it to a collection
423 
424  * @param collection
425  */
426  virtual void createResource(ResourceCollection& collection) const;
427 
428  /**
429  * @brief Acquire a shared resource from a collection
430 
431  * @param collection
432  * @param o_list
433  */
434  virtual void acquireResource(ResourceCollection& collection, const RefVectorWithLeader<OperatorBase>& o_list) const;
435 
436  /**
437  * @brief Return a shared resource to a collection
438  *
439  * @param collection
440  * @param o_list
441  */
442  virtual void releaseResource(ResourceCollection& collection, const RefVectorWithLeader<OperatorBase>& o_list) const;
443 
444  /**
445  * @brief Set the Random Generator object
446  * TODO: add docs
447  * @param rng
448  */
450 
451  /**
452  * @brief TODO: add docs
453  *
454  * @param qp
455  * @param psi
456  * @param targetH
457  */
458  virtual void add2Hamiltonian(ParticleSet& qp, TrialWaveFunction& psi, QMCHamiltonian& targetH);
459 
460 #if !defined(REMOVE_TRACEMANAGER)
461  /**
462  * @brief TODO: add docs
463  *
464  * @param tm
465  */
466  virtual void getRequiredTraces(TraceManager& tm);
467 #endif
468 
469  // TODO: add docs
470 
471  virtual void informOfPerParticleListener() { has_listener_ = true; }
472 
473  bool isClassical() const noexcept;
474  bool isQuantum() const noexcept;
475  bool isClassicalClassical() const noexcept;
476  bool isQuantumClassical() const noexcept;
477  bool isQuantumQuantum() const noexcept;
478 
479  /**
480  * @brief Return the mode i
481  * @param i index among PRIMARY, OPTIMIZABLE, RATIOUPDATE, PHYSICAL
482  */
483  bool getMode(const int i) const noexcept;
484 
485  /**
486  * @brief TODO: add docs
487  *
488  * @return true
489  * @return false
490  */
491  bool isNonLocal() const noexcept;
492 
493  bool hasListener() const noexcept;
494 #if !defined(REMOVE_TRACEMANAGER)
495 
496  /**
497  * @brief Make trace quantities available
498  */
500 
501  /**
502  * @brief Checkout trace arrays
503  * Derived classes must guard individual checkouts using request info
504  * @param tm
505  */
507 
508  /**
509  * @brief Collect scalar trace data
510  */
511  void collectScalarTraces();
512 
513  /**
514  * @brief delete trace arrays
515  */
516  void deleteTraceQuantities();
517 #endif
518 
519 protected:
520  ///set the current update mode
521  std::bitset<8> update_mode_;
522 
523  ///current value
525 
526  ///name of this object
527  std::string name_;
528 
529 #if !defined(REMOVE_TRACEMANAGER)
530  ///whether traces are being collected
532 #endif
533 
534  ///starting index of this object
536 
537  ///a new value for a proposed move
539 
540  ///reference to the current walker
542 
543 #if !defined(REMOVE_TRACEMANAGER)
546 #endif
547 
548  /////PURELY VIRTUAL FUNCTIONS
549 
550  /**
551  * Read the input parameter
552  * @param cur xml node for a OperatorBase object
553  */
554  virtual bool put(xmlNodePtr cur) = 0;
555 
556  //////VIRTUAL FUNCTIONS
557 
558 #if !defined(REMOVE_TRACEMANAGER)
559  virtual void contributeScalarQuantities();
560 
561  virtual void checkoutScalarQuantities(TraceManager& tm);
562 
563  virtual void collectScalarQuantities();
564 
565  virtual void deleteScalarQuantities();
566 
567  virtual void contributeParticleQuantities();
568  virtual void checkoutParticleQuantities(TraceManager& tm);
569  virtual void deleteParticleQuantities();
570 #endif
571 
572  virtual void setComputeForces(bool compute);
573 
574  /**
575  * @brief Set the Energy Domain
576  *
577  * @param edomain
578  */
579  void setEnergyDomain(EnergyDomains edomain);
580 
581  ///set quantum domain
582  void setQuantumDomain(QuantumDomains qdomain);
583 
584  ///set quantum domain for one-body operator
585  void oneBodyQuantumDomain(const ParticleSet& P);
586 
587  ///set quantum domain for two-body operator
588  void twoBodyQuantumDomain(const ParticleSet& P);
589 
590  ///set quantum domain for two-body operator
591  void twoBodyQuantumDomain(const ParticleSet& P1, const ParticleSet& P2);
592 
593  /**
594  * @brief named values to the property list
595  * @param plist RecordNameProperty
596  *
597  * Previously addObservables but it is renamed and a non-virtial function.
598  */
599  void addValue(PropertySetType& plist);
600 
601 private:
602 #if !defined(REMOVE_TRACEMANAGER)
604 
605  ///array to store sample value
607 #endif
608 
609  /** Is there a per particle listener
610  * sadly this is necessary due to state machines
611  */
612  bool has_listener_ = false;
613 
614  ///quantum_domain_ of the (particle) operator, default = no_quantum_domain
616  ///energy domain of the operator (kinetic/potential), default = no_energy_domain
618 
619  ///return whether the energy domain is valid
620  bool energyDomainValid(EnergyDomains edomain) const noexcept;
621 
622  ///return whether the quantum domain is valid
623  bool quantumDomainValid(QuantumDomains qdomain) const noexcept;
624 };
625 } // namespace qmcplusplus
626 #endif
bool hasListener() const noexcept
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.
virtual std::unique_ptr< OperatorBase > makeClone(ParticleSet &qp, TrialWaveFunction &psi)=0
void twoBodyQuantumDomain(const ParticleSet &P)
set quantum domain for two-body operator
Walker< QMCTraits, PtclOnLatticeTraits > Walker_t
walker type
Definition: ParticleSet.h:59
virtual void resetTargetParticleSet(ParticleSet &P)=0
Reset the data with the target ParticleSet.
virtual void contributeScalarQuantities()
virtual void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< OperatorBase > &o_list) const
Return a shared resource to a collection.
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->va...
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
virtual void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< OperatorBase > &o_list) const
Acquire a shared resource from a collection.
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.
bool isQuantumClassical() const noexcept
PooledData< RealType > Buffer_t
buffer type for a serialized buffer
Definition: ParticleSet.h:63
void collectScalarTraces()
Collect scalar trace data.
int my_index_
starting index of this object
Definition: OperatorBase.h:535
virtual Return_t rejectedMove(ParticleSet &P)
TODO: add docs.
virtual void add2Hamiltonian(ParticleSet &qp, TrialWaveFunction &psi, QMCHamiltonian &targetH)
TODO: add docs.
Collection of Local Energy Operators.
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
Definition: SPOSet.h:50
An object of this type is a listener expecting a callback to the report function with a vector of val...
Definition: Listener.hpp:38
SPOSet::GradMatrix GradMatrix
Definition: OperatorBase.h:69
bool energyDomainValid(EnergyDomains edomain) const noexcept
return whether the energy domain is valid
class to handle hdf file
Definition: hdf_archive.h:51
Vectorized record engine for scalar properties.
virtual bool put(xmlNodePtr cur)=0
Read the input parameter.
virtual void getRequiredTraces(TraceManager &tm)
TODO: add docs.
virtual void collectScalarQuantities()
Attaches a unit to a Vector for IO.
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
virtual void createResource(ResourceCollection &collection) const
Initialize a shared resource and hand it to a collection.
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.
TraceRequest request_
whether traces are being collected
Definition: OperatorBase.h:531
virtual void setRandomGenerator(RandomBase< FullPrecRealType > *rng)
Set the Random Generator object TODO: add docs.
OperatorBase()
Construct a new Operator Base object Default and unique empty constructor.
SPOSet::SPOMap SPOMap
typedef for SPOMap
Definition: OperatorBase.h:84
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
Definition: SPOSet.h:52
Declaration of ObservableHelper and other helper class for observables.
virtual void deleteParticleQuantities()
std::string name_
name of this object
Definition: OperatorBase.h:527
std::bitset< 8 > & getUpdateMode() noexcept
get update_mode_ reference
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
TraceRequest & getRequest() noexcept
Get request_ member.
ParticleSet::Buffer_t BufferType
typedef for the serialized buffer
Definition: OperatorBase.h:75
virtual void evaluateOneBodyOpMatrix(ParticleSet &P, const TWFFastDerivWrapper &psi, std::vector< ValueMatrix > &B)
Evaluate "B" matrix for observable.
Definition: OperatorBase.h:387
Array< RealType, 1 > * value_sample_
array to store sample value
Definition: OperatorBase.h:606
virtual void addObservables(PropertySetType &plist, BufferType &collectables)
named values to the property list Default implementaton uses addValue(plist_)
Return_t new_value_
a new value for a proposed move
Definition: OperatorBase.h:538
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 ...
bool isNonLocal() const noexcept
TODO: add docs.
EnergyDomains
enum to denote energy domain of operators
Definition: OperatorBase.h:87
virtual void contributeParticleQuantities()
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 ...
bool has_listener_
Is there a per particle listener sadly this is necessary due to state machines.
Definition: OperatorBase.h:612
bool quantumDomainValid(QuantumDomains qdomain) const noexcept
return whether the quantum domain is valid
void oneBodyQuantumDomain(const ParticleSet &P)
set quantum domain for one-body operator
SPOSet::ValueMatrix ValueMatrix
For fast derivative evaluation.
Definition: OperatorBase.h:68
bool isQuantum() const noexcept
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
bool isClassicalClassical() const noexcept
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...
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...
void setEnergyDomain(EnergyDomains edomain)
Set the Energy Domain.
void setName(const std::string name) noexcept
Set my_name member, uses small string optimization (pass by value)
bool getMode(const int i) const noexcept
Return the mode i.
Walker_t * t_walker_
reference to the current walker
Definition: OperatorBase.h:541
virtual void setHistories(Walker_t &ThisWalker)
void addValue(PropertySetType &plist)
named values to the property list
Return_t getValue() const noexcept
get a copy of value_
virtual Return_t getEnsembleAverage()
Return an average value by collective operation.
virtual void updateSource(ParticleSet &s)
Update data associated with a particleset.
ParticleSet::Scalar_t ParticleScalar
typedef for the ParticleScalar
Definition: OperatorBase.h:81
An abstract class for Local Energy operators.
Definition: OperatorBase.h:59
FullPrecRealType Return_t
type of return value of evaluate
Definition: OperatorBase.h:64
void checkoutTraceQuantities(TraceManager &tm)
Checkout trace arrays Derived classes must guard individual checkouts using request info...
virtual void setParticlePropertyList(PropertySetType &plist, int offset)
ParticleSet::Walker_t Walker_t
typedef for the walker
Definition: OperatorBase.h:78
Class to represent a many-body trial wave function.
bool isQuantumQuantum() const noexcept
Return_t value_
current value
Definition: OperatorBase.h:524
std::map< std::string, const std::unique_ptr< const SPOSet > > SPOMap
Definition: SPOSet.h:57
virtual Return_t evaluateWithToperator(ParticleSet &P)
Evaluate the local energy contribution of this component with Toperators updated if requested...
std::string getName() const noexcept
getter a copy of my_name_, rvalue small string optimization
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.
virtual void informOfPerParticleListener()
Definition: OperatorBase.h:471
virtual Return_t evaluate(ParticleSet &P)=0
Evaluate the local energy contribution of this component.
virtual Return_t evaluateDeterministic(ParticleSet &P)
Evaluate the local energy contribution of this component, deterministically based on current state...
bool isClassical() const noexcept
QTFull::RealType FullPrecRealType
Definition: Configuration.h:66
virtual void setObservables(PropertySetType &plist)
Set the values evaluated by this object to plist Default implementation is to assign Value which is u...
void deleteTraceQuantities()
delete trace arrays
double B(double x, int k, int i, const std::vector< double > &t)
traits for QMC variables
Definition: Configuration.h:49
virtual ~OperatorBase()=default
virtual bool dependsOnWaveFunction() const
return true if this operator depends on a wavefunction
Definition: OperatorBase.h:124
QuantumDomains quantum_domain_
quantum_domain_ of the (particle) operator, default = no_quantum_domain
Definition: OperatorBase.h:615
Declare a global Random Number Generator.
virtual void setComputeForces(bool compute)
virtual void checkoutParticleQuantities(TraceManager &tm)
virtual std::string getClassName() const =0
return class name
A container class to represent a walker.
Definition: Walker.h:49
virtual void deleteScalarQuantities()
EnergyDomains energy_domain_
energy domain of the operator (kinetic/potential), default = no_energy_domain
Definition: OperatorBase.h:617
void contributeTraceQuantities()
Make trace quantities available.
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.
Definition: OperatorBase.h:402
Listener types that allow Estimators to register with QMCHamiltonian to have "trace" values from oper...
void setQuantumDomain(QuantumDomains qdomain)
set quantum domain
std::bitset< 8 > update_mode_
set the current update mode
Definition: OperatorBase.h:521
BareKineticEnergy::Return_t Return_t
virtual void checkoutScalarQuantities(TraceManager &tm)
virtual void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
RecordNamedProperty< FullPrecRealType > PropertySetType
define PropertyList_t
Definition: Configuration.h:69