Introduction

Recently there has been an increase of interest in applying finite element (FE) methods to partial differential equations (PDEs) in quantum mechanics [1,2,3,4,5,6,7,8,9,10,11,12,13,14]. In order to improve the accuracy of the solution, the basis set can be adaptively expanded through either refinement of the mesh (h-adaptivity) or the basis functions can be augmented by the introduction of higher polynomial degree basis functions (p-adaptivity). Since the solution is not smooth and contains cusp singularities, the application of the h-adaptive FEM may require very fine meshes and could be computationally inefficient. There are several approaches to circumvent this problem.

From the physical point of view, for ab initio calculation of molecules often core electrons (as opposed to valence electrons) behave in a similar way to single atom solutions. Thus one possesses an a priori knowledge of a part of the solution vectors to the eigenvalue problem. One of the approaches used to introduce this into a FE formulation is the partition-of-unity method (PUM) [15,16,17], which is a generalization of the classical FE method. In PUM the enrichment functions are introduced into a basis as products with standard FE shape functions, thereby enlarging the standard FE space. As the standard FE functions satisfy the partition-of-unity property (that is, they sum to one in the whole domain), the resulting basis can reproduce enrichment functions exactly. For an overview on PUM applied to continuum mechanics we refer the reader to [18,19,20].

An alternative approach to the above is to combine h- and p-adaptivity resulting in what is termed as hp-adaptive FEM. For an overview of hp-adaptive refinement strategies we refer the reader to [21]. The general idea is that when the exact solution is smooth on the given element, p-adaptive refinement is more efficient and leads to a faster convergence with respect to the number of degrees of freedom; whereas if the solution is non-smooth (singular), h-adaptive refinement is performed. Thus in addition to a reliable error estimate and the choice of the marking strategy of elements for refinement, hp-adaptive methods need to decide which type of refinement to perform on a given element. In this work we use methods based on smoothness estimation [22,23,24,25,26,27]. As those methods are normally employed for problems with a single solution vector, we propose an extension to multiple solution vectors as is required for the here considered eigenvalue problems.

Herein, our main focus is application of h-adaptive PUM to PDEs in quantum mechanics, namely to the Schrödinger equation and the all-electron density functional theory (DFT) [28, 29]. Application of the PUM to the above problems holds a significant promise to improve on accuracy of a standard (non-enriched) FE approximation. The corresponding numerical evidence can be found in [9], where convergence studies for PUM solutions obtained on uniformly refined meshes are performed.

The novelty of our paper is that the PUM will be equipped with an a posteriori error estimator, thus enabling implementation of error-controlled adaptive mesh refinement strategies. Derivation and implementation of the PUM in computational solid mechanics is nowadays very well-acknowledged and established area of research, yet the authors are not aware of any other work which applies the h-adaptive PUM to DFT.

We will also compare the PUM to hp-adaptive FEM in terms of the efficiency with respect to the number of degrees of freedom. Although there are publications on the topic of hp-adaptive FEM applied to DFT [1], they lack any numerical studies and are limited to a pre-defined refinement strategy of hexahedra that admit nuclei only at its vertices. In order to apply the hp-adaptive FEM to DFT, in this paper we propose an extension of the smoothness estimate approach using Legendre coefficients [22,23,24,25] to multiple solutions vectors.

The outline of this paper is as follows: In the section on “Theory”, we introduce the eigenvalue problem studied here. The PUM and error estimators are also discussed. We also explain the strategy employed to decide between h- and p-adaptive refinement for the hp-adaptive FEM. Results of numerical studies of the chosen systems are presented in section titled “Results and discussion”, followed by some conclusions. In Appendix A we rigorously derive the local interpolation error estimates for enrichment with a class of exponential functions; Appendix B describes the approach applied to solve single atom DFT in radial coordinates within application of the PUM; Appendix C discusses implementational details of PUM within the context of the deal.II [30] library.

Theory

In quantum mechanics we seek the N lowest eigenpairs \((\lambda _\alpha ,\psi _\alpha )\) of the Schrödinger equation [31]

