QMCPACK
SoaCuspCorrectionBasisSet.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) 2021 QMCPACK developers.
6 //
7 // File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Jeongnim Kim, jeongnim.kim@intel.com, Intel Corp.
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 
13 /** @file SoaCuspCorrectionBasisSet.h
14  *
15  * Convert CorrectingOrbitalBasisSet using MultiQuinticSpline1D<T>
16  */
17 #ifndef QMCPLUSPLUS_SOA_CUSPCORRECTION_BASISSET_H
18 #define QMCPLUSPLUS_SOA_CUSPCORRECTION_BASISSET_H
19 
20 #include "Configuration.h"
22 #include "Particle/DistanceTable.h"
23 #include "MultiQuinticSpline1D.h"
24 
25 namespace qmcplusplus
26 {
27 // /** Handles a set of correction orbitals per atom
28 // *
29 // * Reduction over the orbitals - beware of the reduction problem
30 // */
31 template<typename T>
32 class CuspCorrectionAtomicBasis
33 {
34  using QMCT = QMCTraits;
37 
41 
42 public:
43  CuspCorrectionAtomicBasis() = default;
44 
45  auto getNumOrbs() const { return AOs.getNumSplines(); }
46 
47  /** copy constructor */
49 
50  inline void initializeRadialSet(LogGrid<T>& radial_grid, QMCT::IndexType orbital_set_size)
51  {
52  r_max_ = radial_grid.rmax();
53  AOs.initialize(radial_grid, orbital_set_size);
54  }
55 
56  template<class T1>
57  inline void addSpline(int mo_idx, OneDimQuinticSpline<T1>& radial_spline)
58  {
59  AOs.add_spline(mo_idx, radial_spline);
60  }
61 
62  inline void evaluate(const T r, T* restrict vals) const
63  {
64  //assume output vars are zero'd
65  if (r >= r_max_)
66  return;
67 
68  size_t nr = AOs.getNumSplines();
69  //FIXME ad-hoc allocation for performance
70  std::vector<T> phi(nr);
71 
72  AOs.evaluate(r, phi.data());
73  for (size_t i = 0; i < nr; ++i)
74  //vals[ID[i]]+=phi[i];
75  vals[i] += phi[i];
76  }
77 
78  inline void evaluate_vgl(const T r,
79  const PosType& dr,
80  T* restrict u,
81  T* restrict du_x,
82  T* restrict du_y,
83  T* restrict du_z,
84  T* restrict d2u) const
85  {
86  //assume output vars are zero'd
87  if (r >= r_max_)
88  return;
89 
90  size_t nr = AOs.getNumSplines();
91  //FIXME ad-hoc allocation for performance
92  std::vector<T> phi(nr);
93  std::vector<T> dphi(nr);
94  std::vector<T> d2phi(nr);
95 
96  AOs.evaluate(r, phi.data(), dphi.data(), d2phi.data());
97  for (size_t i = 0; i < nr; ++i)
98  {
99  const size_t j = i; //ID[i];
100  u[j] += phi[i];
101  du_x[j] -= dphi[i] * dr[0] / r; // Displacements have opposite sign (relative to AOS)
102  du_y[j] -= dphi[i] * dr[1] / r;
103  du_z[j] -= dphi[i] * dr[2] / r;
104  d2u[j] += d2phi[i] + 2 * dphi[i] / r;
105  }
106  }
107 };
108 } // namespace qmcplusplus
109 #endif
multivalue implementation for OneDimQuintic Real valued only calling any eval method with r >= r_max ...
std::vector< T, aligned_allocator< T > > aligned_vector
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QTBase::RealType RealType
Definition: Configuration.h:58
Handles a set of correction orbitals per atom.
void addSpline(int mo_idx, OneDimQuinticSpline< T1 > &radial_spline)
void initializeRadialSet(LogGrid< T > &radial_grid, QMCT::IndexType orbital_set_size)
One-Dimensional logarithmic-grid.
QTBase::PosType PosType
Definition: Configuration.h:61
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
void evaluate(T r, T *restrict u) const
void evaluate_vgl(const T r, const PosType &dr, T *restrict u, T *restrict du_x, T *restrict du_y, T *restrict du_z, T *restrict d2u) const
void add_spline(int ispline, OneDimQuinticSpline< T1 > &in)
T rmax() const
return the last grid point
void evaluate(const T r, T *restrict vals) const
traits for QMC variables
Definition: Configuration.h:49
void initialize(GT &agrid, int norbs, int order=5)
initialize grid and container
Declaration of a base class of BasisSet.
Assume that coeffs.D1 and the LogLightGrid r_values.size() are equal Therefore r must be < r_max...