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

Public Types

using value_type = ValueMatrix::value_type
 
using grad_type = GradMatrix::value_type
 
- Public Types inherited from SPOSet
using ValueVector = OrbitalSetTraits< ValueType >::ValueVector
 
using ValueMatrix = OrbitalSetTraits< ValueType >::ValueMatrix
 
using GradVector = OrbitalSetTraits< ValueType >::GradVector
 
using GradMatrix = OrbitalSetTraits< ValueType >::GradMatrix
 
using HessVector = OrbitalSetTraits< ValueType >::HessVector
 
using HessMatrix = OrbitalSetTraits< ValueType >::HessMatrix
 
using GGGVector = OrbitalSetTraits< ValueType >::GradHessVector
 
using GGGMatrix = OrbitalSetTraits< ValueType >::GradHessMatrix
 
using SPOMap = std::map< std::string, const std::unique_ptr< const SPOSet > >
 
using OffloadMWVGLArray = Array< ValueType, 3, OffloadPinnedAllocator< ValueType > >
 
using OffloadMWVArray = Array< ValueType, 2, OffloadPinnedAllocator< ValueType > >
 
template<typename DT >
using OffloadMatrix = Matrix< DT, OffloadPinnedAllocator< DT > >
 
- Public Types inherited from QMCTraits
enum  { DIM = OHMMS_DIM, DIM_VGL = OHMMS_DIM + 2 }
 
using QTBase = QMCTypes< OHMMS_PRECISION, DIM >
 
using QTFull = QMCTypes< OHMMS_PRECISION_FULL, DIM >
 
using RealType = QTBase::RealType
 
using ComplexType = QTBase::ComplexType
 
using ValueType = QTBase::ValueType
 
using PosType = QTBase::PosType
 
using GradType = QTBase::GradType
 
using TensorType = QTBase::TensorType
 
using IndexType = OHMMS_INDEXTYPE
 define other types More...
 
using FullPrecRealType = QTFull::RealType
 
using FullPrecValueType = QTFull::ValueType
 
using PropertySetType = RecordNamedProperty< FullPrecRealType >
 define PropertyList_t More...
 
using PtclGrpIndexes = std::vector< std::pair< int, int > >
 

Public Member Functions

 SHOSet (const std::string &my_name, RealType l, PosType c, const std::vector< SHOState *> &sho_states)
 
 ~SHOSet () override
 
std::string getClassName () const override
 return class name More...
 
void initialize ()
 
std::unique_ptr< SPOSetmakeClone () const override
 make a clone of itself every derived class must implement this to have threading working correctly. More...
 
void evaluateValue (const ParticleSet &P, int iat, ValueVector &psi) override
 evaluate the values of this single-particle orbital set More...
 
void evaluateVGL (const ParticleSet &P, int iat, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi) override
 evaluate the values, gradients and laplacians of this single-particle orbital set More...
 
void evaluate_notranspose (const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, ValueMatrix &d2logdet) override
 evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles More...
 
void evaluate_v (PosType r, ValueVector &psi)
 
void evaluate_vgl (PosType r, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
 
void evaluate_hermite (const PosType &xpos)
 
void evaluate_d0 (const PosType &xpos, ValueVector &psi)
 
void evaluate_d1 (const PosType &xpos, ValueVector &psi, GradVector &dpsi)
 
void evaluate_d2 (const PosType &xpos, ValueVector &psi, ValueVector &d2psi)
 
void report (const std::string &pad="") const override
 print SPOSet information More...
 
void test_derivatives ()
 
void test_overlap ()
 
void evaluate_check (PosType r, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
 
void setOrbitalSetSize (int norbs) override
 number of orbitals is determined only by initial request More...
 
void not_implemented (const std::string &method)
 unimplemented functions call this to abort More...
 
void evaluateThirdDeriv (const ParticleSet &P, int first, int last, GGGMatrix &dddlogdet) override
 evaluate the third derivatives of this single-particle orbital set More...
 
void evaluate_notranspose (const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, HessMatrix &ddlogdet) override
 evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles More...
 
void evaluate_notranspose (const ParticleSet &P, int first, int last, ValueMatrix &logdet, GradMatrix &dlogdet, HessMatrix &ddlogdet, GGGMatrix &dddlogdet) override
 evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [first,last) particles More...
 
void evaluateGradSource (const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &gradphi) override
 evaluate the gradients of this single-particle orbital for [first,last) target particles with respect to the given source particle More...
 
void evaluateGradSource (const ParticleSet &P, int first, int last, const ParticleSet &source, int iat_src, GradMatrix &dphi, HessMatrix &ddphi, GradMatrix &dlapl_phi) override
 evaluate the gradients of values, gradients, laplacians of this single-particle orbital for [first,last) target particles with respect to the given source particle More...
 
- Public Member Functions inherited from SPOSet
 SPOSet (const std::string &my_name)
 constructor More...
 
virtual ~SPOSet ()=default
 destructor More...
 
int size () const
 return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); More...
 
void basic_report (const std::string &pad="") const
 print basic SPOSet information More...
 
int getOrbitalSetSize () const
 return the size of the orbitals More...
 
virtual bool isOptimizable () const
 Query if this SPOSet is optimizable. More...
 
virtual void extractOptimizableObjectRefs (UniqueOptObjRefs &opt_obj_refs)
 extract underlying OptimizableObject references More...
 
virtual void checkOutVariables (const opt_variables_type &active)
 check out variational optimizable variables More...
 
virtual bool isOMPoffload () const
 Query if this SPOSet uses OpenMP offload. More...
 
virtual bool hasIonDerivs () const
 Query if this SPOSet has an explicit ion dependence. More...
 
virtual void checkObject () const
 check a few key parameters before putting the SPO into a determinant More...
 
virtual bool isRotationSupported () const
 return true if this SPOSet can be wrappered by RotatedSPO More...
 
virtual void storeParamsBeforeRotation ()
 store parameters before getting destroyed by rotation. More...
 
virtual void applyRotation (const ValueMatrix &rot_mat, bool use_stored_copy=false)
 apply rotation to all the orbitals More...
 
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. More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, int FirstIndex, int LastIndex)
 Parameter derivatives of the wavefunction. More...
 
