QMCPACK
QMCHamiltonian.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: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
10 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
11 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
12 // Peter W. Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
13 //
14 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
15 //////////////////////////////////////////////////////////////////////////////////////
16 
17 
18 /**@file QMCHamiltonian.h
19  *@brief Declaration of QMCHamiltonian
20  */
21 #ifndef QMCPLUSPLUS_HAMILTONIAN_H
22 #define QMCPLUSPLUS_HAMILTONIAN_H
23 
24 #include <string_view>
25 
26 #include <ResourceHandle.h>
27 
29 #include "Configuration.h"
33 #include "Utilities/Resource.h"
34 #if !defined(REMOVE_TRACEMANAGER)
36 #endif
38 
39 namespace qmcplusplus
40 {
41 class MCWalkerConfiguration;
42 class HamiltonianFactory;
43 class NonLocalECPotential;
44 
45 /** Collection of Local Energy Operators
46  *
47  * Note that QMCHamiltonian is not derived from QMCHmailtonianBase.
48  */
50 {
51  friend class HamiltonianFactory;
52 
53 public:
65  enum
66  {
68  };
69 
70  ///constructor
71  QMCHamiltonian(const std::string& aname = "psi0");
72 
73  ///destructor
75 
76  ///add an operator
77  void addOperator(std::unique_ptr<OperatorBase>&& h, const std::string& aname, bool physical = true);
78 
79  ///record the name-type pair of an operator
80  void addOperatorType(const std::string& name, const std::string& type);
81 
82  ///return type of named H element or fail
83  const std::string& getOperatorType(const std::string& name);
84 
85  ///return the number of Hamiltonians
86  inline int size() const { return H.size(); }
87 
88  ///return the total number of Hamiltonians (physical + aux)
89  inline int total_size() const { return H.size() + auxH.size(); }
90 
91  /** return OperatorBase with the name aname
92  * @param aname name of a OperatorBase
93  * @return 0 if aname is not found.
94  */
95  OperatorBase* getHamiltonian(const std::string& aname);
96 
97  /** return i-th OperatorBase
98  * @param i index of the OperatorBase
99  * @return H[i]
100  */
101  OperatorBase* getHamiltonian(int i) { return H[i].get(); }
102 
103  /** return components, auxH not included, depending on TWF.
104  */
106 
107 #if !defined(REMOVE_TRACEMANAGER)
108  ///initialize trace data
110 
111  ///collect walker trace data
112  void collect_walker_traces(Walker_t& walker, int step);
113 
114  ///finalize trace data
115  void finalize_traces();
116 #endif
117 
118  /**
119  * \defgroup Functions to get/put observables
120  */
121  /**@{*/
122  /** add each term to the PropertyList for averages
123  * @param plist a set of properties to which this Hamiltonian add the observables
124  */
125  //void addObservables(PropertySetType& plist);
126 
127  /** add each term to P.PropertyList and P.mcObservables
128  * @param P particle set to which observables are added
129  * @return the number of observables
130  */
131  int addObservables(ParticleSet& P);
132 
133  /** register obsevables so that their averages can be dumped to hdf5
134  * @param h5desc has observable_helper for each h5 group
135  * @param gid h5 group id to which the observable groups are added.
136  */
137  void registerObservables(std::vector<ObservableHelper>& h5desc, hdf_archive& file) const;
138  /** register collectables so that their averages can be dumped to hdf5
139  * @param h5desc has observable_helper for each h5 group
140  * @param gid h5 group id to which the observable groups are added.
141  *
142  * Add observable_helper information for the data stored in ParticleSet::mcObservables.
143  */
144  void registerCollectables(std::vector<ObservableHelper>& h5desc, hdf_archive& file) const;
145 
146  /** Listener Registration
147  * This must be called on a QMCHamiltonian that has acquired multiwalker resources
148  */
149  static void mw_registerKineticListener(QMCHamiltonian& ham_leader, ListenerVector<RealType> listener);
153 
154  /** Some Hamiltonian components need to be informed that they are in a per particle reporting
155  * situation so additional state can be added either to them or the objects they are strongly coupled with.
156  *
157  * This includes evalation of hamiltonian components constants on a per particle basis and informing a components
158  * attached particle set that it needs to store per particle values for StructFact. This is a reason that the
159  * coupling between Hamiltonian components and particle sets can strong and must be correct.
160  *
161  * This is not desirable and hopefully this state transformation message can be removed.
162  */
164 
165  ///retrun the starting index
166  inline int startIndex() const { return myIndex; }
167  ///return the size of observables
168  inline int sizeOfObservables() const { return Observables.size(); }
169  ///return the size of collectables
170  inline int sizeOfCollectables() const { return numCollectables; }
171  ///return the value of the i-th observable
172  inline RealType getObservable(int i) const { return Observables.Values[i]; }
173  ///return the value of the observable with a set name if it exists
174  inline int getObservable(std::string Oname) const
175  {
176  int rtval(-1);
177  for (int io = 0; io < Observables.size(); io++)
178  {
179  if (Observables.Names[io] == Oname)
180  return io;
181  }
182  return rtval;
183  }
184  ///return the name of the i-th observable
185  inline std::string getObservableName(int i) const { return Observables.Names[i]; }
186 
187  /** save the values of Hamiltonian elements to the Properties
188  *
189  * This creates a hard dependence on Walker using WalkerProperties to index its Properties.
190  * It also assumes no one else is sticking things into Walker's Properties and that
191  * It can access into it as if it were a raw FullPrecRealType array.
192  *
193  */
194  template<class IT, typename = std::enable_if_t<std::is_same<std::add_pointer<FullPrecRealType>::type, IT>::value>>
195  inline void saveProperty(IT first)
196  {
197  first[WP::LOCALPOTENTIAL] = LocalEnergy - KineticEnergy;
198  copy(Observables.begin(), Observables.end(), first + myIndex);
199  }
200  /**@}*/
201 
202  template<class IT, typename = std::enable_if_t<std::is_same<std::add_pointer<FullPrecRealType>::type, IT>::value>>
203  inline void setProperty(IT first)
204  {
205  // LocalEnergy=first[WP::LOCALENERGY];
206  // KineticEnergy=LocalEnergy-first[LOCALPOTENTIAL];
207  copy(first + myIndex, first + myIndex + Observables.size(), Observables.begin());
208  }
209 
210  void updateSource(ParticleSet& s);
211 
212  ////return the LocalEnergy \f$=\sum_i H^{qmc}_{i}\f$
214  ////return the LocalPotential \f$=\sum_i H^{qmc}_{i} - KE\f$
217  void auxHevaluate(ParticleSet& P);
218  void auxHevaluate(ParticleSet& P, Walker_t& ThisWalker);
219  void auxHevaluate(ParticleSet& P, Walker_t& ThisWalker, bool do_properties, bool do_collectables);
220  void rejectedMove(ParticleSet& P, Walker_t& ThisWalker);
221 
222  /** set PRIMARY bit of all the components
223  */
224  inline void setPrimary(bool primary)
225  {
226  for (int i = 0; i < H.size(); i++)
227  H[i]->getUpdateMode().set(OperatorBase::PRIMARY, primary);
228  }
229 
230  /** evaluate Local Energy
231  * @param P ParticleSet
232  * @return the local energy
233  *
234  * P.R, P.G and P.L are used to evaluate the LocalEnergy.
235  */
237 
238  /** evaluate Local Energy deterministically. Defaults to evaluate(P) for operators
239  * without a stochastic component. For the nonlocal PP, the quadrature grid is not rerandomized.
240  * @param P ParticleSet
241  * @return Local energy.
242  */
244  /** batched version of evaluate for LocalEnergy
245  *
246  * Encapsulation is ignored for ham_list hamiltonians method uses its status as QMCHamiltonian to break encapsulation.
247  * ParticleSet is also updated.
248  * Bugs could easily be created by accessing this scope.
249  * This should be set to static and fixed.
250  */
251  static std::vector<QMCHamiltonian::FullPrecRealType> mw_evaluate(
252  const RefVectorWithLeader<QMCHamiltonian>& ham_list,
254  const RefVectorWithLeader<ParticleSet>& p_list);
255 
256  /** evaluate Local energy with Toperators updated.
257  * @param P ParticleSEt
258  * @return Local energy
259  */
261 
262  /** batched version of evaluate Local energy with Toperators updated.
263  */
264  static std::vector<QMCHamiltonian::FullPrecRealType> mw_evaluateWithToperator(
265  const RefVectorWithLeader<QMCHamiltonian>& ham_list,
267  const RefVectorWithLeader<ParticleSet>& p_list);
268 
269 
270  /** evaluate energy and derivatives wrt to the variables
271  * @param P ParticleSet
272  * @param optvars current optimiable variables
273  * @param dlogpsi \f$\partial \ln \Psi({\bf R})/\partial \alpha \f$
274  * @param dhpsioverpsi \f$\partial(\hat{h}\Psi({\bf R})/\Psi({\bf R})) /\partial \alpha \f$
275  * @param compute_deriv if true, compute dhpsioverpsi of the non-local potential component
276  */
278  const opt_variables_type& optvars,
279  Vector<ValueType>& dlogpsi,
280  Vector<ValueType>& dhpsioverpsi);
281 
282  static std::vector<QMCHamiltonian::FullPrecRealType> mw_evaluateValueAndDerivatives(
283  const RefVectorWithLeader<QMCHamiltonian>& ham_list,
285  const RefVectorWithLeader<ParticleSet>& p_list,
286  const opt_variables_type& optvars,
287  RecordArray<ValueType>& dlogpsi,
288  RecordArray<ValueType>& dhpsioverpsi);
289 
290  /** evaluate local energy and derivatives w.r.t ionic coordinates, but deterministically.
291  * @param P target particle set (electrons)
292  * @param ions source particle set (ions)
293  * @param psi Trial wave function
294  * @param hf_terms Re [(dH)Psi]/Psi
295  * @param pulay_terms Re [(H-E_L)dPsi]/Psi
296  * @param wf_grad Re (dPsi/Psi)
297  * @return Local Energy.
298  */
300  ParticleSet& ions,
301  TrialWaveFunction& psi_in,
302  TWFFastDerivWrapper& psi_wrapper,
304  ParticleSet::ParticlePos& wf_grad);
305 
306  /** Evaluate the electron gradient of the local energy.
307  * @param psi Trial Wave Function
308  * @param P electron particle set
309  * @param EGrad an Nelec x 3 real array which corresponds to d/d[r_i]_j E_L
310  * @param A finite difference step size if applicable. Default is to use finite diff with delta=1e-5.
311  * @return EGrad. Function itself returns nothing.
312  */
314 
315  /** evaluate local energy and derivatives w.r.t ionic coordinates.
316  * @param P target particle set (electrons)
317  * @param ions source particle set (ions)
318  * @param psi Trial wave function
319  * @param hf_terms Re [(dH)Psi]/Psi
320  * @param pulay_terms Re [(H-E_L)dPsi]/Psi
321  * @param wf_grad Re (dPsi/Psi)
322  * @return Local Energy.
323  */
325  ParticleSet& ions,
326  TrialWaveFunction& psi,
327  ParticleSet::ParticlePos& hf_terms,
328  ParticleSet::ParticlePos& pulay_terms,
329  ParticleSet::ParticlePos& wf_grad);
330 
331  /** evaluate local energy and derivatives w.r.t ionic coordinates, but deterministically.
332  * @param P target particle set (electrons)
333  * @param ions source particle set (ions)
334  * @param psi Trial wave function
335  * @param hf_terms Re [(dH)Psi]/Psi
336  * @param pulay_terms Re [(H-E_L)dPsi]/Psi
337  * @param wf_grad Re (dPsi/Psi)
338  * @return Local Energy.
339  */
341  ParticleSet& ions,
342  TrialWaveFunction& psi,
343  ParticleSet::ParticlePos& hf_terms,
344  ParticleSet::ParticlePos& pulay_terms,
345  ParticleSet::ParticlePos& wf_grad);
346  /** set non local moves options
347  * @param cur the xml input
348  */
349  void setNonLocalMoves(xmlNodePtr cur);
350 
351  void setNonLocalMoves(const std::string& non_local_move_option,
352  const double tau,
353  const double alpha,
354  const double gamma);
355 
356  /** make non local moves
357  * @param P particle set
358  * @return the number of accepted moves
359  */
361 
362  /** determine if L2 potential is present
363  */
364  bool has_L2() { return l2_ptr != nullptr; }
365 
366  /** compute D matrix and K vector for L2 potential propagator
367  * @param r single particle coordinate
368  * @param D diffusion matrix (outputted)
369  * @param K drift modification vector (outputted)
370  */
371  void computeL2DK(ParticleSet& P, int iel, TensorType& D, PosType& K)
372  {
373  if (l2_ptr != nullptr)
374  l2_ptr->evaluateDK(P, iel, D, K);
375  }
376 
377  /** compute D matrix for L2 potential propagator
378  * @param r single particle coordinate
379  * @param D diffusion matrix (outputted)
380  */
381  void computeL2D(ParticleSet& P, int iel, TensorType& D)
382  {
383  if (l2_ptr != nullptr)
384  l2_ptr->evaluateD(P, iel, D);
385  }
386 
387  static std::vector<int> mw_makeNonLocalMoves(const RefVectorWithLeader<QMCHamiltonian>& ham_list,
389  const RefVectorWithLeader<ParticleSet>& p_list);
390  /** evaluate energy
391  * @param P quantum particleset
392  * @param free_nlpp if true, non-local PP is a variable
393  * @return KE + NonLocal potential
394  */
396 
397  /** return an average value of the LocalEnergy
398  *
399  * Introduced to get a collective value
400  */
402 
404 
405  const std::string& getName() const { return myName; }
406 
407  bool get(std::ostream& os) const;
408 
410 
411  /// accumulate local energy and update Observables and PropertyList
413  /// extract kinetic and potential energies.
415 
416  /// initialize a shared resource and hand it to a collection
417  void createResource(ResourceCollection& collection) const;
418  /** acquire external resource
419  * Note: use RAII ResourceCollectionLock whenever possible
420  */
421  static void acquireResource(ResourceCollection& collection, const RefVectorWithLeader<QMCHamiltonian>& ham_list);
422  /** release external resource
423  * Note: use RAII ResourceCollectionLock whenever possible
424  */
425  static void releaseResource(ResourceCollection& collection, const RefVectorWithLeader<QMCHamiltonian>& ham_list);
426 
427  /** return a clone */
428  std::unique_ptr<QMCHamiltonian> makeClone(ParticleSet& qp, TrialWaveFunction& psi) const;
429 
430 private:
431  static constexpr std::array<std::string_view, 8> available_quantities_{"weight", "LocalEnergy", "LocalPotential",
432  "Vq", "Vc", "Vqq",
433  "Vqc", "Vcc"};
434 
435  ///starting index
436  int myIndex;
437  ///starting index
439  ///Current Local Energy
441  ///Current Kinetic Energy
443  ///Current Local Energy for the proposed move
445  ///getName is in the way
446  const std::string myName;
447  ///vector of Hamiltonians
448  std::vector<std::unique_ptr<OperatorBase>> H;
449  ///pointer to NonLocalECP
451  ///pointer to L2Potential
453  ///vector of Hamiltonians
454  std::vector<std::unique_ptr<OperatorBase>> auxH;
455  /// Total timer for H evaluation
457  /// Total timer for H evaluation
459  /// Total timer for H ion deriv evaluation;
461  /// timers for H components
462  std::vector<std::reference_wrapper<NewTimer>> my_timers_;
463  ///types of component operators
464  std::map<std::string, std::string> operator_types;
465  ///data
467  /** reset Observables and counters
468  * @param start starting index within PropertyList
469  * @param ncollects number of collectables
470  */
471  void resetObservables(int start, int ncollects);
472 
473  void reportToListeners();
474  // helper function for extracting a list of Hamiltonian components from a list of QMCHamiltonian::H.
476 
477 #if !defined(REMOVE_TRACEMANAGER)
478  ///traces variables
489 #endif
490 
491  /// multiwalker shared resource
494 };
495 } // namespace qmcplusplus
496 #endif
int addObservables(ParticleSet &P)
add each term to the PropertyList for averages
FullPrecRealType evaluateIonDerivsDeterministicFast(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi_in, TWFFastDerivWrapper &psi_wrapper, ParticleSet::ParticlePos &dedr, ParticleSet::ParticlePos &wf_grad)
evaluate local energy and derivatives w.r.t ionic coordinates, but deterministically.
void registerCollectables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
register collectables so that their averages can be dumped to hdf5
Array< TraceInt, 1 > * gen_sample
HamiltonianRef::FullPrecRealType FullPrecRealType
void informOperatorsOfListener()
Some Hamiltonian components need to be informed that they are in a per particle reporting situation s...
FullPrecRealType getLocalPotential()
Evaluate the L2 potentials around each ion.
Definition: L2Potential.h:57
std::string getObservableName(int i) const
return the name of the i-th observable
void setNonLocalMoves(xmlNodePtr cur)
set non local moves options
int sizeOfCollectables() const
return the size of collectables
NewTimer & ham_timer_
Total timer for H evaluation.
int startIndex() const
retrun the starting index
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
Array< TraceInt, 1 > * step_sample
Array< TraceInt, 1 > * pid_sample
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluateWithToperator(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
batched version of evaluate Local energy with Toperators updated.
RefVector< OperatorBase > getTWFDependentComponents()
return components, auxH not included, depending on TWF.
QTBase::RealType RealType
Definition: Configuration.h:58
NewTimer & eval_vals_derivs_timer_
Total timer for H evaluation.
void addOperator(std::unique_ptr< OperatorBase > &&h, const std::string &aname, bool physical=true)
add an operator
OperatorBase * getHamiltonian(const std::string &aname)
return OperatorBase with the name aname
OperatorBase::Return_t Return_t
void addOperatorType(const std::string &name, const std::string &type)
record the name-type pair of an operator
QMCTraits::FullPrecRealType FullPrecRealType
void saveProperty(IT first)
save the values of Hamiltonian elements to the Properties
ResourceHandle manages the temporary resource referenced from a collection.
FullPrecRealType evaluateValueAndDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate energy and derivatives wrt to the variables
SPOSet::ValueMatrix ValueMatrix
FullPrecRealType KineticEnergy
Current Kinetic Energy.
ResourceHandle< QMCHamiltonianMultiWalkerResource > mw_res_handle_
std::vector< std::reference_wrapper< NewTimer > > my_timers_
timers for H components
Declaration of OperatorBase.
RealType getObservable(int i) const
return the value of the i-th observable
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
OperatorBase::RealType RealType
static void updateComponent(OperatorBase &op, QMCHamiltonian &ham, ParticleSet &pset)
accumulate local energy and update Observables and PropertyList
class to handle hdf file
Definition: hdf_archive.h:51
static void mw_registerLocalEnergyListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
Timer accumulates time and call counts.
Definition: NewTimer.h:135
NonLocalECPotential * nlpp_ptr
pointer to NonLocalECP
Attaches a unit to a Vector for IO.
void resetObservables(int start, int ncollects)
reset Observables and counters
TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level acc...
void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to a collection
void computeL2DK(ParticleSet &P, int iel, TensorType &D, PosType &K)
compute D matrix and K vector for L2 potential propagator
#define OHMMS_DIM
Definition: config.h:64
FullPrecRealType NewLocalEnergy
Current Local Energy for the proposed move.
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluate(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
batched version of evaluate for LocalEnergy
OperatorBase::Walker_t Walker_t
static std::vector< QMCHamiltonian::FullPrecRealType > mw_evaluateValueAndDerivatives(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi)
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
NewTimer & eval_ion_derivs_fast_timer_
Total timer for H ion deriv evaluation;.
static void mw_registerKineticListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
Listener Registration This must be called on a QMCHamiltonian that has acquired multiwalker resources...
Array< TraceReal, 1 > * weight_sample
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
int myIndex
starting index
ParticleSet::Buffer_t BufferType
typedef for the serialized buffer
Definition: OperatorBase.h:75
FullPrecRealType LocalEnergy
Current Local Energy.
int numCollectables
starting index
FullPrecRealType evaluateWithToperator(ParticleSet &P)
evaluate Local energy with Toperators updated.
QTBase::ValueType ValueType
Definition: Configuration.h:60
TraceRequest request
traces variables
void collect_walker_traces(Walker_t &walker, int step)
collect walker trace data
int size() const
return the number of Hamiltonians
static void mw_registerLocalIonPotentialListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
Factory class to build a many-body wavefunction.
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
void evaluateD(ParticleSet &P, int iel, TensorType &D)
int sizeOfObservables() const
return the size of observables
Array< TraceInt, 1 > * age_sample
FullPrecRealType evaluateIonDerivsDeterministic(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_terms, ParticleSet::ParticlePos &pulay_terms, ParticleSet::ParticlePos &wf_grad)
evaluate local energy and derivatives w.r.t ionic coordinates, but deterministically.
FullPrecRealType evaluateDeterministic(ParticleSet &P)
evaluate Local Energy deterministically.
QTBase::PosType PosType
Definition: Configuration.h:61
FullPrecRealType getEnsembleAverage()
return an average value of the LocalEnergy
L2Potential * l2_ptr
pointer to L2Potential
FullPrecRealType getLocalEnergy()
const std::string myName
getName is in the way
const std::string & getName() const
static void updateKinetic(QMCHamiltonian &ham, ParticleSet &pset)
extract kinetic and potential energies.
void evaluateElecGrad(ParticleSet &P, TrialWaveFunction &psi, ParticleSet::ParticlePos &EGrad, RealType delta=1e-5)
Evaluate the electron gradient of the local energy.
static std::vector< int > mw_makeNonLocalMoves(const RefVectorWithLeader< QMCHamiltonian > &ham_list, const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list)
const std::string & getOperatorType(const std::string &name)
return type of named H element or fail
void initialize_traces(TraceManager &tm, ParticleSet &P)
initialize trace data
static constexpr std::array< std::string_view, 8 > available_quantities_
void auxHevaluate(ParticleSet &P)
An abstract class for Local Energy operators.
Definition: OperatorBase.h:59
FullPrecRealType Return_t
type of return value of evaluate
Definition: OperatorBase.h:64
Array< TraceReal, 2 > * position_sample
std::vector< std::reference_wrapper< T > > RefVector
void rejectedMove(ParticleSet &P, Walker_t &ThisWalker)
Looks like a hack see DMCBatched.cpp and DMC.cpp weight is used like temporary flag from DMC...
static void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< QMCHamiltonian > &ham_list)
acquire external resource Note: use RAII ResourceCollectionLock whenever possible ...
void registerObservables(std::vector< ObservableHelper > &h5desc, hdf_archive &file) const
register obsevables so that their averages can be dumped to hdf5
static void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< QMCHamiltonian > &ham_list)
release external resource Note: use RAII ResourceCollectionLock whenever possible ...
std::vector< std::unique_ptr< OperatorBase > > H
vector of Hamiltonians
bool has_L2()
determine if L2 potential is present
Evaluate the semi local potentials.
ParticleSet::Walker_t Walker_t
typedef for the walker
Definition: OperatorBase.h:78
Class to represent a many-body trial wave function.
static void mw_registerLocalPotentialListener(QMCHamiltonian &ham_leader, ListenerVector< RealType > listener)
PropertySetType Observables
data
int getObservable(std::string Oname) const
return the value of the observable with a set name if it exists
Indexes
an enum denoting index of physical properties
FullPrecRealType evaluate(ParticleSet &P)
evaluate Local Energy
std::vector< std::unique_ptr< OperatorBase > > auxH
vector of Hamiltonians
void updateSource(ParticleSet &s)
remove a named Hamiltonian from the list
void finalize_traces()
finalize trace data
int makeNonLocalMoves(ParticleSet &P)
make non local moves
void resetTargetParticleSet(ParticleSet &P)
QTFull::RealType FullPrecRealType
Definition: Configuration.h:66
Array< TraceInt, 1 > * mult_sample
std::map< std::string, std::string > operator_types
types of component operators
OperatorBase * getHamiltonian(int i)
return i-th OperatorBase
OperatorBase::ValueType ValueType
FullPrecRealType evaluateVariableEnergy(ParticleSet &P, bool free_nlpp)
evaluate energy
int total_size() const
return the total number of Hamiltonians (physical + aux)
Array< TraceInt, 1 > * id_sample
void setRandomGenerator(RandomBase< FullPrecRealType > *rng)
OperatorBase::PropertySetType PropertySetType
FullPrecRealType getKineticEnergy()
void setPrimary(bool primary)
set PRIMARY bit of all the components
static RefVectorWithLeader< OperatorBase > extract_HC_list(const RefVectorWithLeader< QMCHamiltonian > &ham_list, int id)
std::unique_ptr< QMCHamiltonian > makeClone(ParticleSet &qp, TrialWaveFunction &psi) const
return a clone
QTBase::TensorType TensorType
Definition: Configuration.h:63
A container class to represent a walker.
Definition: Walker.h:49
void computeL2D(ParticleSet &P, int iel, TensorType &D)
compute D matrix for L2 potential propagator
void evaluateDK(ParticleSet &P, int iel, TensorType &D, PosType &K)
Definition: L2Potential.cpp:97
FullPrecRealType evaluateIonDerivs(ParticleSet &P, ParticleSet &ions, TrialWaveFunction &psi, ParticleSet::ParticlePos &hf_terms, ParticleSet::ParticlePos &pulay_terms, ParticleSet::ParticlePos &wf_grad)
evaluate local energy and derivatives w.r.t ionic coordinates.
QMCHamiltonian(const std::string &aname="psi0")
constructor
RecordNamedProperty< FullPrecRealType > PropertySetType
define PropertyList_t
Definition: Configuration.h:69