$$\begin{aligned} \Bigg [-\frac{1}{2} \nabla ^2 + V(\mathbf{x }) \Bigg ]\, \psi _\alpha (\mathbf{x })&= \lambda _\alpha \psi _\alpha (\mathbf{x }) \quad \mathrm{on}\; \Omega \,, \nonumber \\ \psi _\alpha (\mathbf{x })&= 0 \quad \mathrm{on}\; \partial \Omega , \\ \int _\Omega \psi _\alpha (\mathbf{x }) \psi _\beta (\mathbf{x }) \mathrm{d} \mathbf{x }&= \delta _{\alpha \beta } \,.\nonumber \end{aligned}$$
(1)

Here \(\alpha \) is the index of the eigenpair, \(\Omega \) is a Lipschitz domainFootnote 1 in \(\mathbb {R}^3\) and \(\delta _{\alpha \beta }\) is the Kronecker delta . In Kohn–Sham all-electron density functional theory [28, 29], the potential \(V(\mathbf{x })\) depends on eigenvectors thus rendering the problem nonlinear. For a molecular system consisting of \(N_e\) electrons and M nuclei of charges \(\{Z_\mathrm{I}\}\) located at the (fixed) positions \(\{{\mathbf {\mathsf{{R}}}}_\mathrm{I}\}\), the ground state electron density \(\rho (\mathbf{x }):= \sum _{\alpha =1}^{N} f_\alpha \left|\psi _{\alpha }(\mathbf{x }) \right|^2 \) can be obtained by finding the N lowest eigenpairs of Eq. (1). Here \(f_\alpha \) is the partial occupancy numberFootnote 2 of the \(\alpha \)-orbital such that \(\sum _{\alpha =1}^{N} f_\alpha = N_e\), \(V=V_{\mathrm{ion}}+V_{Hartree}+V_{\mathrm{xc}}\) is composed of the ionic potential \(V_{ion}=-\sum _{\mathrm{I=1}}^M \frac{Z_{\mathrm{I}}}{\left| \mathbf{x } - {\mathbf {\mathsf{{R}}}}_{\mathrm{I}} \right| }\), the Hartree potential \(V_{Hartree}=\int _\Omega \rho (\mathbf{x }')/|\mathbf{x }- \mathbf{x }'|\mathrm{d} \mathbf{x }'\), and the (given) exchange-correlation potential \(V_{xc}(\rho )\). As a result, the potential V depends on the density \(\rho \) which is given in terms of eigenvectors \(\{\psi _\alpha \}\), making the problem nonlinear. From practical perspective \(V_{Hartree}\) electrostatic potential is obtained by solving the associated Laplace equation; together with (1) they are solved sequentially untill convergence in density fields \(\rho \) is attained. For further details on the FE solution of DFT, we refer to our previous work [2] and literature cited therein.

The weak form of Eq. (1) readsFootnote 3

$$\begin{aligned} \begin{aligned} \int _{\Omega } \Bigg [ \frac{1}{2} \nabla v \cdot \nabla \psi _{\alpha } + v V \psi _\alpha \Bigg ] \mathrm{d} \mathbf{x }&= \lambda _\alpha \int _{\Omega } v\psi _\alpha \mathrm{d} \mathbf{x } \quad \forall v \, \in H^1_0(\Omega )\,, \\ \int \psi _\alpha \psi _\beta \mathrm{d} \mathbf{x }&= \delta _{\alpha \beta } \,. \end{aligned} \end{aligned}$$
(2)

We then introduce a FE triangulation \(\mathcal {P}^h\) of \(\Omega \) and the associated FE space of continuous piecewise elements of a fixed polynomial degree : \(\psi _\alpha \in V^h \subset H^1_0 (\Omega )\). The FE solution to the problem is then defined by

$$\begin{aligned} \begin{aligned} \int _{\Omega } \Bigg [ \frac{1}{2} \nabla v^h \cdot \nabla \psi _{\alpha }^h + v^h V \psi _\alpha ^h \Bigg ] \mathrm{d} \mathbf{x }&= \lambda _\alpha ^h \int _{\Omega } v^h \psi _\alpha ^h \mathrm{d} \mathbf{x } \quad \forall \, v^h \in V^h\,, \\ \int \psi _\alpha ^h \psi _\beta ^h \mathrm{d} \mathbf{x }&= \delta _{\alpha \beta } \,. \end{aligned} \end{aligned}$$
(3)

Partition-of-unity method

The classical FEM with piecewise linear ansatz spaces requires very fine meshes for adequate accuracy when the solution is not smooth or is highly oscillatory; this increases the computational cost of solving the problem. The PUM proposed by Melenk and Babuska in [15, 16] can address this issue. The main feature of the PUM is the inclusion of an a priori knowledge about the solution properties into the FE space. The PUM enriches the vector space spanned by standard FE basis functions \(N_i(\mathbf{x })\) (e.g. polynomials) by products of these functions with functions \(f_{j}(\mathbf{x })\) that contain a-priori knowledge about the solution

$$\begin{aligned} \psi _\alpha ^h(\mathbf{x }) = \sum _{i \in I} N_i(\mathbf{x }) \,\left[ \psi ^i_\alpha + \sum _{j \in S} f_j(\mathbf{x }) \widetilde{\psi }^{ij}_\alpha \right] . \end{aligned}$$
(4)

Here \(\psi ^i_\alpha \) are standard degrees-of-freedom (DoFs) and \(\widetilde{\psi }^{ij}_\alpha \) are additional DoFs associated with the shape functions \(N_i(\mathbf{x })\) and the enrichment functions \(f_j(\mathbf{x })\); I is a set of all nodes and S is the set of enrichment functions. Since (possibly global) enrichment functions \(f_j(\mathbf{x })\) are multiplied with \(N_i(\mathbf{x })\) which has local support, the product also has local support and therefore matrices arising from the weak form remain sparse. Also, since the standard shape functions satisfy the partition of unity property \(\sum _i N_i(\mathbf{x }) \equiv 1\), the resulting vector space can reproduce enrichment functions \(f_j(\mathbf{x })\) exactly.

Note that (4) is a more general approach than enriching the basis with \(f_j\) alone (i.e. without multiplying by \(N_i\), as is employed in [32]). Granted the partition of unity property of \(N_i\), this case can be obtained from (4) by requiring all DoFs associated with a given enrichment function \(f_j\) to have the same value.

Error estimator

A posteriori error estimation analysis for FE approximations of (second-order) eigenvalue problems has been a topic of intensive study within the last several decades, both from theoretical and implementational standpoints. We refer the interested reader to [13, 14, 33,34,35,36,37,38,39], where two “conventional” types of error estimators, namely residual- and averaging-based error estimators, are presented.

In general, a discretization error in approximated eigenfunctions, \(\psi -\psi ^h\), measured in a suitable norm (e.g. \(L^2\)-norm and energy norm, induced by the bilinear form of a problem), as well as in approximated eigenvalues, \(|\lambda -\lambda ^h|\), can be estimated from above. That is,

$$\begin{aligned} \left\| \psi -\psi ^h\right\| \le C_1\eta , \end{aligned}$$
(5)

and

$$\begin{aligned} |\lambda -\lambda ^h|\le C_2\eta ^2, \end{aligned}$$
(6)

where \(C_1,C_2\) are the so-called stability constants that are independent of the mesh size and \(\eta \) is the explicitly computable Footnote 4 error upper-bound, see e.g. [34, 38] for details. These equations are typically termed (global) error estimators. The bound \(\eta \) reads as

$$\begin{aligned} \eta :=\left[ \sum _{K\in \mathcal {P}^h} \eta _K^2 \right] ^\frac{1}{2}, \end{aligned}$$

where summation is performed over all elements in \(\mathcal {P}^h\) and \(\eta _K\) is the (local) error indicator, a quantity showing a discretization error of \(\{\psi ^h,\lambda ^h\}\) element-wise, that is, on every fixed K. With multiple solutions available (in this case, eigenpairs \(\{\psi ^h_\alpha ,\lambda ^h_\alpha \}\)), \(\eta _K\) will be a sum of discretization errors of the corresponding eigenpairs on a given element K, that is

$$\begin{aligned} \eta _K:=\left[ \sum _{\alpha } \eta _{K,\alpha }^2 \right] ^\frac{1}{2}. \end{aligned}$$

For a standard (non-enriched) \(\mathbb {Q}_1\)-based finite element solution of (1), a local indicator \(\eta _{K,\alpha }\) of residual type reads as follows (see [13, 14, 34, 35, 38, 39] for details):

$$\begin{aligned} \eta _{K,\alpha }^2:= & {} h_K^2 \int _K \left[ \,\Bigg ( -\frac{1}{2} \nabla ^2 + V(\mathbf x )\Bigg ) \psi ^h_\alpha - \lambda ^h_\alpha \,\psi ^h_\alpha \right] ^2 \mathrm{d} \mathbf{x } \nonumber \\&+ \, h_K \sum _{e\subset \partial K} \int _e \left[ \left[ -\frac{1}{2}\nabla \psi ^h_\alpha \cdot \mathbf{n }\right] \right] _e^2 \mathrm{d} \mathbf{a }, \end{aligned}$$
(7)

where \([[-\frac{1}{2}{\nabla } \psi ^h_\alpha \cdot \mathbf{n } ]]_e:=\left[ -\frac{1}{2} {\nabla } \psi ^h_\alpha \,|_{K}+\frac{1}{2}\nabla \psi ^h_\alpha \,|_{K'} \right] \cdot \mathbf{n }_e\) represents the jump of the gradient across interface e between two adjacent elements K and \(K'\), \(\mathbf{n }_e\) is the outward unit normal vector to e and \(h_K:=\mathrm {diam}(K)\).

One of the key findings of our work is the proof that indicator (7) also holds (with no modification due to the enrichment usage) in the PUM with the exponential enrichment function \(f(\mathbf{x }) = \exp {(-\mu \left|\mathbf{x } \right|^k)}\). In Appendix A, we derive and prove the related local interpolation error estimates required for the derivation of the error indicator (7).

hp-adaptive solution

There have been numerous works devoted to hp-adaptive refinement [22,23,24,25, 40,41,42] including a comparison of different methods [21]. The main difficulty that a posteriori hp-adaptive methods aim to address is the following: once an error is estimated and a certain subset of elements is marked for refinement, one has to choose between h- or p-refinement for each element. In this work we adopt an hp-refinement method based on the estimate of the analyticity of the solutionFootnote 5 on the reference element via expansion into Legendre bases [22,23,24,25]. In particular, the FE solution is analytic on element K if, and only if, there exists constants \(C_K\) and \(\sigma _K\) such that

$$\begin{aligned} \left|a_{ijk}^K \right| \le C_K \exp (-\sigma _K [i+j+k]) , \end{aligned}$$
(8)

where \(a_{ijk}\) are Legendre coefficients; see [25] for further details. We chose to estimate the decay coefficient \(\sigma _K\) by performing a least squares fit of Legendre coefficients in each direction \(\ln \left|a_{d,i}^K \right| \sim \ln C_K^d - \sigma _K^d \, i \) for \(1 \le i \le p_K\), and then use the minimum decay coefficient as the final value \(\sigma _K=\min _d \sigma _K^d\). When \(\sigma _K\) value is below a chosen parameter \(\sigma _0\), the solution is considered to be smooth at K and thus p-refinement is performed, otherwise h-refinement is executed. For initially linear FEs p-refinement is always performed. We note that methods based on the decay rate of the expansion coefficients were found in [21] to be the best choice as a general strategy for the hp-adaptive solution of elliptic problems. To the best of our knowledge there is, however, very little (numerical) study of those methods applied to DFT. The only paper we are aware of [1] lacks any numerical results. We also note that, in the majority of cases, hp-adaptive FEM is applied to problems in \(\mathbb {R}^1\) and \(\mathbb {R}^2\). Thus we also aim to evaluate how well the smoothness estimators proposed in the literature work for eigenvalue problems in \(\mathbb {R}^3\) that are relevant to quantum mechanics. In order to extend this hp-refinement strategy to the eigenvalue problem, that is when there are multiple vectors represented using the same FE basis, we propose the following approach. For each element we find an eigenvector which contributes the most to the total element’s error. The smoothness of this vector is the basis on which we decide to perform h-refinement or p-refinement. The rationale behind this approach is that we aim at minimizing the error the most during a single refinement step while being conservative and avoiding performing both h- and p-refinement on the same element. We also investigated allowing both h- and p-adaptive refinement of a single cell based on smoothness estimation of all eigenvectors, but ultimately found that this procedure leads to qualitatively similar results for the problems studied herein.

Finally, for the error indicator we adopt the following expression [43]

$$\begin{aligned}&\eta ^2_{K,\alpha } := \frac{h_{K}^2}{p_K^2} \int _{K} \left[ \,\Bigg ( -\frac{1}{2} \nabla ^2 + V(\mathbf{x })\Bigg ) \psi ^h_\alpha - \lambda ^h_\alpha \,\psi ^h_\alpha \right] ^2 \mathrm{d} \mathbf{x }\nonumber \\&\quad + \sum _{e \subset \partial K} \frac{h_{e}}{2 p_e} \int _{e} \left[ \left[ -\frac{1}{2}{\nabla } \psi _\alpha ^h \cdot \mathbf{n } \right] \right] _e^2 \mathrm{d} \mathbf{a } \,, \end{aligned}$$
(9)

where \(h_e\) is the face’s diameter, \(p_K\) is the element’s polynomial degree and \(p_e\) is the maximum polynomial degree over two elements K and \(K'\) adjacent to the face e.

The derivation of the error estimators for hp-FEM usually requires the polynomial degree of neighbouring elements to be comparable, namely that there exists \(\gamma \) and \(\Gamma \) such that \(\gamma p_K \le p_{K^\prime } \le \Gamma p_K\) for all elements \(K, K^\prime \) that have a non-empty intersection. In order to reflect this assumption in our numerical scheme, we propose that an additional step which limits the differences in polynomial degrees among elements be performed. More precisely, after hp-adaptive refinement is executed, then for each element K, we find the maximum polynomial degree among its neighbouring elements \(p_\mathrm{neigh}^\mathrm{max}\) and if \(p_\mathrm{neigh}^\mathrm{max} > p_K + 2\) then we set \(p_K \leftarrow p_K+1\).

Results and discussion

If not explicitly stated otherwise, the results below are obtained for the following configuration: (i) the initial polynomial degree for non-enriched DoFs is one for hp-adaptive FEM; (ii) linear shape functions are used in PUM to introduce enrichments, higher order elements were not employed as the interpolation error estimates are derived only for linear elements and thus limit the applicability of the error indicator stated in Eq. (7) ; (iii) a Gaussian quadrature rule with \(20^3\) points is used for enriched elements in the eigenvalue problem; (iv) the Dörfler marking strategy with \(\theta = 0.6\) is used to mark elements for refinement; (v) Gauss–Legendre–Lobatto supports points are used for the hp-adaptive FEM basis to improve the condition number; (vi) in case of hp-adaptive refinement the highest polynomial degree is limited to 8 for computational efficiency reasons; (vii) the radius in which enriched FEs are employed is heuristically chosen for each numerical example; (viii) following [25] we choose \(\sigma _0=1.0\) as a parameter in the smoothness estimator.Footnote 6 Implementation details of the partition-of-unity method in deal.II [30] finite element library are given in Appendix C.

Schrödinger equation

In this section we consider the Schrödinger equation Eq. (1) with two different (spherical) potentials \(V(\mathbf{x })=V(\left|\mathbf{x } \right|)\).Footnote 7 The first case is the Coulomb potential \(V(\mathbf{x }) = -\,1/\left|\mathbf{x } \right|\), which corresponds to a Hydrogen atom. The eigenvalues of this problem are degenerate. In \(\mathbb {R}^3\), on each energy level n there are \(n^2\) eigenvalues \(\lambda _n = \lambda _1/n^2\), where \(\lambda _1 = -\,1/2\) [31]. The eigenfunction corresponding to the lowest eigenvalue reads

$$\begin{aligned} \psi _1(\mathbf{x }) = \frac{1}{\sqrt{\pi }} \exp \left( -\left|\mathbf{x } \right| \right) . \end{aligned}$$
(10)

The radial component of the eigenfunctions at the next energy level are \(R_{2,0}=[1-\left|\mathbf{x } \right|/2]\exp (-\left|\mathbf{x } \right|/2)\) and \(R_{2,1}=\left|\mathbf{x } \right|/2\exp (-\left|\mathbf{x } \right|/2)\).

The second potential we will consider is a harmonic potential \(V(\mathbf{x })=\left|\mathbf{x } \right|^2/2\) that leads to a harmonic oscillator problem. The eigenvalues for this problem are also degenerate; in \(\mathbb {R}^3\) they are given by \(\lambda _n = n+1/2\) for nth energy level. The lowest two have a degeneracy of 1 and 3, respectively. The (unnormalized) eigenfunction corresponding to the lowest eigenvalue is

$$\begin{aligned} \psi _1(\mathbf{x }) = \exp \left( -\left|\mathbf{x } \right|^2/2 \right) . \end{aligned}$$
(11)

The radial component of the next eigenfunction is \(R_{0,1}(\mathbf{x }) = \left|\mathbf{x } \right| \exp \left( -\left|\mathbf{x } \right|^2/2 \right) \). Figure 1 shows radial components of eigenfunctions for the Coulomb and the harmonic potential. It is clear that in order to have a low interpolation error for a standard Lagrange FE basis, a very fine mesh will be required near the origin. For such non-smooth solutions we will see that by introducing enrichment functions the interpolation error of the resulting FE basis will be greatly reduced.

Fig. 1
figure 1

Radial components of eigenfunctions for different potentials V(x). The dotted vertical line indicates the smallest initial mesh size which will be used in our numerical calculations. a Coulomb. b Harmonic

The initial mesh used to solve the Schrödinger equation is obtained from 3 global mesh refinements of the single element in \(\Omega =[-\,20;20]^3\) for the Coulomb potential and \(\Omega =[-\,10;10]^3\) for the harmonic potential. For the PUM only 8 elements adjacent to the singularity that is located at the origin are marked for enrichment.

First, we examine the convergence in case when a single eigenpair is required in the Schrödinger equation with two different potentials. Figure 2 compares the h-adaptive FEM, hp-adaptive FEM and h-adaptive PUM, whereas Fig. 3 shows the cross-sections of meshes for the last refinement step.

Fig. 2
figure 2

Error convergence rates for an eigenproblem with a single eigenpair. a Coulomb potential. b Harmonic potential

Fig. 3
figure 3

Cross-sections of the final adaptive meshes for the Coulomb potential when solving for a single eigenpair. a h-adaptive FEM (linear). b h-adaptive FEM (quadratic). c hp-adaptive FEM. d h-adaptive PUM (linear)

For both combinations of potentials and enrichment functions, the h-adaptive PUM is superior to h-adaptive FEM. In particular, for the last refinement step the PUM solution is about two orders more accurate than the h-adaptive FEM with the same number of DoFs in the case of the Coulomb potential. For the harmonic potential this value is smaller. The asymptotic convergence rate of the h-adaptive PUM with the default enrichment radius is very similar to that of the h-adaptive FEM for both problems (compare green and red lines in Fig.  2), which supports our theoretical findings.

The advantage of the h-adaptive PUM also depends on the enrichment radius with respect to the underlying exact solution. To examine this effect we employ an initial mesh obtained only by two global refinements of a single element and mark the 8 elements adjacent to the origin for enrichment. With this approach we effectively consider a larger enrichment domain \([-\,5;5]^3\) instead of \([-\,2.5;2.5]^3\). Importantly, the numerically non-zero part of the underlying analytical solution will be almost fully contained in those 8 elements (see Fig. 1b). From the numerical results we observe that for the most refined stage the h-adaptive PUM displays an error which is about 6 orders of magnitude less than the same method with the smaller enrichment domain (compare purple and green lines in Fig. 2b).

For the case of a single eigenpair, the hp-adaptive FEM performs remarkably well and, unless a larger enrichment radius is used in h-PUM, it converges to the higher tolerance with fewer number of DoFs (compare blue and green lines in Fig. 2).

Now let us turn our attention to a more realistic scenario where one seeks multiple eigenpairs whereby an a priori knowledge is available only for the first eigenfunction. Figure 4 plots the convergence of the first 5 eigenvalues for the Coulomb potential and the first 4 eigenvalues for the harmonic potential for the different methods. For both problems the h adaptive PUM again has remarkable convergence properties, superior to h-adaptive FEM. It is important to note that even though in the PUM the enrichment function corresponds to the first eigenfunction only, other eigenpairs in the case of the harmonic potential tend to converge faster than the standard h-adaptive FEM case, as can be observed in Fig. 4b. The same applies to the spherical orbital at the second energy level of the Hydrogen atom; see Fig. 4a where the corresponding eigenvalue in the PUM case displays a faster convergence rate than the others on the same energy level.

Fig. 4
figure 4

Convergence of eigenvalues from the first two energy levels for the Schrödinger equation in the course of adaptive refinement. Red lines denote the lowest eigenvalue, whereas blue lines correspond to degenerate eigenvalues on the next energy level. a Coulomb potential (4 out of 5 eigenvalues are degenerate). b Harmonic potential (3 out of 4 eigenvalues are degenerate)

For the Hydrogen atom, in the case of the hp-adaptive refinement one observes a superior convergence rate of the first eigenvalue, whereas eigenvalues from the next energy level have errors that are comparable to the h-adaptive linear FEM. A possible issue could be related to the smoothness estimation on elements with hanging nodes. In particular it is observed [44] that the smoothness is overestimated when using similar methods, albeit based on Fourier coefficients. This leads to unnecessarily high order polynomial degrees in these areas. Clearly, further investigation is required to resolve this problem.

Density functional theory

Finally, we apply the here considered FE approaches to the Kohn–Sham density functional theory. As a first test problem we consider a single He atom which has a single doubly occupied state, i.e. \(N_e=2\) and \(N=1\). The ground state energy from the radial solution is \(E_0=-\,2.834289\). Enrichment functions for PUM are obtained from numerical solution of single atom Schrödinger equations, depicted in Fig. 5a. The atom is placed at the origin in the domain \(\Omega =[-\,10;10]^3\) with the homogeneous mesh of size \(h=2.5\). Eight elements adjacent to the atom are enriched.

Fig. 5
figure 5

Finite element solution of He atom. a Scaled radial solution. The dotted vertical line indicates the enrichment radius. b Convergence of the error in total energy of He atom for various FE methods

Figure 5b compares the h-adaptive FEM, hp-adaptive FEM and h-adaptive PUM. One immediately recognizes that the PUM leads to a much faster convergence in terms of DoFs and gives about an order of magnitude advantage in terms of the absolute value of the error. The linear h-adaptive FEM would require ten times more DoFs to achieve the same accuracy. The hp-adaptive FEM displays an exponential-like decay and approaches the accuracy of PUM at higher number of DoFs.

In the second test problem we consider a CO molecule in the domain \(\Omega =[-\,10;10]^3\) at the (equilibrium) distance 2.1. In order to estimate the ground state energy, we fit the total energy obtained by h-FEM at the last 3 mesh refinement steps to \(\mathrm{ln}(|E^h-E_0|) = C + q\,\mathrm{ln}( \mathrm{DoFs})\) with constraints \(C>0,\,E_0<E^h,\,q<0\). Using this approach we estimate the limit of the ground state energy to be \(E_0=-\,112.47107\). This renders a bond energyFootnote 8 of \(-\,0.5775\), which compares favourably to the value \(-\,0.578\) reported in [45]. This gives us confidence to use the estimated ground state energy value in convergence studies, which are presented in Fig. 6.

The enrichment functions for PUM are obtained from the numerical solution of single atom Schrödinger equations; see Appendix B for details. The scaling of those functions are not important for PUM, so Fig. 6a depicts radial solutions normalized so that the value of the 1s and 2s orbitals are unity at the origin. It is generally possible to use all eigenfunctions from the radial solution as enrichments around each atom in the radius of a few atomic units. However, extra care must be taken not to render the resulting FE space to have linearly dependent basis functions. Figure 6a clearly indicates that given small enough elements (on the order 0.1 a.u.), enriching with both 1s and 2s single atom radial core electrons solutions would make the FE space degenerate. Our current implementation of PUM DFT only supports enrichment in non-overlapping domains. Therefore for the CO molecule we have to start from a relatively fine mesh, which in the course of h-adaptive refinement may render the basis enriched with multiple functions linearly dependent. To avoid this, the PUM results for the CO molecule are obtained by enriching 8 elements adjacent to each atom with its 1s orbital only. Scaling of the 1s function to unity at the origin of the enrichment spherical function improves the condition number of the resulting matrices.

Figure 6b compares the convergence characteristics using the h-adaptive FEM, hp-adaptive FEM and h-adaptive PUM. The energy error convergence rate from h-adaptive FEM compares favourably to the expected rate of \(\mathcal {{O}}(h^{2p})\), which can be approximated by \(\mathcal {{O}}(\mathrm{DoFs}^{-2p/3})\). Remarkably, the chosen smoothness estimate used in the hp-adaptive FEM and its extension to multiple vectors do not lead to an increase in efficiency in terms of the number of DoFs as compared to h-adaptive quadratic FEM. The h-adaptive PUM displays the same convergence rate as h-adaptive FEM and is, as expected, more accurate. This, however, comes at the expense of having a worse condition number for the resulting matrices and the necessity to use higher quadrature order to perform sufficiently accurate numerical integration. For this example and the chosen enrichment radius, the difference in energy error between the two approaches is less than one order of magnitude. By comparing these results to those presented earlier for H and He atoms, we hypothetize that a larger enrichment radius is required to make the PUM advantageous compared to the h-adaptive FEM. Our current implementation of PUM DFT, however, only allows enrichment in non-overlapping domains, which limited the enrichment radius for the CO example.

Fig. 6
figure 6

Finite element solution of CO molecule. a Scaled radial solution of single atoms. The dotted vertical line at 0.5 indicates the enrichment radius. b Convergence of the error in total energy of CO molecule for various FE methods

Conclusions

In this contribution we have applied and critically compared the h- and hp-adaptive FEM, and the h-adaptive PUM to the relevant PDEs in quantum mechanics, namely the Schrödinger equation and the Kohn–Sham all-electron density functional theory. The main findings are summarized below.

  • The PUM renders several orders of magnitude more accurate eigenvalues than the standard FEM when solving the Schrödinger equation for the lowest eigenpair with Coulomb and harmonic potential. For the case when more eigenpairs are sought but only the lowest eigenvector is introduced as an enrichment, the PUM is still more accurate, especially for the lowest eigenvalue. Remarkably other eigenvalues also exhibit a faster convergence. The results from DFT calculations indicate that in order to keep this advantage, a reasonably large enrichment radius is needed.

  • For problems where a single eigenpair is being sought, the hp-adaptive FEM with the here considered smoothness and residual error estimators results in a more accurate solution with fewer number of DoFs as compared to h-adaptive PUM and FEM. However, for the case of multiple eigenpairs this approach did not lead to satisfactory results. Overall we find h-adaptive PUM to be a more robust solution method to reach the required accuracy even with relatively small enrichment domains.

  • Local interpolation error estimates are derived for the PUM enriched with the class of exponential functions. In this case the results are the same as for the standard FEM and thereby admit the usage of the error indicator (7).

  • For the PUM DFT calculations the convergence rate of energy error and the residual error estimator are the same for all studied examples. Thus our numerical results confirm that Eq. (7) can be considered as a reliable error indicator for problems in quantum mechanics.

  • An element view to the implementation of PUM in FEM codes based on hexahedra is proposed (see Appendix C). As a result, continuity of the enriched field along the edges with hanging nodes is enforced by treating FE spaces produced by each function in the local approximation space separately. The resulting algebraic constraints are independent on the enrichment functions. This allows one to directly reuse algorithms written for enforcing continuity of vector-valued FE spaces constructed from a list of scalar-valued FEs.