virtual void evaluateDerivatives (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi, const ValueType &psiCurrent, const std::vector< ValueType > &Coeff, const std::vector< size_t > &C2node_up, const std::vector< size_t > &C2node_dn, const ValueVector &detValues_up, const ValueVector &detValues_dn, const GradMatrix &grads_up, const GradMatrix &grads_dn, const ValueMatrix &lapls_up, const ValueMatrix &lapls_dn, const ValueMatrix &M_up, const ValueMatrix &M_dn, const ValueMatrix &Minv_up, const ValueMatrix &Minv_dn, const GradMatrix &B_grad, const ValueMatrix &B_lapl, const std::vector< int > &detData_up, const size_t N1, const size_t N2, const size_t NP1, const size_t NP2, const std::vector< std::vector< int >> &lookup_tbl)
 Evaluate the derivative of the optimized orbitals with respect to the parameters this is used only for MSD, to be refined for better serving both single and multi SD. More...
 
virtual void evaluateDerivativesWF (ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, const QTFull::ValueType &psiCurrent, const std::vector< ValueType > &Coeff, const std::vector< size_t > &C2node_up, const std::vector< size_t > &C2node_dn, const ValueVector &detValues_up, const ValueVector &detValues_dn, const ValueMatrix &M_up, const ValueMatrix &M_dn, const ValueMatrix &Minv_up, const ValueMatrix &Minv_dn, const std::vector< int > &detData_up, const std::vector< std::vector< int >> &lookup_tbl)
 Evaluate the derivative of the optimized orbitals with respect to the parameters this is used only for MSD, to be refined for better serving both single and multi SD. More...
 
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 More...
 
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 More...
 
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. More...
 
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 More...
 
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 More...
 
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 More...
 
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 walkers More...
 
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 of multiple walkers More...
 
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 ratio and grads of multiple walkers. More...
 
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 ratio and grads of multiple walkers. More...
 
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 More...
 
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 More...
 
virtual void evaluate_spin (const ParticleSet &P, int iat, ValueVector &psi, ValueVector &dpsi)
 evaluate the values of this single-particle orbital set More...
 
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,last) particles, including the spin gradient More...
 
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
 
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. More...
 
virtual PosType get_k (int orb)
 access the k point related to the given orbital More...
 
virtual void createResource (ResourceCollection &collection) const
 initialize a shared resource and hand it to collection More...
 
virtual void acquireResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 acquire a shared resource from collection More...
 
virtual void releaseResource (ResourceCollection &collection, const RefVectorWithLeader< SPOSet > &spo_list) const
 return a shared resource to collection More...
 
virtual bool transformSPOSet ()
 Used only by cusp correction in AOS LCAO. More...
 
virtual void finalizeConstruction ()
 finalize the construction of SPOSet More...
 
const std::string & getName () const
 return object name More...
 

Public Attributes

RealType length
 
PosType center
 
int nmax
 
TinyVector< int, DIMqn_max
 
std::vector< SHOStatestate_info
 
std::vector< RealTypeprefactors
 
Array< RealType, 2 > hermite
 
Array< RealType, 2 > bvalues
 
Array< RealType, 2 > d0_values
 
Array< RealType, 2 > d1_values
 
Array< RealType, 2 > d2_values
 

Additional Inherited Members

- Protected Attributes inherited from SPOSet
const std::string my_name_
 name of the object, unique identifier More...
 
IndexType OrbitalSetSize
 number of Single-particle orbitals More...
 
opt_variables_type myVars
 Optimizable variables. More...
 

Detailed Description

Definition at line 48 of file SHOSet.h.

Member Typedef Documentation

◆ grad_type

using grad_type = GradMatrix::value_type

Definition at line 51 of file SHOSet.h.

◆ value_type

using value_type = ValueMatrix::value_type

Definition at line 50 of file SHOSet.h.

Constructor & Destructor Documentation

◆ SHOSet()

SHOSet ( const std::string &  my_name,
RealType  l,
PosType  c,
const std::vector< SHOState *> &  sho_states 
)

Definition at line 19 of file SHOSet.cpp.

References SHOSet::initialize(), qmcplusplus::Units::time::s, and SHOSet::state_info.

20  : SPOSet(my_name), length(l), center(c)
21 {
22  state_info.resize(sho_states.size());
23  for (int s = 0; s < sho_states.size(); ++s)
24  state_info[s] = *sho_states[s];
25  initialize();
26 }
SPOSet(const std::string &my_name)
constructor
Definition: SPOSet.cpp:29
std::vector< SHOState > state_info
Definition: SHOSet.h:58
PosType center
Definition: SHOSet.h:54
RealType length
Definition: SHOSet.h:53

◆ ~SHOSet()

~SHOSet ( )
override

Definition at line 62 of file SHOSet.cpp.

62 {}

Member Function Documentation

◆ evaluate_check()

void evaluate_check ( PosType  r,
ValueVector psi,
GradVector dpsi,
ValueVector d2psi 
)

Definition at line 233 of file SHOSet.cpp.

References qmcplusplus::app_log(), SHOSet::center, SHOSet::d0_values, SHOSet::d1_values, SHOSet::d2_values, QMCTraits::DIM, SHOSet::evaluate_vgl(), qmcplusplus::exp(), SHOSet::hermite, SHOSet::length, qmcplusplus::Units::force::N, qmcplusplus::n, SHOSet::qn_max, and qmcplusplus::sqrt().

