QMCPACK
SPOSet.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) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
8 // Miguel Morales, moralessilva2@llnl.gov, Lawrence Livermore National Laboratory
9 // Raymond Clay III, j.k.rofling@gmail.com, Lawrence Livermore National Laboratory
10 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
11 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
12 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
13 // Ying Wai Li, yingwaili@ornl.gov, Oak Ridge National Laboratory
14 // Mark A. Berrill, berrillma@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 #ifndef QMCPLUSPLUS_SINGLEPARTICLEORBITALSETBASE_H
21 #define QMCPLUSPLUS_SINGLEPARTICLEORBITALSETBASE_H
22 
23 #include "OhmmsPETE/OhmmsArray.h"
24 #include "Particle/ParticleSet.h"
27 #include "OptimizableObject.h"
29 
30 namespace qmcplusplus
31 {
32 class ResourceCollection;
33 
34 class SPOSet;
35 namespace testing
36 {
37 opt_variables_type& getMyVars(SPOSet& spo);
38 }
39 
40 
41 /** base class for Single-particle orbital sets
42  *
43  * SPOSet stands for S(ingle)P(article)O(rbital)Set which contains
44  * a number of single-particle orbitals with capabilities of evaluating \f$ \psi_j({\bf r}_i)\f$
45  */
46 class SPOSet : public QMCTraits
47 {
48 public:
57  using SPOMap = std::map<std::string, const std::unique_ptr<const SPOSet>>;
60  template<typename DT>
62 
63  /** constructor */
64  SPOSet(const std::string& my_name);
65 
66  /** destructor
67  *
68  * Derived class destructor needs to pay extra attention to freeing memory shared among clones of SPOSet.
69  */
70  virtual ~SPOSet() = default;
71 
72  /** return the size of the orbital set
73  * Ye: this needs to be replaced by getOrbitalSetSize();
74  */
75  inline int size() const { return OrbitalSetSize; }
76 
77  /** print basic SPOSet information
78  */
79  void basic_report(const std::string& pad = "") const;
80 
81  /** print SPOSet information
82  */
83  virtual void report(const std::string& pad = "") const { basic_report(pad); }
84 
85 
86  /** return the size of the orbitals
87  */
88  inline int getOrbitalSetSize() const { return OrbitalSetSize; }
89 
90  /// Query if this SPOSet is optimizable
91  virtual bool isOptimizable() const { return false; }
92 
93  /** extract underlying OptimizableObject references
94  * @param opt_obj_refs aggregated list of optimizable object references
95  */
96  virtual void extractOptimizableObjectRefs(UniqueOptObjRefs& opt_obj_refs);
97 
98  /** check out variational optimizable variables
99  * @param active a super set of optimizable variables
100  */
101  virtual void checkOutVariables(const opt_variables_type& active);
102 
103  /// Query if this SPOSet uses OpenMP offload
104  virtual bool isOMPoffload() const { return false; }
105 
106  /** Query if this SPOSet has an explicit ion dependence. returns true if it does.
107  */
108  virtual bool hasIonDerivs() const { return false; }
109 
110  /// check a few key parameters before putting the SPO into a determinant
111  virtual void checkObject() const {}
112 
113  /// return true if this SPOSet can be wrappered by RotatedSPO
114  virtual bool isRotationSupported() const { return false; }
115  /// store parameters before getting destroyed by rotation.
116  virtual void storeParamsBeforeRotation() {}
117  /// apply rotation to all the orbitals
118  virtual void applyRotation(const ValueMatrix& rot_mat, bool use_stored_copy = false);
119 
120  /// Parameter derivatives of the wavefunction and the Laplacian of the wavefunction
121  virtual void evaluateDerivatives(ParticleSet& P,
122  const opt_variables_type& optvars,
123  Vector<ValueType>& dlogpsi,
124  Vector<ValueType>& dhpsioverpsi,
125  const int& FirstIndex,
126  const int& LastIndex);
127 
128  /// Parameter derivatives of the wavefunction
129  virtual void evaluateDerivativesWF(ParticleSet& P,
130  const opt_variables_type& optvars,
131  Vector<ValueType>& dlogpsi,
132  int FirstIndex,
133  int LastIndex);
134 
135  /** Evaluate the derivative of the optimized orbitals with respect to the parameters
136  * this is used only for MSD, to be refined for better serving both single and multi SD
137  */
138  virtual void evaluateDerivatives(ParticleSet& P,
139  const opt_variables_type& optvars,
140  Vector<ValueType>& dlogpsi,
141  Vector<ValueType>& dhpsioverpsi,
142  const ValueType& psiCurrent,
143  const std::vector<ValueType>& Coeff,
144  const std::vector<size_t>& C2node_up,
145  const std::vector<size_t>& C2node_dn,
146  const ValueVector& detValues_up,
147  const ValueVector& detValues_dn,
148  const GradMatrix& grads_up,
149  const GradMatrix& grads_dn,
150  const ValueMatrix& lapls_up,
151  const ValueMatrix& lapls_dn,
152  const ValueMatrix& M_up,
153  const ValueMatrix& M_dn,
154  const ValueMatrix& Minv_up,
155  const ValueMatrix& Minv_dn,
156  const GradMatrix& B_grad,
157  const ValueMatrix& B_lapl,
158  const std::vector<int>& detData_up,
159  const size_t N1,
160  const size_t N2,
161  const size_t NP1,
162  const size_t NP2,
163  const std::vector<std::vector<int>>& lookup_tbl);
164 
165  /** Evaluate the derivative of the optimized orbitals with respect to the parameters
166  * this is used only for MSD, to be refined for better serving both single and multi SD
167  */
168  virtual void evaluateDerivativesWF(ParticleSet& P,
169  const opt_variables_type& optvars,
170  Vector<ValueType>& dlogpsi,
171  const QTFull::ValueType& psiCurrent,
172  const std::vector<ValueType>& Coeff,
173  const std::vector<size_t>& C2node_up,
174  const std::vector<size_t>& C2node_dn,
175  const ValueVector& detValues_up,
176  const ValueVector& detValues_dn,
177  const ValueMatrix& M_up,
178  const ValueMatrix& M_dn,
179  const ValueMatrix& Minv_up,
180  const ValueMatrix& Minv_dn,
181  const std::vector<int>& detData_up,
182  const std::vector<std::vector<int>>& lookup_tbl);
183 
184  /** set the OrbitalSetSize
185  * @param norbs number of single-particle orbitals
186  * Ye: I prefer to remove this interface in the future. SPOSet builders need to handle the size correctly.
187  * It doesn't make sense allowing to set the value at any place in the code.
188  */
189  virtual void setOrbitalSetSize(int norbs) = 0;
190 
191  /** evaluate the values of this single-particle orbital set
192  * @param P current ParticleSet
193  * @param iat active particle
194  * @param psi values of the SPO
195  */
196  virtual void evaluateValue(const ParticleSet& P, int iat, ValueVector& psi) = 0;
197 
198  /** evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP
199  * @param VP virtual particle set
200  * @param psi values of the SPO, used as a scratch space if needed
201  * @param psiinv the row of inverse slater matrix corresponding to the particle moved virtually
202  * @param ratios return determinant ratios
203  */
204  virtual void evaluateDetRatios(const VirtualParticleSet& VP,
205  ValueVector& psi,
206  const ValueVector& psiinv,
207  std::vector<ValueType>& ratios);
208 
209  /** evaluate determinant ratios for virtual moves, specifically for Spinor SPOSets
210  * @param VP virtual particle set
211  * @param psi values of the SPO, used as a scratch space if needed
212  * @param spinor_multiplier factor to apply to the up and down components independently
213  * @param invrow the row of inverse slater matrix corresponding to the particle moved virtually
214  * @param ratios return determinant ratios
215  */
216  virtual void evaluateDetSpinorRatios(const VirtualParticleSet& VP,
217  ValueVector& psi,
218  const std::pair<ValueVector, ValueVector>& spinor_multiplier,
219  const ValueVector& invrow,
220  std::vector<ValueType>& ratios);
221 
222 
223  /// Determinant ratios and parameter derivatives of the wavefunction for virtual moves
224  virtual void evaluateDerivRatios(const VirtualParticleSet& VP,
225  const opt_variables_type& optvars,
226  ValueVector& psi,
227  const ValueVector& psiinv,
228  std::vector<ValueType>& ratios,
229  Matrix<ValueType>& dratios,
230  int FirstIndex,
231  int LastIndex);
232 
233 
234  /** evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP, of multiple walkers
235  * @param spo_list the list of SPOSet pointers in a walker batch
236  * @param vp_list a list of virtual particle sets in a walker batch
237  * @param psi_list a list of values of the SPO, used as a scratch space if needed
238  * @param invRow_ptr_list a list of pointers to the rows of inverse slater matrix corresponding to the particles moved virtually
239  * @param ratios_list a list of returning determinant ratios
240  */
241  virtual void mw_evaluateDetRatios(const RefVectorWithLeader<SPOSet>& spo_list,
243  const RefVector<ValueVector>& psi_list,
244  const std::vector<const ValueType*>& invRow_ptr_list,
245  std::vector<std::vector<ValueType>>& ratios_list) const;
246 
247  /** evaluate the values, gradients and laplacians of this single-particle orbital set
248  * @param P current ParticleSet
249  * @param iat active particle
250  * @param psi values of the SPO
251  * @param dpsi gradients of the SPO
252  * @param d2psi laplacians of the SPO
253  */
254  virtual void evaluateVGL(const ParticleSet& P, int iat, ValueVector& psi, GradVector& dpsi, ValueVector& d2psi) = 0;
255 
256  /** evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital set
257  * @param P current ParticleSet
258  * @param iat active particle
259  * @param psi values of the SPO
260  * @param dpsi gradients of the SPO
261  * @param d2psi laplacians of the SPO
262  * @param dspin spin gradients of the SPO
263  */
264  virtual void evaluateVGL_spin(const ParticleSet& P,
265  int iat,
266  ValueVector& psi,
267  GradVector& dpsi,
268  ValueVector& d2psi,
269  ValueVector& dspin);
270 
271  /** evaluate the values this single-particle orbital sets of multiple walkers
272  * @param spo_list the list of SPOSet pointers in a walker batch
273  * @param P_list the list of ParticleSet pointers in a walker batch
274  * @param iat active particle
275  * @param psi_v_list the list of value vector pointers in a walker batch
276  */
277  virtual void mw_evaluateValue(const RefVectorWithLeader<SPOSet>& spo_list,
278  const RefVectorWithLeader<ParticleSet>& P_list,
279  int iat,
280  const RefVector<ValueVector>& psi_v_list) const;
281 
282  /** evaluate the values, gradients and laplacians of this single-particle orbital sets of multiple walkers
283  * @param spo_list the list of SPOSet pointers in a walker batch
284  * @param P_list the list of ParticleSet pointers in a walker batch
285  * @param iat active particle
286  * @param psi_v_list the list of value vector pointers in a walker batch
287  * @param dpsi_v_list the list of gradient vector pointers in a walker batch
288  * @param d2psi_v_list the list of laplacian vector pointers in a walker batch
289  */
290  virtual void mw_evaluateVGL(const RefVectorWithLeader<SPOSet>& spo_list,
291  const RefVectorWithLeader<ParticleSet>& P_list,
292  int iat,
293  const RefVector<ValueVector>& psi_v_list,
294  const RefVector<GradVector>& dpsi_v_list,
295  const RefVector<ValueVector>& d2psi_v_list) const;
296 
297  /** evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital sets of multiple walkers
298  * @param spo_list the list of SPOSet pointers in a walker batch
299  * @param P_list the list of ParticleSet pointers in a walker batch
300  * @param iat active particle
301  * @param psi_v_list the list of value vector pointers in a walker batch
302  * @param dpsi_v_list the list of gradient vector pointers in a walker batch
303  * @param d2psi_v_list the list of laplacian vector pointers in a walker batch
304  * @param mw_dspin is a dual matrix of spin gradients [nw][norb]
305  * Note that the device side of mw_dspin is up to date
306  */
307  virtual void mw_evaluateVGLWithSpin(const RefVectorWithLeader<SPOSet>& spo_list,
308  const RefVectorWithLeader<ParticleSet>& P_list,
309  int iat,
310  const RefVector<ValueVector>& psi_v_list,
311  const RefVector<GradVector>& dpsi_v_list,
312  const RefVector<ValueVector>& d2psi_v_list,
313  OffloadMatrix<ComplexType>& mw_dspin) const;
314 
315  /** evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ratio
316  * and grads of multiple walkers. Device data of phi_vgl_v must be up-to-date upon return
317  * @param spo_list the list of SPOSet pointers in a walker batch
318  * @param P_list the list of ParticleSet pointers in a walker batch
319  * @param iat active particle
320  * @param phi_vgl_v orbital values, gradients and laplacians of all the walkers
321  * @param psi_ratio_grads_v determinant ratio and grads of all the walkers
322  */
323  virtual void mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader<SPOSet>& spo_list,
324  const RefVectorWithLeader<ParticleSet>& P_list,
325  int iat,
326  const std::vector<const ValueType*>& invRow_ptr_list,
327  OffloadMWVGLArray& phi_vgl_v,
328  std::vector<ValueType>& ratios,
329  std::vector<GradType>& grads) const;
330 
331  /** evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ratio
332  * and grads of multiple walkers. Device data of phi_vgl_v must be up-to-date upon return.
333  * Includes spin gradients
334  * @param spo_list the list of SPOSet pointers in a walker batch
335  * @param P_list the list of ParticleSet pointers in a walker batch
336  * @param iat active particle
337  * @param phi_vgl_v orbital values, gradients and laplacians of all the walkers
338  * @param ratios, ratios of all walkers
339  * @param grads, spatial gradients of all walkers
340  * @param spingrads, spin gradients of all walkers
341  */
343  const RefVectorWithLeader<ParticleSet>& P_list,
344  int iat,
345  const std::vector<const ValueType*>& invRow_ptr_list,
346  OffloadMWVGLArray& phi_vgl_v,
347  std::vector<ValueType>& ratios,
348  std::vector<GradType>& grads,
349  std::vector<ValueType>& spingrads) const;
350 
351  /** evaluate the values, gradients and hessians of this single-particle orbital set
352  * @param P current ParticleSet
353  * @param iat active particle
354  * @param psi values of the SPO
355  * @param dpsi gradients of the SPO
356  * @param grad_grad_psi hessians of the SPO
357  */
358  virtual void evaluateVGH(const ParticleSet& P,
359  int iat,
360  ValueVector& psi,
361  GradVector& dpsi,
362  HessVector& grad_grad_psi);
363 
364  /** evaluate the values, gradients, hessians, and grad hessians of this single-particle orbital set
365  * @param P current ParticleSet
366  * @param iat active particle
367  * @param psi values of the SPO
368  * @param dpsi gradients of the SPO
369  * @param grad_grad_psi hessians of the SPO
370  * @param grad_grad_grad_psi grad hessians of the SPO
371  */
372  virtual void evaluateVGHGH(const ParticleSet& P,
373  int iat,
374  ValueVector& psi,
375  GradVector& dpsi,
376  HessVector& grad_grad_psi,
377  GGGVector& grad_grad_grad_psi);
378 
379  /** evaluate the values of this single-particle orbital set
380  * @param P current ParticleSet
381  * @param iat active particle
382  * @param psi values of the SPO
383  */
384  virtual void evaluate_spin(const ParticleSet& P, int iat, ValueVector& psi, ValueVector& dpsi);
385 
386  /** evaluate the third derivatives of this single-particle orbital set
387  * @param P current ParticleSet
388  * @param first first particle
389  * @param last last particle
390  * @param grad_grad_grad_logdet third derivatives of the SPO
391  */
392  virtual void evaluateThirdDeriv(const ParticleSet& P, int first, int last, GGGMatrix& grad_grad_grad_logdet);
393 
394  /** evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles
395  * @param[in] P current ParticleSet
396  * @param[in] first starting index of the particles
397  * @param[in] last ending index of the particles
398  * @param[out] logdet determinant matrix to be inverted
399  * @param[out] dlogdet gradients
400  * @param[out] d2logdet laplacians
401  *
402  */
403  virtual void evaluate_notranspose(const ParticleSet& P,
404  int first,
405  int last,
406  ValueMatrix& logdet,
407  GradMatrix& dlogdet,
408  ValueMatrix& d2logdet) = 0;
409 
410  /** evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles, including the spin gradient
411  * @param P current ParticleSet
412  * @param first starting index of the particles
413  * @param last ending index of the particles
414  * @param logdet determinant matrix to be inverted
415  * @param dlogdet gradients
416  * @param d2logdet laplacians
417  * @param dspinlogdet, spin gradients
418  *
419  * default implementation will abort for all SPOSets except SpinorSet
420  *
421  */
422  virtual void evaluate_notranspose_spin(const ParticleSet& P,
423  int first,
424  int last,
425  ValueMatrix& logdet,
426  GradMatrix& dlogdet,
427  ValueMatrix& d2logdet,
428  ValueMatrix& dspinlogdet);
429 
430  virtual void mw_evaluate_notranspose(const RefVectorWithLeader<SPOSet>& spo_list,
431  const RefVectorWithLeader<ParticleSet>& P_list,
432  int first,
433  int last,
434  const RefVector<ValueMatrix>& logdet_list,
435  const RefVector<GradMatrix>& dlogdet_list,
436  const RefVector<ValueMatrix>& d2logdet_list) const;
437 
438  /** evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles
439  * @param P current ParticleSet
440  * @param first starting index of the particles
441  * @param last ending index of the particles
442  * @param logdet determinant matrix to be inverted
443  * @param dlogdet gradients
444  * @param grad_grad_logdet hessians
445  *
446  */
447  virtual void evaluate_notranspose(const ParticleSet& P,
448  int first,
449  int last,
450  ValueMatrix& logdet,
451  GradMatrix& dlogdet,
452  HessMatrix& grad_grad_logdet);
453 
454  /** evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [first,last) particles
455  * @param P current ParticleSet
456  * @param first starting index of the particles
457  * @param last ending index of the particles
458  * @param logdet determinant matrix to be inverted
459  * @param dlogdet gradients
460  * @param grad_grad_logdet hessians
461  * @param grad_grad_grad_logdet third derivatives
462  *
463  */
464  virtual void evaluate_notranspose(const ParticleSet& P,
465  int first,
466  int last,
467  ValueMatrix& logdet,
468  GradMatrix& dlogdet,
469  HessMatrix& grad_grad_logdet,
470  GGGMatrix& grad_grad_grad_logdet);
471 
472  /** evaluate the gradients of this single-particle orbital
473  * for [first,last) target particles with respect to the given source particle
474  * @param P current ParticleSet
475  * @param first starting index of the particles
476  * @param last ending index of the particles
477  * @param iat_src source particle index
478  * @param gradphi gradients
479  *
480  */
481  virtual void evaluateGradSource(const ParticleSet& P,
482  int first,
483  int last,
484  const ParticleSet& source,
485  int iat_src,
486  GradMatrix& gradphi);
487 
488  /** evaluate the gradients of values, gradients, laplacians of this single-particle orbital
489  * for [first,last) target particles with respect to the given source particle
490  * @param P current ParticleSet
491  * @param first starting index of the particles
492  * @param last ending index of the particles
493  * @param iat_src source particle index
494  * @param gradphi gradients of values
495  * @param grad_grad_phi gradients of gradients
496  * @param grad_lapl_phi gradients of laplacians
497  *
498  */
499  virtual void evaluateGradSource(const ParticleSet& P,
500  int first,
501  int last,
502  const ParticleSet& source,
503  int iat_src,
504  GradMatrix& grad_phi,
505  HessMatrix& grad_grad_phi,
506  GradMatrix& grad_lapl_phi);
507 
508  /** @brief Returns a row of d/dR_iat phi_j(r) evaluated at position r.
509  *
510  * @param[in] P particle set.
511  * @param[in] iel The electron at which to evaluate phi(r_iel)
512  * @param[in] source ion particle set.
513  * @param[in] iat_src ion ID w.r.t. which to take derivative.
514  * @param[in,out] gradphi Vector of d/dR_iat phi_j(r).
515  * @return Void
516  */
517  virtual void evaluateGradSourceRow(const ParticleSet& P,
518  int iel,
519  const ParticleSet& source,
520  int iat_src,
521  GradVector& gradphi);
522 
523  /** access the k point related to the given orbital */
524  virtual PosType get_k(int orb) { return PosType(); }
525 
526  /** initialize a shared resource and hand it to collection
527  */
528  virtual void createResource(ResourceCollection& collection) const {}
529 
530  /** acquire a shared resource from collection
531  */
532  virtual void acquireResource(ResourceCollection& collection, const RefVectorWithLeader<SPOSet>& spo_list) const {}
533 
534  /** return a shared resource to collection
535  */
536  virtual void releaseResource(ResourceCollection& collection, const RefVectorWithLeader<SPOSet>& spo_list) const {}
537 
538  /** make a clone of itself
539  * every derived class must implement this to have threading working correctly.
540  */
541  [[noreturn]] virtual std::unique_ptr<SPOSet> makeClone() const;
542 
543  /** Used only by cusp correction in AOS LCAO.
544  * Ye: the SoA LCAO moves all this responsibility to the builder.
545  * This interface should be removed with AoS.
546  */
547  virtual bool transformSPOSet() { return true; }
548 
549  /** finalize the construction of SPOSet
550  *
551  * for example, classes serving accelerators may need to transfer data from host to device
552  * after the host side objects are built.
553  */
554  virtual void finalizeConstruction() {}
555 
556  /// return object name
557  const std::string& getName() const { return my_name_; }
558 
559  /// return class name
560  virtual std::string getClassName() const = 0;
561 
562 protected:
563  /// name of the object, unique identifier
564  const std::string my_name_;
565  ///number of Single-particle orbitals
567  /// Optimizable variables
569 
571 };
572 
573 using SPOSetPtr = SPOSet*;
574 
575 } // namespace qmcplusplus
576 #endif
virtual void evaluate_notranspose(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet)=0
evaluate the values, gradients and laplacians of this single-particle orbital for [first...
base class for Single-particle orbital sets
Definition: SPOSet.h:46
SPOSet(const std::string &my_name)
constructor
Definition: SPOSet.cpp:29
OrbitalSetTraits< ValueType >::HessVector HessVector
Definition: SPOSet.h:53
virtual void checkObject() const
check a few key parameters before putting the SPO into a determinant
Definition: SPOSet.h:111
virtual void storeParamsBeforeRotation()
store parameters before getting destroyed by rotation.
Definition: SPOSet.h:116
Declaration of OptimizableObject.
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
const std::string my_name_
name of the object, unique identifier
Definition: SPOSet.h:564
virtual void evaluateDerivativesWF(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, int FirstIndex, int LastIndex)
Parameter derivatives of the wavefunction.
Definition: SPOSet.cpp:276
virtual std::unique_ptr< SPOSet > makeClone() const
make a clone of itself every derived class must implement this to have threading working correctly...
Definition: SPOSet.cpp:225
virtual bool isOMPoffload() const
Query if this SPOSet uses OpenMP offload.
Definition: SPOSet.h:104
virtual void evaluateDerivRatios(const VirtualParticleSet &VP, const opt_variables_type &optvars, ValueVector &psi, const ValueVector &psiinv, std::vector< ValueType > &ratios, Matrix< ValueType > &dratios, int FirstIndex, int LastIndex)
Determinant ratios and parameter derivatives of the wavefunction for virtual moves.
Definition: SPOSet.cpp:288
RealType ValueType
Definition: QMCTypes.h:42
A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtu...
virtual void evaluateVGH(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, HessVector &grad_grad_psi)
evaluate the values, gradients and hessians of this single-particle orbital set
Definition: SPOSet.cpp:238
opt_variables_type myVars
Optimizable variables.
Definition: SPOSet.h:568
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
Definition: SPOSet.h:50
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75
virtual void applyRotation(const ValueMatrix &rot_mat, bool use_stored_copy=false)
apply rotation to all the orbitals
Definition: SPOSet.cpp:255
OrbitalSetTraits< ValueType >::ValueVector ValueVector
void basic_report(const std::string &pad="") const
print basic SPOSet information
Definition: SPOSet.cpp:230
A proxy class to the quantum ParticleSet.
virtual void evaluateDetSpinorRatios(const VirtualParticleSet &VP, ValueVector &psi, const std::pair< ValueVector, ValueVector > &spinor_multiplier, const ValueVector &invrow, std::vector< ValueType > &ratios)
evaluate determinant ratios for virtual moves, specifically for Spinor SPOSets
Definition: SPOSet.cpp:60
virtual void mw_evaluateVGLandDetRatioGradsWithSpin(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const std::vector< const ValueType *> &invRow_ptr_list, OffloadMWVGLArray &phi_vgl_v, std::vector< ValueType > &ratios, std::vector< GradType > &grads, std::vector< ValueType > &spingrads) const
evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ra...
Definition: SPOSet.cpp:160
OrbitalSetTraits< ValueType >::GradMatrix GradMatrix
Definition: SPOSet.h:52
virtual void evaluateValue(const ParticleSet &P, int iat, ValueVector &psi)=0
evaluate the values of this single-particle orbital set
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
virtual void evaluateGradSourceRow(const ParticleSet &P, int iel, const ParticleSet &source, int iat_src, GradVector &gradphi)
Returns a row of d/dR_iat phi_j(r) evaluated at position r.
Definition: SPOSet.cpp:397
virtual void mw_evaluateValue(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list) const
evaluate the values this single-particle orbital sets of multiple walkers
Definition: SPOSet.cpp:105
Array< ValueType, 3, OffloadPinnedAllocator< ValueType > > OffloadMWVGLArray
Definition: SPOSet.h:58
virtual std::string getClassName() const =0
return class name
virtual void mw_evaluate_notranspose(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int first, int last, const RefVector< ValueMatrix > &logdet_list, const RefVector< GradMatrix > &dlogdet_list, const RefVector< ValueMatrix > &d2logdet_list) const
Definition: SPOSet.cpp:190
virtual void mw_evaluateVGL(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list, const RefVector< GradVector > &dpsi_v_list, const RefVector< ValueVector > &d2psi_v_list) const
evaluate the values, gradients and laplacians of this single-particle orbital sets of multiple walker...
Definition: SPOSet.cpp:93
virtual void mw_evaluateVGLandDetRatioGrads(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const std::vector< const ValueType *> &invRow_ptr_list, OffloadMWVGLArray &phi_vgl_v, std::vector< ValueType > &ratios, std::vector< GradType > &grads) const
evaluate the values, gradients and laplacians of this single-particle orbital sets and determinant ra...
Definition: SPOSet.cpp:126
virtual void setOrbitalSetSize(int norbs)=0
set the OrbitalSetSize
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
virtual void evaluateVGL(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)=0
evaluate the values, gradients and laplacians of this single-particle orbital set ...
virtual void finalizeConstruction()
finalize the construction of SPOSet
Definition: SPOSet.h:554
virtual void evaluateVGL_spin(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi, ValueVector &dspin)
evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital set ...
Definition: SPOSet.cpp:83
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
virtual ~SPOSet()=default
destructor
virtual bool isOptimizable() const
Query if this SPOSet is optimizable.
Definition: SPOSet.h:91
int getOrbitalSetSize() const
return the size of the orbitals
Definition: SPOSet.h:88
virtual void acquireResource(ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
acquire a shared resource from collection
Definition: SPOSet.h:532
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566
QTBase::PosType PosType
Definition: Configuration.h:61
optimize::VariableSet opt_variables_type
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
virtual bool hasIonDerivs() const
Query if this SPOSet has an explicit ion dependence.
Definition: SPOSet.h:108
virtual PosType get_k(int orb)
access the k point related to the given orbital
Definition: SPOSet.h:524
opt_variables_type & getMyVars(SPOSet &spo)
virtual void evaluateDetRatios(const VirtualParticleSet &VP, ValueVector &psi, const ValueVector &psiinv, std::vector< ValueType > &ratios)
evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP
Definition: SPOSet.cpp:47
virtual void releaseResource(ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
return a shared resource to collection
Definition: SPOSet.h:536
std::vector< std::reference_wrapper< T > > RefVector
virtual void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi, const int &FirstIndex, const int &LastIndex)
Parameter derivatives of the wavefunction and the Laplacian of the wavefunction.
Definition: SPOSet.cpp:263
virtual void evaluateThirdDeriv(const ParticleSet &P, int first, int last, GGGMatrix &grad_grad_grad_logdet)
evaluate the third derivatives of this single-particle orbital set
Definition: SPOSet.cpp:173
OrbitalSetTraits< ValueType >::GradHessVector GGGVector
Definition: SPOSet.h:55
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51
virtual void mw_evaluateVGLWithSpin(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< ParticleSet > &P_list, int iat, const RefVector< ValueVector > &psi_v_list, const RefVector< GradVector > &dpsi_v_list, const RefVector< ValueVector > &d2psi_v_list, OffloadMatrix< ComplexType > &mw_dspin) const
evaluate the values, gradients and laplacians and spin gradient of this single-particle orbital sets ...
Definition: SPOSet.cpp:115
virtual bool transformSPOSet()
Used only by cusp correction in AOS LCAO.
Definition: SPOSet.h:547
std::map< std::string, const std::unique_ptr< const SPOSet > > SPOMap
Definition: SPOSet.h:57
virtual void mw_evaluateDetRatios(const RefVectorWithLeader< SPOSet > &spo_list, const RefVectorWithLeader< const VirtualParticleSet > &vp_list, const RefVector< ValueVector > &psi_list, const std::vector< const ValueType *> &invRow_ptr_list, std::vector< std::vector< ValueType >> &ratios_list) const
evaluate determinant ratios for virtual moves, e.g., sphere move for nonlocalPP, of multiple walkers ...
Definition: SPOSet.cpp:69
virtual void evaluate_notranspose_spin(const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet, ValueMatrix &dspinlogdet)
evaluate the values, gradients and laplacians of this single-particle orbital for [first...
Definition: SPOSet.cpp:178
LatticeGaussianProduct::ValueType ValueType
virtual void extractOptimizableObjectRefs(UniqueOptObjRefs &opt_obj_refs)
extract underlying OptimizableObject references
Definition: SPOSet.cpp:31
virtual bool isRotationSupported() const
return true if this SPOSet can be wrappered by RotatedSPO
Definition: SPOSet.h:114
virtual void checkOutVariables(const opt_variables_type &active)
check out variational optimizable variables
Definition: SPOSet.cpp:39
const std::string & getName() const
return object name
Definition: SPOSet.h:557
trait class to handel a set of Orbitals
traits for QMC variables
Definition: Configuration.h:49
OrbitalSetTraits< ValueType >::GradHessMatrix GGGMatrix
Definition: SPOSet.h:56
A D-dimensional Array class based on PETE.
Definition: OhmmsArray.h:25
virtual void createResource(ResourceCollection &collection) const
initialize a shared resource and hand it to collection
Definition: SPOSet.h:528
virtual void evaluateVGHGH(const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, HessVector &grad_grad_psi, GGGVector &grad_grad_grad_psi)
evaluate the values, gradients, hessians, and grad hessians of this single-particle orbital set ...
Definition: SPOSet.cpp:244
virtual void report(const std::string &pad="") const
print SPOSet information
Definition: SPOSet.h:83
virtual void evaluateGradSource(const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &gradphi)
evaluate the gradients of this single-particle orbital for [first,last) target particles with respect...
Definition: SPOSet.cpp:369
OrbitalSetTraits< ValueType >::HessMatrix HessMatrix
Definition: SPOSet.h:54
virtual void evaluate_spin(const ParticleSet &P, int iat, ValueVector &psi, ValueVector &dpsi)
evaluate the values of this single-particle orbital set
Definition: SPOSet.cpp:409