234 {
235  using std::exp;
236  using std::sqrt;
237 
238  evaluate_vgl(r, psi, dpsi, d2psi);
239 
240  const int N = 6;
241  RealType H[N], dH[N], d2H[N], pre[N];
242  RealType p[N], dp[N], d2p[N];
243 
244  pre[0] = 1.0 / (sqrt(sqrt(M_PI) * length));
245  for (int n = 1; n < N; ++n)
246  pre[n] = pre[n - 1] / sqrt(2. * n);
247 
248  for (int d = 0; d < DIM; ++d)
249  {
250  RealType x = (r[d] - center[d]) / length;
251  RealType x2 = x * x, x3 = x * x * x, x4 = x * x * x * x, x5 = x * x * x * x * x;
252  H[0] = 1;
253  dH[0] = 0;
254  d2H[0] = 0;
255  H[1] = 2 * x;
256  dH[1] = 2;
257  d2H[1] = 0;
258  H[2] = 4 * x2 - 2;
259  dH[2] = 8 * x;
260  d2H[2] = 8;
261  H[3] = 8 * x3 - 12 * x;
262  dH[3] = 24 * x2 - 12;
263  d2H[3] = 48 * x;
264  H[4] = 16 * x4 - 48 * x2 + 12;
265  dH[4] = 64 * x3 - 96 * x;
266  d2H[4] = 192 * x2 - 96;
267  H[5] = 32 * x5 - 160 * x3 + 120 * x;
268  dH[5] = 160 * x4 - 480 * x2 + 120;
269  d2H[5] = 640 * x3 - 960 * x;
270  RealType g = exp(-x2 / 2);
271  for (int n = 0; n < N; ++n)
272  {
273  p[n] = pre[n] * g * H[n];
274  dp[n] = pre[n] * g * (-x * H[n] + dH[n]);
275  d2p[n] = pre[n] * g * ((x2 - 1) * H[n] - 2 * x * dH[n] + d2H[n]);
276  }
277  app_log() << "eval check dim = " << d << " x = " << x << std::endl;
278  app_log() << " hermite check" << std::endl;
279  for (int n = 0; n < qn_max[d]; ++n)
280  {
281  app_log() << " " << n << " " << H[n] << std::endl;
282  app_log() << " " << n << " " << hermite(d, n) << std::endl;
283  }
284  app_log() << " phi d0 check" << std::endl;
285  for (int n = 0; n < qn_max[d]; ++n)
286  {
287  app_log() << " " << n << " " << p[n] << std::endl;
288  app_log() << " " << n << " " << d0_values(d, n) << std::endl;
289  }
290  app_log() << " phi d1 check" << std::endl;
291  for (int n = 0; n < qn_max[d]; ++n)
292  {
293  app_log() << " " << n << " " << dp[n] / p[n] << std::endl;
294  app_log() << " " << n << " " << d1_values(d, n) << std::endl;
295  }
296  app_log() << " phi d2 check" << std::endl;
297  for (int n = 0; n < qn_max[d]; ++n)
298  {
299  app_log() << " " << n << " " << d2p[n] / p[n] << std::endl;
300  app_log() << " " << n << " " << d2_values(d, n) << std::endl;
301  }
302  }
303 }
Array< RealType, 2 > d2_values
Definition: SHOSet.h:64
Array< RealType, 2 > hermite
Definition: SHOSet.h:60
Array< RealType, 2 > d1_values
Definition: SHOSet.h:63
std::ostream & app_log()
Definition: OutputManager.h:65
void evaluate_vgl(PosType r, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
Definition: SHOSet.cpp:127
Array< RealType, 2 > d0_values
Definition: SHOSet.h:62
PosType center
Definition: SHOSet.h:54
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
RealType length
Definition: SHOSet.h:53
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ evaluate_d0()

void evaluate_d0 ( const PosType xpos,
ValueVector psi 
)

Definition at line 160 of file SHOSet.cpp.

References SHOSet::bvalues, QMCTraits::DIM, qmcplusplus::exp(), SHOSet::hermite, qmcplusplus::n, SHOSet::prefactors, SHOSet::qn_max, SHOState::quantum_number, qmcplusplus::Units::time::s, and SHOSet::state_info.

Referenced by SHOSet::evaluate_v(), SHOSet::evaluate_vgl(), and SHOSet::test_overlap().

161 {
162  using std::exp;
163  for (int d = 0; d < DIM; ++d)
164  {
165  RealType x = xpos[d];
166  RealType g = exp(-.5 * x * x);
167  for (int n = 0; n < qn_max[d]; ++n)
168  {
169  bvalues(d, n) = prefactors[n] * g * hermite(d, n);
170  }
171  }
172  for (int s = 0; s < state_info.size(); ++s)
173  {
174  const SHOState& state = state_info[s];
175  RealType phi = 1.0;
176  for (int d = 0; d < DIM; ++d)
177  phi *= bvalues(d, state.quantum_number[d]);
178  psi[s] = phi;
179  }
180 }
Array< RealType, 2 > hermite
Definition: SHOSet.h:60
std::vector< SHOState > state_info
Definition: SHOSet.h:58
std::vector< RealType > prefactors
Definition: SHOSet.h:59
Array< RealType, 2 > bvalues
Definition: SHOSet.h:61
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ evaluate_d1()

void evaluate_d1 ( const PosType xpos,
ValueVector psi,
GradVector dpsi 
)

Definition at line 183 of file SHOSet.cpp.

References SHOSet::bvalues, QMCTraits::DIM, SHOSet::hermite, SHOSet::length, qmcplusplus::n, SHOSet::qn_max, SHOState::quantum_number, qmcplusplus::Units::time::s, and SHOSet::state_info.

Referenced by SHOSet::evaluate_vgl().

184 {
185  RealType ol = 1.0 / length;
186  for (int d = 0; d < DIM; ++d)
187  {
188  RealType x = xpos[d];
189  RealType Hnm1 = 0.0;
190  for (int n = 0; n < qn_max[d]; ++n)
191  {
192  RealType Hn = hermite(d, n);
193  bvalues(d, n) = (-x + 2 * n * Hnm1 / Hn) * ol;
194  Hnm1 = Hn;
195  }
196  }
197  for (int s = 0; s < state_info.size(); ++s)
198  {
199  const SHOState& state = state_info[s];
201  for (int d = 0; d < DIM; ++d)
202  dphi[d] = bvalues(d, state.quantum_number[d]);
203  dphi *= psi[s];
204  dpsi[s] = dphi;
205  }
206 }
Array< RealType, 2 > hermite
Definition: SHOSet.h:60
std::vector< SHOState > state_info
Definition: SHOSet.h:58
Array< RealType, 2 > bvalues
Definition: SHOSet.h:61
RealType length
Definition: SHOSet.h:53
QMCTraits::RealType RealType
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ evaluate_d2()

void evaluate_d2 ( const PosType xpos,
ValueVector psi,
ValueVector d2psi 
)

Definition at line 209 of file SHOSet.cpp.

References SHOSet::bvalues, QMCTraits::DIM, SHOSet::length, qmcplusplus::n, SHOSet::qn_max, SHOState::quantum_number, qmcplusplus::Units::time::s, and SHOSet::state_info.

Referenced by SHOSet::evaluate_vgl().

210 {
211  RealType ol2 = 1.0 / (length * length);
212  for (int d = 0; d < DIM; ++d)
213  {
214  RealType x = xpos[d];
215  RealType x2 = x * x;
216  for (int n = 0; n < qn_max[d]; ++n)
217  {
218  bvalues(d, n) = (-1.0 + x2 - 2 * n) * ol2;
219  }
220  }
221  for (int s = 0; s < state_info.size(); ++s)
222  {
223  const SHOState& state = state_info[s];
224  ValueType d2phi = 0.0;
225  for (int d = 0; d < DIM; ++d)
226  d2phi += bvalues(d, state.quantum_number[d]);
227  d2phi *= psi[s];
228  d2psi[s] = d2phi;
229  }
230 }
std::vector< SHOState > state_info
Definition: SHOSet.h:58
QTBase::ValueType ValueType
Definition: Configuration.h:60
Array< RealType, 2 > bvalues
Definition: SHOSet.h:61
RealType length
Definition: SHOSet.h:53
QMCTraits::RealType RealType
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ evaluate_hermite()

void evaluate_hermite ( const PosType xpos)

Definition at line 137 of file SHOSet.cpp.

References QMCTraits::DIM, SHOSet::hermite, qmcplusplus::n, and SHOSet::qn_max.

Referenced by SHOSet::evaluate_v(), SHOSet::evaluate_vgl(), and SHOSet::test_overlap().

138 {
139  for (int d = 0; d < DIM; ++d)
140  {
141  int nh = qn_max[d];
142  if (nh > 0)
143  {
144  RealType x = xpos[d];
145  hermite(d, 0) = 1.0;
146  RealType Hnm2 = 0.0;
147  RealType Hnm1 = 1.0;
148  for (int n = 1; n < nh; ++n)
149  {
150  RealType Hn = 2 * (x * Hnm1 - (n - 1) * Hnm2);
151  hermite(d, n) = Hn;
152  Hnm2 = Hnm1;
153  Hnm1 = Hn;
154  }
155  }
156  }
157 }
Array< RealType, 2 > hermite
Definition: SHOSet.h:60
QMCTraits::RealType RealType
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ evaluate_notranspose() [1/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
ValueMatrix d2logdet 
)
overridevirtual

evaluate the values, gradients and laplacians of this single-particle orbital for [first,last) particles

Parameters
[in]Pcurrent ParticleSet
[in]firststarting index of the particles
[in]lastending index of the particles
[out]logdetdeterminant matrix to be inverted
[out]dlogdetgradients
[out]d2logdetlaplacians

Implements SPOSet.

Definition at line 102 of file SHOSet.cpp.

References SHOSet::evaluate_vgl(), ParticleSet::R, and SPOSet::size().

108 {
109  for (int iat = first, i = 0; iat < last; ++iat, ++i)
110  {
111  ValueVector p(logdet[i], size());
112  GradVector dp(dlogdet[i], size());
113  ValueVector d2p(d2logdet[i], size());
114  evaluate_vgl(P.R[iat], p, dp, d2p);
115  }
116 }
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75
void evaluate_vgl(PosType r, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
Definition: SHOSet.cpp:127
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51

◆ evaluate_notranspose() [2/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
HessMatrix grad_grad_logdet 
)
overridevirtual

evaluate the values, gradients and hessians of this single-particle orbital for [first,last) particles

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
logdetdeterminant matrix to be inverted
dlogdetgradients
grad_grad_logdethessians

Reimplemented from SPOSet.

Definition at line 530 of file SHOSet.cpp.

References SHOSet::not_implemented().

536 {
537  not_implemented("evaluate_notranspose(P,first,last,logdet,dlogdet,ddlogdet)");
538 }
void not_implemented(const std::string &method)
unimplemented functions call this to abort
Definition: SHOSet.h:107

◆ evaluate_notranspose() [3/3]

void evaluate_notranspose ( const ParticleSet P,
int  first,
int  last,
ValueMatrix logdet,
GradMatrix dlogdet,
HessMatrix grad_grad_logdet,
GGGMatrix grad_grad_grad_logdet 
)
overridevirtual

evaluate the values, gradients, hessians and third derivatives of this single-particle orbital for [first,last) particles

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
logdetdeterminant matrix to be inverted
dlogdetgradients
grad_grad_logdethessians
grad_grad_grad_logdetthird derivatives

Reimplemented from SPOSet.

Definition at line 540 of file SHOSet.cpp.

References SHOSet::not_implemented().

547 {
548  not_implemented("evaluate_notranspose(P,first,last,logdet,dlogdet,ddlogdet,dddlogdet)");
549 }
void not_implemented(const std::string &method)
unimplemented functions call this to abort
Definition: SHOSet.h:107

◆ evaluate_v()

void evaluate_v ( PosType  r,
ValueVector psi 
)

Definition at line 119 of file SHOSet.cpp.

References SHOSet::center, SHOSet::evaluate_d0(), SHOSet::evaluate_hermite(), and SHOSet::length.

Referenced by SHOSet::evaluateValue(), and SHOSet::test_derivatives().

120 {
121  PosType x = (r - center) / length;
122  evaluate_hermite(x);
123  evaluate_d0(x, psi);
124 }
void evaluate_d0(const PosType &xpos, ValueVector &psi)
Definition: SHOSet.cpp:160
QMCTraits::PosType PosType
PosType center
Definition: SHOSet.h:54
RealType length
Definition: SHOSet.h:53
void evaluate_hermite(const PosType &xpos)
Definition: SHOSet.cpp:137

◆ evaluate_vgl()

void evaluate_vgl ( PosType  r,
ValueVector psi,
GradVector dpsi,
ValueVector d2psi 
)

Definition at line 127 of file SHOSet.cpp.

References SHOSet::center, SHOSet::evaluate_d0(), SHOSet::evaluate_d1(), SHOSet::evaluate_d2(), SHOSet::evaluate_hermite(), and SHOSet::length.

Referenced by SHOSet::evaluate_check(), SHOSet::evaluate_notranspose(), SHOSet::evaluateVGL(), and SHOSet::test_derivatives().

128 {
129  PosType x = (r - center) / length;
130  evaluate_hermite(x);
131  evaluate_d0(x, psi);
132  evaluate_d1(x, psi, dpsi);
133  evaluate_d2(x, psi, d2psi);
134 }
void evaluate_d2(const PosType &xpos, ValueVector &psi, ValueVector &d2psi)
Definition: SHOSet.cpp:209
void evaluate_d0(const PosType &xpos, ValueVector &psi)
Definition: SHOSet.cpp:160
QMCTraits::PosType PosType
PosType center
Definition: SHOSet.h:54
void evaluate_d1(const PosType &xpos, ValueVector &psi, GradVector &dpsi)
Definition: SHOSet.cpp:183
RealType length
Definition: SHOSet.h:53
void evaluate_hermite(const PosType &xpos)
Definition: SHOSet.cpp:137

◆ evaluateGradSource() [1/2]

void evaluateGradSource ( const ParticleSet P,
int  first,
int  last,
const ParticleSet source,
int  iat_src,
GradMatrix gradphi 
)
overridevirtual

evaluate the gradients of this single-particle orbital for [first,last) target particles with respect to the given source particle

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
iat_srcsource particle index
gradphigradients

Reimplemented from SPOSet.

Definition at line 551 of file SHOSet.cpp.

References SHOSet::not_implemented().

557 {
558  not_implemented("evaluateGradSource(P,first,last,source,iat,dphi)");
559 }
void not_implemented(const std::string &method)
unimplemented functions call this to abort
Definition: SHOSet.h:107

◆ evaluateGradSource() [2/2]

void evaluateGradSource ( const ParticleSet P,
int  first,
int  last,
const ParticleSet source,
int  iat_src,
GradMatrix grad_phi,
HessMatrix grad_grad_phi,
GradMatrix grad_lapl_phi 
)
overridevirtual

evaluate the gradients of values, gradients, laplacians of this single-particle orbital for [first,last) target particles with respect to the given source particle

Parameters
Pcurrent ParticleSet
firststarting index of the particles
lastending index of the particles
iat_srcsource particle index
gradphigradients of values
grad_grad_phigradients of gradients
grad_lapl_phigradients of laplacians

Reimplemented from SPOSet.

Definition at line 561 of file SHOSet.cpp.

References SHOSet::not_implemented().

569 {
570  not_implemented("evaluateGradSource(P,first,last,source,iat,dphi,ddphi,dd2phi)");
571 }
void not_implemented(const std::string &method)
unimplemented functions call this to abort
Definition: SHOSet.h:107

◆ evaluateThirdDeriv()

void evaluateThirdDeriv ( const ParticleSet P,
int  first,
int  last,
GGGMatrix grad_grad_grad_logdet 
)
overridevirtual

evaluate the third derivatives of this single-particle orbital set

Parameters
Pcurrent ParticleSet
firstfirst particle
lastlast particle
grad_grad_grad_logdetthird derivatives of the SPO

Reimplemented from SPOSet.

Definition at line 525 of file SHOSet.cpp.

References SHOSet::not_implemented().

526 {
527  not_implemented("evaluateThirdDeriv(P,first,last,dddlogdet)");
528 }
void not_implemented(const std::string &method)
unimplemented functions call this to abort
Definition: SHOSet.h:107

◆ evaluateValue()

void evaluateValue ( const ParticleSet P,
int  iat,
ValueVector psi 
)
overridevirtual

evaluate the values of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO

Implements SPOSet.

Definition at line 84 of file SHOSet.cpp.

References ParticleSet::activeR(), SHOSet::evaluate_v(), and SPOSet::size().

85 {
86  const PosType& r(P.activeR(iat));
87  ValueVector p(&psi[0], size());
88  evaluate_v(r, p);
89 }
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75
QMCTraits::PosType PosType
void evaluate_v(PosType r, ValueVector &psi)
Definition: SHOSet.cpp:119
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49

◆ evaluateVGL()

void evaluateVGL ( const ParticleSet P,
int  iat,
ValueVector psi,
GradVector dpsi,
ValueVector d2psi 
)
overridevirtual

evaluate the values, gradients and laplacians of this single-particle orbital set

Parameters
Pcurrent ParticleSet
iatactive particle
psivalues of the SPO
dpsigradients of the SPO
d2psilaplacians of the SPO

Implements SPOSet.

Definition at line 92 of file SHOSet.cpp.

References ParticleSet::activeR(), SHOSet::evaluate_vgl(), and SPOSet::size().

93 {
94  const PosType& r(P.activeR(iat));
95  ValueVector p(&psi[0], size());
96  GradVector dp(&dpsi[0], size());
97  ValueVector d2p(&d2psi[0], size());
98  evaluate_vgl(r, p, dp, d2p);
99 }
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75
void evaluate_vgl(PosType r, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
Definition: SHOSet.cpp:127
QMCTraits::PosType PosType
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51

◆ getClassName()

std::string getClassName ( ) const
inlineoverridevirtual

return class name

Implements SPOSet.

Definition at line 71 of file SHOSet.h.

71 { return "SHOSet"; }

◆ initialize()

void initialize ( )

Definition at line 29 of file SHOSet.cpp.

References SHOSet::bvalues, QMCTraits::DIM, SHOSet::hermite, SHOSet::length, qmcplusplus::n, SHOSet::nmax, SPOSet::OrbitalSetSize, SHOSet::prefactors, SHOSet::qn_max, Array< T, D, ALLOC >::resize(), qmcplusplus::Units::time::s, qmcplusplus::sqrt(), and SHOSet::state_info.

Referenced by SHOSet::SHOSet().

30 {
31  using std::sqrt;
32 
33  OrbitalSetSize = state_info.size();
34 
35  qn_max = -1;
36  for (int s = 0; s < state_info.size(); ++s)
37  for (int d = 0; d < DIM; ++d)
38  qn_max[d] = std::max(qn_max[d], state_info[s].quantum_number[d]);
39  qn_max += 1;
40 
41  nmax = -1;
42  for (int d = 0; d < DIM; ++d)
43  nmax = std::max(nmax, qn_max[d]);
44 
45  prefactors.resize(nmax);
48 
49  //d0_values.resize(DIM,nmax);
50  //d1_values.resize(DIM,nmax);
51  //d2_values.resize(DIM,nmax);
52 
53  if (nmax > 0)
54  {
55  prefactors[0] = 1.0 / (sqrt(sqrt(M_PI) * length));
56  for (int n = 1; n < nmax; ++n)
57  prefactors[n] = prefactors[n - 1] / sqrt(2. * n);
58  }
59 }
Array< RealType, 2 > hermite
Definition: SHOSet.h:60
std::vector< SHOState > state_info
Definition: SHOSet.h:58
std::vector< RealType > prefactors
Definition: SHOSet.h:59
void resize(const std::array< SIZET, D > &dims)
Resize the container.
Definition: OhmmsArray.h:65
Array< RealType, 2 > bvalues
Definition: SHOSet.h:61
IndexType OrbitalSetSize
number of Single-particle orbitals
Definition: SPOSet.h:566
RealType length
Definition: SHOSet.h:53
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ makeClone()

std::unique_ptr< SPOSet > makeClone ( ) const
overridevirtual

make a clone of itself every derived class must implement this to have threading working correctly.

Reimplemented from SPOSet.

Definition at line 65 of file SHOSet.cpp.

65 { return std::make_unique<SHOSet>(*this); }

◆ not_implemented()

void not_implemented ( const std::string &  method)
inline

unimplemented functions call this to abort

Definition at line 107 of file SHOSet.h.

References APP_ABORT.

Referenced by SHOSet::evaluate_notranspose(), SHOSet::evaluateGradSource(), and SHOSet::evaluateThirdDeriv().

108  {
109  APP_ABORT("SHOSet::" + method + " has not been implemented.");
110  }
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27

◆ report()

void report ( const std::string &  pad = "") const
overridevirtual

print SPOSet information

Reimplemented from SPOSet.

Definition at line 68 of file SHOSet.cpp.

References qmcplusplus::app_log(), SHOSet::center, qmcplusplus::int2string(), SHOSet::length, SHOSet::nmax, SHOSet::qn_max, qmcplusplus::Units::time::s, and SHOSet::state_info.

69 {
70  app_log() << pad << "SHOSet report" << std::endl;
71  app_log() << pad << " length = " << length << std::endl;
72  app_log() << pad << " center = " << center << std::endl;
73  app_log() << pad << " nmax = " << nmax << std::endl;
74  app_log() << pad << " qn_max = " << qn_max << std::endl;
75  app_log() << pad << " # states = " << state_info.size() << std::endl;
76  app_log() << pad << " states" << std::endl;
77  for (int s = 0; s < state_info.size(); ++s)
78  state_info[s].sho_report(pad + " " + int2string(s) + " ");
79  app_log() << pad << "end SHOSet report" << std::endl;
80  app_log().flush();
81 }
std::ostream & app_log()
Definition: OutputManager.h:65
std::vector< SHOState > state_info
Definition: SHOSet.h:58
std::string int2string(const int &i)
Definition: string_utils.h:119
PosType center
Definition: SHOSet.h:54
RealType length
Definition: SHOSet.h:53
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

◆ setOrbitalSetSize()

void setOrbitalSetSize ( int  norbs)
inlineoverridevirtual

number of orbitals is determined only by initial request

Implements SPOSet.

Definition at line 104 of file SHOSet.h.

104 {}

◆ test_derivatives()

void test_derivatives ( )

Definition at line 306 of file SHOSet.cpp.

References qmcplusplus::abs(), qmcplusplus::app_log(), QMCTraits::DIM, SHOSet::evaluate_v(), SHOSet::evaluate_vgl(), qmcplusplus::int2string(), SHOSet::length, qmcplusplus::Units::distance::m, qmcplusplus::n, qmcplusplus::real(), SPOSet::size(), and SHOSet::state_info.

307 {
308  int n = 3;
309  PosType c = 5.123;
310  PosType L = 1.0;
311  PosType drg = L / n;
312  PosType dr = L / 1000;
313  int nphi = state_info.size();
314 
315  PosType o2dr, odr2;
316 
317  ValueVector vpsi, vpsitmp;
318  GradVector vdpsi, vdpsin;
319  ValueVector vd2psi, vd2psin;
320 
321 
322  vpsi.resize(nphi);
323  vdpsi.resize(nphi);
324  vd2psi.resize(nphi);
325 
326  vpsitmp.resize(nphi);
327  vdpsin.resize(nphi);
328  vd2psin.resize(nphi);
329 
330 
331  ValueVector psi(&vpsi[0], size());
332  GradVector dpsi(&vdpsi[0], size());
333  ValueVector d2psi(&vd2psi[0], size());
334 
335  ValueVector psitmp(&vpsitmp[0], size());
336  GradVector dpsin(&vdpsin[0], size());
337  ValueVector d2psin(&vd2psin[0], size());
338 
339 
340  app_log() << " loading dr" << std::endl;
341 
342  RealType odr2sum = 0.0;
343  for (int d = 0; d < DIM; ++d)
344  {
345  RealType odr = 1.0 / dr[d];
346  o2dr[d] = .5 * odr;
347  odr2[d] = odr * odr;
348  odr2sum += odr2[d];
349  }
350 
351  app_log() << "SHOSet::test_derivatives" << std::endl;
352 
353  const SimulationCell simulation_cell;
354  ParticleSet Ps(simulation_cell);
355 
356  int p = 0;
357  PosType r, rtmp;
358  for (int i = 0; i < n; ++i)
359  {
360  r[0] = c[0] + i * drg[0];
361  for (int j = 0; j < n; ++j)
362  {
363  r[1] = c[1] + j * drg[1];
364  for (int k = 0; k < n; ++k)
365  {
366  r[2] = c[2] + k * drg[2];
367 
368  //evaluate_check(r,psi,dpsi,d2psi);
369  //APP_ABORT("SHOSet eval check");
370 
371  evaluate_vgl(r, psi, dpsi, d2psi);
372 
373  for (int m = 0; m < nphi; ++m)
374  d2psin[m] = -2 * odr2sum * psi[m];
375  for (int d = 0; d < DIM; ++d)
376  {
377  rtmp = r;
378  rtmp[d] += dr[d];
379  evaluate_v(rtmp, psitmp);
380  for (int m = 0; m < nphi; ++m)
381  {
382  ValueType phi = psitmp[m];
383  dpsin[m][d] = phi * o2dr[d];
384  d2psin[m] += phi * odr2[d];
385  }
386  rtmp = r;
387  rtmp[d] -= dr[d];
388  evaluate_v(rtmp, psitmp);
389  for (int m = 0; m < nphi; ++m)
390  {
391  ValueType phi = psitmp[m];
392  dpsin[m][d] -= phi * o2dr[d];
393  d2psin[m] += phi * odr2[d];
394  }
395  }
396 
397  RealType dphi_diff = 0.0;
398  RealType d2phi_diff = 0.0;
399  for (int m = 0; m < nphi; ++m)
400  for (int d = 0; d < DIM; ++d)
401  dphi_diff = std::max<RealType>(dphi_diff, std::abs(dpsi[m][d] - dpsin[m][d]) / std::abs(dpsin[m][d]));
402  for (int m = 0; m < nphi; ++m)
403  d2phi_diff = std::max<RealType>(d2phi_diff, std::abs(d2psi[m] - d2psin[m]) / std::abs(d2psin[m]));
404  app_log() << " " << p << " " << dphi_diff << " " << d2phi_diff << std::endl;
405  app_log() << " derivatives" << std::endl;
406  for (int m = 0; m < nphi; ++m)
407  {
408  std::string qn = "";
409  for (int d = 0; d < DIM; ++d)
410  qn += int2string(state_info[m].quantum_number[d]) + " ";
411  app_log() << " " << qn;
412  for (int d = 0; d < DIM; ++d)
413  app_log() << real(dpsi[m][d]) << " ";
414  app_log() << std::endl;
415  app_log() << " " << qn;
416  for (int d = 0; d < DIM; ++d)
417  app_log() << real(dpsin[m][d]) << " ";
418  app_log() << std::endl;
419  }
420  app_log() << " laplacians" << std::endl;
421  PosType x = r / length;
422  for (int m = 0; m < nphi; ++m)
423  {
424  std::string qn = "";
425  for (int d = 0; d < DIM; ++d)
426  qn += int2string(state_info[m].quantum_number[d]) + " ";
427  app_log() << " " << qn << real(d2psi[m] / psi[m]) << std::endl;
428  app_log() << " " << qn << real(d2psin[m] / psi[m]) << std::endl;
429  }
430  p++;
431  }
432  }
433  }
434 
435  app_log() << "end SHOSet::test_derivatives" << std::endl;
436 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::ostream & app_log()
Definition: OutputManager.h:65
std::vector< SHOState > state_info
Definition: SHOSet.h:58
std::string int2string(const int &i)
Definition: string_utils.h:119
float real(const float &c)
real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs.
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75
void evaluate_vgl(PosType r, ValueVector &psi, GradVector &dpsi, ValueVector &d2psi)
Definition: SHOSet.cpp:127
QMCTraits::PosType PosType
QTBase::ValueType ValueType
Definition: Configuration.h:60
void evaluate_v(PosType r, ValueVector &psi)
Definition: SHOSet.cpp:119
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
RealType length
Definition: SHOSet.h:53
QMCTraits::RealType RealType
OrbitalSetTraits< ValueType >::GradVector GradVector
Definition: SPOSet.h:51

◆ test_overlap()

void test_overlap ( )

Definition at line 439 of file SHOSet.cpp.

References qmcplusplus::abs(), qmcplusplus::app_log(), SHOSet::bvalues, SHOSet::evaluate_d0(), SHOSet::evaluate_hermite(), SHOSet::length, qmcplusplus::n, SHOSet::prefactors, SHOSet::qn_max, Array< T, D, ALLOC >::resize(), and SPOSet::size().

440 {
441  app_log() << "SHOSet::test_overlap" << std::endl;
442 
443 
444  //linear
445  int d = 0;
446 
447  app_log() << " length = " << length << std::endl;
448  app_log() << " prefactors" << std::endl;
449  for (int n = 0; n < qn_max[d]; ++n)
450  app_log() << " " << n << " " << prefactors[n] << std::endl;
451 
452  app_log() << " 1d overlap" << std::endl;
453 
454  ValueVector vpsi;
455  vpsi.resize(size());
456  ValueVector psi(&vpsi[0], size());
457 
458  double xmax = 4.0;
459  double dx = .1;
460  double dr = length * dx;
461 
462  int nphi = qn_max[d];
463  Array<double, 2> omat;
464  omat.resize(nphi, nphi);
465  for (int i = 0; i < nphi; ++i)
466  for (int j = 0; j < nphi; ++j)
467  omat(i, j) = 0.0;
468 
469  PosType xp = 0.0;
470  for (double x = -xmax; x < xmax; x += dx)
471  {
472  xp[d] = x;
473  evaluate_hermite(xp);
474  evaluate_d0(xp, psi);
475 
476  for (int i = 0; i < nphi; ++i)
477  for (int j = 0; j < nphi; ++j)
478  omat(i, j) += bvalues(d, i) * bvalues(d, j) * dr;
479  }
480 
481  for (int i = 0; i < nphi; ++i)
482  {
483  app_log() << std::endl;
484  for (int j = 0; j < nphi; ++j)
485  app_log() << omat(i, j) << " ";
486  }
487  app_log() << std::endl;
488 
489 
490  //volumetric
491  app_log() << " 3d overlap" << std::endl;
492  double dV = dr * dr * dr;
493  nphi = size();
494  omat.resize(nphi, nphi);
495  for (int i = 0; i < nphi; ++i)
496  for (int j = 0; j < nphi; ++j)
497  omat(i, j) = 0.0;
498  for (double x = -xmax; x < xmax; x += dx)
499  for (double y = -xmax; y < xmax; y += dx)
500  for (double z = -xmax; z < xmax; z += dx)
501  {
502  xp[0] = x;
503  xp[1] = y;
504  xp[2] = z;
505  evaluate_hermite(xp);
506  evaluate_d0(xp, psi);
507 
508  for (int i = 0; i < nphi; ++i)
509  for (int j = 0; j < nphi; ++j)
510  omat(i, j) += std::abs(psi[i] * psi[j]) * dV;
511  }
512  for (int i = 0; i < nphi; ++i)
513  {
514  app_log() << std::endl;
515  for (int j = 0; j < nphi; ++j)
516  app_log() << omat(i, j) << " ";
517  }
518  app_log() << std::endl;
519 
520 
521  app_log() << "end SHOSet::test_overlap" << std::endl;
522 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::ostream & app_log()
Definition: OutputManager.h:65
std::vector< RealType > prefactors
Definition: SHOSet.h:59
int size() const
return the size of the orbital set Ye: this needs to be replaced by getOrbitalSetSize(); ...
Definition: SPOSet.h:75
void evaluate_d0(const PosType &xpos, ValueVector &psi)
Definition: SHOSet.cpp:160
void resize(const std::array< SIZET, D > &dims)
Resize the container.
Definition: OhmmsArray.h:65
QMCTraits::PosType PosType
Array< RealType, 2 > bvalues
Definition: SHOSet.h:61
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Definition: SPOSet.h:49
RealType length
Definition: SHOSet.h:53
void evaluate_hermite(const PosType &xpos)
Definition: SHOSet.cpp:137
TinyVector< int, DIM > qn_max
Definition: SHOSet.h:57

Member Data Documentation

◆ bvalues

◆ center

◆ d0_values

Array<RealType, 2> d0_values

Definition at line 62 of file SHOSet.h.

Referenced by SHOSet::evaluate_check().

◆ d1_values

Array<RealType, 2> d1_values

Definition at line 63 of file SHOSet.h.

Referenced by SHOSet::evaluate_check().

◆ d2_values

Array<RealType, 2> d2_values

Definition at line 64 of file SHOSet.h.

Referenced by SHOSet::evaluate_check().

◆ hermite

◆ length

◆ nmax

int nmax

Definition at line 56 of file SHOSet.h.

Referenced by SHOSet::initialize(), and SHOSet::report().

◆ prefactors

std::vector<RealType> prefactors

Definition at line 59 of file SHOSet.h.

Referenced by SHOSet::evaluate_d0(), SHOSet::initialize(), and SHOSet::test_overlap().

◆ qn_max

◆ state_info


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