This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

High-order finite element method for atomic structure calculations

[Uncaptioned image] Ondřej Čertík
Computational Physics and Methods (CCS-2)
Los Alamos National Laboratory
NM 87545, USA
ondrej@certik.us &John E. Pask
Physics Division
Lawrence Livermore National Laboratory
Livermore, CA 94550, USA
pask1@llnl.gov &[Uncaptioned image] Isuru Fernando
Department of Computer Science
University of Illinois at Urbana–Champaign
Urbana, IL 61801, USA isuruf@gmail.com &[Uncaptioned image] Rohit Goswami
Science Institute, University of Iceland
Quansight Labs, TX, Austin
rgoswami@ieee.org &N. Sukumar
Department of Civil and Environmental Engineering
University of California, Davis
CA 95616, USA
nsukumar@ucdavis.edu &[Uncaptioned image] Lee A. Collins
Physics and Chemistry of Materials (T-1)
Los Alamos National Laboratory
NM 87545, USA
lac@lanl.gov &Gianmarco Manzini
Applied Mathematics and Plasma Physics (T-5)
Los Alamos National Laboratory
NM 87545, USA
gmanzini@lanl.gov &[Uncaptioned image] Jiří Vackář
Institute of Physics
Academy of Sciences of the Czech Republic
Na Slovance 2, 182 21 Praha 8, Czech Republic
vackar@fzu.cz
Currently at GSI Technology, USACorresponding Author
Abstract

We introduce featom, an open source code that implements a high-order finite element solver for the radial Schrödinger, Dirac, and Kohn-Sham equations. The formulation accommodates various mesh types, such as uniform or exponential, and the convergence can be systematically controlled by increasing the number and/or polynomial order of the finite element basis functions. The Dirac equation is solved using a squared Hamiltonian approach to eliminate spurious states. To address the slow convergence of the κ=±1\kappa=\pm 1 states due to divergent derivatives at the origin, we incorporate known asymptotic forms into the solutions. We achieve a high level of accuracy (10810^{-8} Hartree) for total energies and eigenvalues of heavy atoms such as uranium in both Schrödinger and Dirac Kohn-Sham solutions. We provide detailed convergence studies and computational parameters required to attain commonly required accuracies. Finally, we compare our results with known analytic results as well as the results of other methods. In particular, we calculate benchmark results for atomic numbers (ZZ) from 1 to 92, verifying current benchmarks. We demonstrate significant speedup compared to the state-of-the-art shooting solver dftatom. An efficient, modular Fortran 2008 implementation, is provided under an open source, permissive license, including examples and tests, wherein particular emphasis is placed on the independence (no global variables), reusability, and generality of the individual routines.

Keywords atomic structure, electronic structure, Schrödinger equation, Dirac equation, Kohn-Sham equations, density functional theory, finite element method, Fortran 2008

1 Introduction

Over the past three decades, Density Functional Theory (DFT) [1] has established itself as a cornerstone of modern materials research, enabling the understanding, prediction, and control of a wide variety of materials properties from the first principles of quantum mechanics, with no empirical parameters. However, the solution of the required Kohn-Sham equations [2] is a formidable task, which has given rise to a number of different solution methods [3]. At the heart of the majority of methods in use today, whether for isolated systems such as molecules or extended systems such as solids and liquids, lies the solution of the Schrödinger and/or Dirac equations for the isolated atoms composing the larger molecular or condensed matter systems of interest. Particular challenges arise in the context of relativistic calculations, which require solving the Dirac equation, since spurious states can arise due to the unbounded nature of the Dirac Hamiltonian operator and inconsistencies in discretizations derived therefrom [4].

A number of approaches have been developed to avoid spurious states in the solution of the Dirac equation. Shooting methods, e.g., [5] and references therein, avoid such states by leveraging known asymptotic forms to target desired eigenfunctions based on selected energies and numbers of nodes. However, due to the need for many trial solutions to find each eigenfunction, efficient implementation while maintaining robustness is nontrivial. In addition, convergence parameters such as distance of grid points from the origin must be carefully tuned. Basis set methods, e.g., [6, 7, 8, 9] and references therein, offer an elegant alternative to shooting methods, solving for all states at once by diagonalization of the Schrödinger or Dirac Hamiltonian in the chosen basis. However, due to the unbounded spectrum of the Dirac Hamiltonian, spurious states have been a longstanding issue [4, 10]. Many approaches have been developed to avoid spurious states over the past few decades, with varying degrees of success. These include using different bases for the large and small components of the Dirac wavefunction [6, 11, 12, 7, 13, 14], modifying the Hamiltonian [15, 8, 9, 16, 17], and imposing various boundary constraints [18, 19, 12, 8]. In the finite-difference context, defining large and small components of the Dirac wavefunction on alternate grid points [20], replacing conventional central differences with asymmetric differences [20, 21], and adding a Wilson term to the Hamiltonian [17] have proven effective in eliminating spurious states. While in the finite element (FE) context, the use of different trial and test spaces in a stabilized Petrov-Galerkin formulation has proven effective in mitigating the large off-diagonal convection (first derivative) terms and absence of diffusion (second derivative) terms causing the instability [9, 16].

In the this work, we present the open-source code,featom111Source also publicly on Github: https://github.com/atomic-solvers/featom, for the solution of the Schrödinger, Dirac, and Kohn-Sham equations in a high-order finite element basis. The FE basis enables exponential convergence with respect to polynomial order while allowing full flexibility as to choice of radial mesh. To eliminate spurious states in the solution of the Dirac equation, we square the Dirac Hamiltonian operator [22, 15]. Since the square of the operator has the same eigenfunctions as the operator itself, and the square of its eigenvalues, determination of the desired eigenfunctions and eigenvalues is immediate. Most importantly, since the square of the operator is bounded from below, unlike the operator itself, it is amenable to direct solution by standard variational methods, such as FE, without modification. This affords simplicity, robustness, and well understood convergence. Moreover, squaring the operator rather than modifying it and/or boundary conditions upon it, ensures key properties are preserved exactly, such as convergence to the correct non-relativistic (Schrödinger) limit with increasing speed of light [15]. Squaring the operator also stabilizes the numerics naturally, without approximation, by creating second-derivative terms. To accelerate convergence with respect to polynomial order, we incorporate known asymptotic forms as r0r\to 0 into the solutions: rather than solving for large and small Dirac wavefunction components P(r)P(r) and Q(r)Q(r), we solve for P(r)rα\frac{P(r)}{r^{\alpha}} and Q(r)rα\frac{Q(r)}{r^{\alpha}}, with α\alpha based on the known asymptotic forms for PP and QQ as r0r\to 0. This eliminates derivative divergences and non-polynomial behavior in the vicinity of the origin and so enables rapidly convergent solutions in a polynomial basis for all quantum numbers κ\kappa, including κ=±1\kappa=\pm 1. By combining the above ideas, featom is able to provide robust, efficient, and accurate solutions for both Schrödinger and Dirac equations.

The package is MIT licensed and is written in Fortran, leveraging language features from the 2008 standard, with an emphasis on facilitating user extensions. Additionally, it is designed to work within the modern Fortran ecosystem and leverages the fpm build system. There are several benchmark calculations that serve as tests. The package supports different mesh-generating methods, including support for a uniform mesh, an exponential mesh, and other meshes defined by nodal distributions and derivatives. Multiple quadrature methods have been implemented, and their usage in the code is physically motivated. Gauss–Jacobi quadrature is used to accurately integrate problematic integrals for the Dirac equation and the Poisson equation as well as for the total energy in the Dirac-Kohn-Sham solution, whereas Gauss–Legendre quadrature is used for the Schrödinger equation. To ensure numerical accuracy, we employ several techniques, using Gauss–Lobatto quadrature for the overlap matrix to recover a standard eigenproblem, precalculation of most quantities, and parsimonious assembly of a lower-triangular matrix with a symmetric eigensolver. With these considerations we show that the resulting code outperforms the state-of-the-art code dftatom, using fewer parameters for convergence while retaining high accuracy of 10810^{-8} Hartree in total energy and eigenvalues for uranium (both Dirac and Schrödinger) and all lighter atoms.

The remainder of the paper is organized as follows. Section 2 describes the electronic structure equations solved. This is followed by Sections 3.1 and 3.2, which detail the unified finite element solution for the radial Schrödinger and Dirac equations. Section 4.4 details the numerical techniques employed to efficiently construct and solve the resulting matrix eigenvalue problem, including mesh and quadrature methods. In Section 4, we present results from analytic tests and benchmark comparisons against the shooting solver dftatom, followed by a brief discussion of findings. Finally, in Section 5, we summarize our main conclusions.

2 Electronic structure equations

Under the assumption of a central potential, we establish the conventions used for the electronic structure problems under the purview of featom in this section. Starting from the nonrelativistic radial Schrödinger equation and its relativistic counterpart, the Dirac equation, we couple these to the Kohn–Sham equations with a Poisson equation for the Hartree potential. The interested reader may find more details of this formulation in [5]. By convention, we use Hartree atomic units throughout the manuscript.

2.1 Radial Schrödinger equation

Recall that the 3D one-electron Schrödinger equation is given by

(122+V(𝐱))ψ(𝐱)=Eψ(𝐱).\left(-{\textstyle\frac{1}{2}}\nabla^{2}+V({\bf x})\right)\psi({\bf x})=E\psi({\bf x}). (1)

When the potential considered is spherically symmetric, i.e.,

V(𝐱):=V(r),V({\bf x}):=V(r), (2)

the eigenstates of energy and angular momentum can be written in the form

ψnlm(𝐱)=Rnl(r)Ylm(𝐱r),\psi_{nlm}({\bf x})=R_{nl}(r)\,Y_{lm}\left(\frac{{\bf x}}{r}\right), (3)

where nn is the principal quantum number, ll is the orbital angular momentum quantum number, and mm is the magnetic quantum number. It follows that Rnl(r)R_{nl}(r) satisfies the radial Schrödinger equation

12(r2Rnl(r))+(r2V+12l(l+1))Rnl(r)=Er2Rnl(r).-{\textstyle\frac{1}{2}}\left(r^{2}R_{nl}^{\prime}(r)\right)^{\prime}+\left(r^{2}V+{\textstyle\frac{1}{2}}l(l+1)\right)R_{nl}(r)=Er^{2}R_{nl}(r). (4)

The functions ψnlm(𝐱)\psi_{nlm}({\bf x}) and Rnl(r)R_{nl}(r) are normalized as

|ψnlm(𝐱)|2d3x\displaystyle\int|\psi_{nlm}({\bf x})|^{2}\differential[3]{x} =1,\displaystyle=1,
0Rnl2(r)r2dr\displaystyle\int_{0}^{\infty}R_{nl}^{2}(r)r^{2}\differential r =1.\displaystyle=1. (5)

2.2 Radial Dirac equation

The one-electron radial Dirac equation can be written as

Pnκ(r)\displaystyle P_{n\kappa}^{\prime}(r) =κrPnκ(r)+(EV(r)c+2c)Qnκ(r),\displaystyle=-{\frac{\kappa}{r}}P_{n\kappa}(r)+\left({\frac{E-V(r)}{c}}+2c\right)Q_{n\kappa}(r), (6a)
Qnκ(r)\displaystyle Q_{n\kappa}^{\prime}(r) =(EV(r)c)Pnκ(r)+κrQnκ(r),\displaystyle=-\left({E-\frac{V(r)}{c}}\right)P_{n\kappa}(r)+{\frac{\kappa}{r}}Q_{n\kappa}(r), (6b)

where Pnκ(r)P_{n\kappa}(r) and Qnκ(r)Q_{n\kappa}(r) are related to the usual large gnκ(r)g_{n\kappa}(r) and small fnκ(r)f_{n\kappa}(r) components of the Dirac equation by

Pnκ(r)\displaystyle P_{n\kappa}(r) =rgnκ(r),\displaystyle=rg_{n\kappa}(r), (7a)
Qnκ(r)\displaystyle Q_{n\kappa}(r) =rfnκ(r).\displaystyle=rf_{n\kappa}(r). (7b)

A pedagogical derivation of these results can be found in the literature, for example in [5, 23, 24]. We follow the solution labeling in [5], in which the relativistic quantum number κ\kappa is determined by the orbital angular momentum quantum number ll and spin quantum number s=±1s=\pm 1 on the basis of the total angular momentum quantum number j=l±12j=l\pm\frac{1}{2} using

κ={l1for j=l+12, i.e. s=+1,lfor j=l12, i.e. s=1.\kappa=\begin{cases}-l-1&\text{for $j=l+{\textstyle\frac{1}{2}}$, i.e. $s=+1$},\\ \quad l&\text{for $j=l-{\textstyle\frac{1}{2}}$, i.e. $s=-1$}.\end{cases} (8)

By not including the rest mass energy of an electron, the energies obtained from the radial Dirac equation can be compared to the non-relativistic energies obtained from the Schrödinger equation.

The normalization of Pnκ(r)P_{n\kappa}(r) and Qnκ(r)Q_{n\kappa}(r) is

0(Pnκ2(r)+Qnκ2(r))dr=1.\int_{0}^{\infty}(P_{n\kappa}^{2}(r)+Q_{n\kappa}^{2}(r))\differential r=1. (9)

We note that both PnκP_{n\kappa} and QnκQ_{n\kappa} are solutions of homogeneous equations and are thus only unique up to an arbitrary multiplicative constant.

2.3 Poisson equation

The 3D Poisson equation for the Hartree potential VHV_{H} due to electronic density nn is given by

2VH(𝐱)=4πn(𝐱).\nabla^{2}V_{H}({\bf x})=-4\pi n({\bf x}). (10)

For a spherical density n(𝐱)=n(r)n({\bf x})=n(r), this becomes

1r2(r2VH)=VH′′(r)+2rVH(r)=4πn(r),{1\over r^{2}}(r^{2}V_{H}^{\prime})^{\prime}=V_{H}^{\prime\prime}(r)+{2\over r}V_{H}^{\prime}(r)=-4\pi n(r), (11)

where n(r)n(r) is the radial particle (number) density, normalized such that

N=n(𝐱)d3x=04πn(r)r2dr,N=\int n({\bf x})\differential[3]{x}=\int_{0}^{\infty}4\pi n(r)r^{2}\differential r, (12)

where NN is the number of electrons.

2.3.1 Initial conditions

Substituting (11) into (12) and integrating, we obtain

limrr2VH(r)=N,\lim_{r\to\infty}r^{2}V_{H}^{\prime}(r)=-N, (13)

from which it follows that the asymptotic behavior of VH(r)V_{H}^{\prime}(r) is

VH(r)Nr2,r.V_{H}^{\prime}(r)\sim-\frac{N}{r^{2}},\qquad r\to\infty. (14)

Integrating (14) and requiring VH0V_{H}\to 0 as rr\to\infty then gives the corresponding asymptotic behavior for VH(r)V_{H}(r),

VH(r)Nr,r.V_{H}(r)\sim\frac{N}{r},\qquad r\to\infty. (15)

For small rr, the asymptotic behavior can be obtained by expanding n(r)n(r) about r=0r=0: n(r)=j=0cjrjn(r)=\sum_{j=0}^{\infty}{c_{j}r^{j}}. Substituting into Poisson equation (11) gives

(r2VH)=4πj=0cjrj+2.(r^{2}V_{H}^{\prime})^{\prime}=-4\pi\sum_{j=0}^{\infty}{c_{j}r^{j+2}}. (16)

Integrating and requiring VH(0)V_{H}(0) to be finite then gives

VH(r)=4πj=0cjrj+1j+3,V_{H}^{\prime}(r)=-4\pi\sum_{j=0}^{\infty}{c_{j}\frac{r^{j+1}}{j+3}}, (17)

with linear leading term, so that we have

VH(r)r,r0.V_{H}^{\prime}(r)\sim r,\qquad r\to 0. (18)

Integrating (17) then gives

VH(r)=4πj=0cjrj+2(j+2)(j+3)+C,V_{H}(r)=-4\pi\sum_{j=0}^{\infty}{c_{j}\frac{r^{j+2}}{(j+2)(j+3)}}+C, (19)

with leading constant term C=VH(0)C=V_{H}(0) determined by Coulomb’s law:

VH(0)=4π0rn(r)dr.V_{H}(0)=4\pi\int_{0}^{\infty}{rn(r)\differential r}. (20)

Finally, from (18) we have that

VH(0)=0.V_{H}^{\prime}(0)=0. (21)

So VH0V_{H}\to 0 as rr\to\infty and VH(0)=0V_{H}^{\prime}(0)=0. This asymptotic behavior provides the initial values and derivatives for numerical integration in both inward and outward directions.

2.4 Kohn-Sham equations

The Kohn–Sham equations consist of the radial Schrödinger or Dirac equations with an effective potential V(r)=Vin(r)V(r)=V_{\mathrm{in}}(r) given by (see, e.g., [3])

Vin=VH+Vxc+v,V_{\mathrm{in}}=V_{H}+V_{xc}+v, (22)

where VHV_{H} is the Hartree potential given by the solution of the radial Poisson equation (11), VxcV_{xc} is the exchange-correlation potential, and v=Zrv=-\frac{Z}{r} is the nuclear potential.

The total energy is given by

E[n]=Ts[n]+EH[n]+Exc[n]+V[n],E[n]=T_{s}[n]+E_{H}[n]+E_{xc}[n]+V[n], (23)

the sum of kinetic energy

Ts[n]=nlfnlεnl4πVin(r)n(r)r2dr,T_{s}[n]=\sum_{nl}f_{nl}\varepsilon_{nl}-4\pi\int V_{\mathrm{in}}(r)n(r)r^{2}\differential r, (24)

where εnl\varepsilon_{nl} are the Kohn-Sham eigenvalues, Hartree energy

EH[n]=2πVH(r)n(r)r2dr,E_{H}[n]=2\pi\int V_{H}(r)n(r)r^{2}\differential r, (25)

exchange-correlation energy

Exc[n]=4πεxc(r;n)n(r)r2dr,E_{xc}[n]=4\pi\int\varepsilon_{xc}(r;n)n(r)r^{2}\differential r, (26)

where εxc(r;n)\varepsilon_{xc}(r;n) is the exchange and correlation energy density, and Coulomb energy

V[n]=4πv(r)n(r)r2dr=4πZn(r)rdrV[n]=4\pi\int v(r)n(r)r^{2}\differential r=-4\pi Z\int n(r)r\differential r (27)

with electronic density in the nonrelativistic case given by

n(r)=14πnlfnlPnl2(r)r2,n(r)={1\over 4\pi}\sum_{nl}f_{nl}{P_{nl}^{2}(r)\over r^{2}}, (28)

where PnlP_{nl} is the radial wavefunction in (40) and fnlf_{nl} the associated electronic occupation. In the relativistic case, the electronic density is given by

n(r)=14πnlsfnlsPnls2(r)+Qnls2(r)r2,n(r)={1\over 4\pi}\sum_{nls}f_{nls}{P_{nls}^{2}(r)+Q_{nls}^{2}(r)\over r^{2}}, (29)

where PnlsP_{nls} and QnlsQ_{nls} are the two components of the Dirac solution ((6a), (6b)) and fnlsf_{nls} is the occupation. In both the above cases, n(r)n(r) is the electronic particle density [electrons/volume], everywhere positive, as distinct from the electronic charge density ρ(r)\rho(r) [charge/volume]: ρ(r)=n(r)\rho(r)=-n(r) in atomic units.

We adopt a self-consistent approach [3] to solve for the electronic structure. Starting from an initial density ninn_{\mathrm{in}} and corresponding potential VinV_{\mathrm{in}}, we solve the Schrödinger or Dirac equation to determine the wavefunctions RnlR_{nl} or spinor components PP and QQ, respectively. From these, we construct a new density noutn_{\mathrm{out}} and potential VoutV_{\mathrm{out}}. Subsequently, we update the input density and potential, using for example a weighting parameter α[0,1]\alpha\in[0,1]:

ninαnin+(1α)nout,\displaystyle n_{\mathrm{in}}\rightarrow\alpha n_{\mathrm{in}}+(1-\alpha)n_{\mathrm{out}}, (30)
VinαVin+(1α)Vout.\displaystyle V_{\mathrm{in}}\rightarrow\alpha V_{\mathrm{in}}+(1-\alpha)V_{\mathrm{out}}. (31)

This process is repeated until the difference of VinV_{\mathrm{in}} and VoutV_{\mathrm{out}} and/or ninn_{\mathrm{in}} and noutn_{\mathrm{out}} is within a specified tolerance, at which point self-consistency is achieved. This fixed-point iteration is known as the self-consistent field (SCF) iteration. We employ an adaptive linear mixing scheme, with optimized weights for each component of the potential to construct new input potentials for successive SCF iterations. To accelerate the convergence of the SCF iterations, under relaxed fixed point iteration methods are used. In particular, the code supports both linear [25] and (default) Periodic Pulay mixing schemes [26], which suitably accelerate convergence. In order to reduce the number of SCF iterations, we use a Thomas–Fermi (TF) approximation [27] for the initial density and potential:

V(r)=Zeff(r)r,\displaystyle V(r)=-\frac{Z_{\text{eff}}(r)}{r}, (32a)
Zeff(r)=Z(1+αx+βxeγx)2e2αx,\displaystyle Z_{\text{eff}}(r)=Z\left(1+\alpha\sqrt{x}+\beta xe^{-\gamma\sqrt{x}}\right)^{2}e^{-2\alpha\sqrt{x}}, (32b)
x=r(128Z9π2)1/3,\displaystyle x=r\left(\frac{128Z}{9\pi^{2}}\right)^{1/3}, (32c)
α=0.7280642371,β=0.5430794693,γ=0.3612163121.\displaystyle\alpha=0.7280642371,\quad\beta=-0.5430794693,\quad\gamma=0.3612163121. (32d)

The corresponding charge density is then

ρ(r)=13π2(2V(r))32.\rho(r)=-{1\over 3\pi^{2}}\left(-2V(r)\right)^{3\over 2}. (33)

We demonstrate the methodology with the local density approximation (LDA) and relativistic local-density approximation (RLDA) exchange and correlation functionals. We note that the modular nature of the code and interface mechanism make it straightforward to incorporate functionals from other packages such as the library of exchange correlation functions, libxc [28, 29]. The parameters used in featom are taken from the same NIST benchmark data [30] as the current state-of-the-art dftatom program for an accurate comparison. For the local density approximation,

Vxc(r;n)=ddn(nεxcLD(n)),V_{xc}(r;n)={\differential\over\differential n}\left(n\varepsilon_{xc}^{LD}(n)\right), (34)

where the exchange and correlation energy density εxcLD\varepsilon_{xc}^{LD} can be written as [3]

εxcLD(n)=εxLD(n)+εcLD(n),\varepsilon_{xc}^{LD}(n)=\varepsilon_{x}^{LD}(n)+\varepsilon_{c}^{LD}(n), (35)

with electron gas exchange term [3]

εxLD(n)=34π(3π2n)13\varepsilon_{x}^{LD}(n)=-{3\over 4\pi}(3\pi^{2}n)^{1\over 3} (36)

and Vosko-Wilk-Nusair (VWN) [31] correlation term

εcLD(n)A2{log(y2Y(y))+2bQarctan(Q2y+b)by0Y(y0)[log((yy0)2Y(y))+2(b+2y0)Qarctan(Q2y+b)]},\varepsilon_{c}^{LD}(n)\sim{A\over 2}\left\{\log\left(y^{2}\over Y(y)\right)+{2b\over Q}\arctan\left(Q\over 2y+b\right)\right.\\ \left.-{by_{0}\over Y(y_{0})}\left[\log\left((y-y_{0})^{2}\over Y(y)\right)+{2(b+2y_{0})\over Q}\arctan\left(Q\over 2y+b\right)\right]\right\}, (37)

in which y=rsy=\sqrt{r_{s}}, Y(y)=y2+by+cY(y)=y^{2}+by+c, Q=4cb2Q=\sqrt{4c-b^{2}}, y0=0.10498y_{0}=-0.10498, b=3.72744b=3.72744, c=12.9352c=12.9352, A=0.0621814A=0.0621814, and

rs=(34πn)13r_{s}=\left(3\over 4\pi n\right)^{1\over 3} (38)

is the Wigner-Seitz radius, which gives the mean distance between electrons. In the relativistic (RLDA) case, a correction to the LDA exchange energy density and potential is given by MacDonald and Vosko [32]:

εxRLD(n)=εxLD(n)R,\displaystyle\varepsilon_{x}^{RLD}(n)=\varepsilon_{x}^{LD}(n)R, (39a)
R=132(βμlog(β+μ)β2)2,\displaystyle R=1-{3\over 2}\left(\beta\mu-\log(\beta+\mu)\over\beta^{2}\right)^{2},
VxRLD(n)=VxLD(n)S,\displaystyle V_{x}^{RLD}(n)=V_{x}^{LD}(n)S, (39b)
S=3log(β+μ)2βμ12,\displaystyle S={3\log(\beta+\mu)\over 2\beta\mu}-{\textstyle\frac{1}{2}},

where μ=1+β2\mu=\sqrt{1+\beta^{2}} and β=(3π2n)13c=4πεxLD(n)3c\beta={(3\pi^{2}n)^{1\over 3}\over c}=-{4\pi\varepsilon_{x}^{LD}(n)\over 3c}.

3 Solution methodology

Having described the Schrödinger, Dirac, and Kohn-Sham electronic structure equations to be solved, and key solution properties, we now detail our approach to solutions in a high-order finite-element basis.

3.1 Radial Schrödinger equation

To recast (4) in a manner that will facilitate our finite element solution methodology, we make the substitution Pnl(r)=rRnl(r)P_{nl}(r)=rR_{nl}(r) to obtain the canonical radial Schrödinger equation in terms of Pnl(r)P_{nl}(r) is

12Pnl′′(r)+(V(r)+l(l+1)2r2)Pnl(r)=EPnl(r).-\frac{1}{2}P_{nl}^{\prime\prime}(r)+\left(V(r)+\frac{l(l+1)}{2r^{2}}\right)P_{nl}(r)=EP_{nl}(r)\,. (40)

The corresponding normalization of P(r)P(r) is

0Pnl2(r)dr=1.\int_{0}^{\infty}P_{nl}^{2}(r)\differential r=1. (41)

3.1.1 Asymptotics

The known asymptotic behavior of PnlP_{nl} as r0r\to 0 is [33]

Pnl(r)rl+1,P_{nl}(r)\sim r^{l+1}, (42)

where PnlP_{nl}, being a solution of a homogeneous system of equations, is only unique up to an arbitrary multiplicative constant. We use (40) as our starting point but from now on drop the nlnl index from PnlP_{nl} for simplicity:

12P′′(r)+(V(r)+l(l+1)2r2)P(r)=EP(r).-\frac{1}{2}P^{\prime\prime}(r)+\left(V(r)+\frac{l(l+1)}{2r^{2}}\right)P(r)=EP(r). (43)

In order to facilitate rapid convergence and application of desired boundary conditions in a finite element basis, we generalize (40) to solve for P~=P(r)rα\tilde{P}=\frac{P(r)}{r^{\alpha}} for any chosen real exponent α0\alpha\geq 0 by substituting P=rαP~P=r^{\alpha}\tilde{P} to obtain

121r2α(r2αP~(r))+(V(r)+l(l+1)α(α1)2r2)P~(r)=EP~(r).-\frac{1}{2}{1\over r^{2\alpha}}\left(r^{2\alpha}\tilde{P}^{\prime}(r)\right)^{\prime}+\left(V(r)+\frac{l(l+1)-\alpha(\alpha-1)}{2r^{2}}\right)\tilde{P}(r)=E\tilde{P}(r). (44)

We note that:

  • For α=0\alpha=0 we get P~(r)=P(r)r0=P(r)\tilde{P}(r)=\frac{P(r)}{r^{0}}=P(r) and (44) reduces to (40).

  • For α=1\alpha=1 we get P~(r)=P(r)r1=R(r)\tilde{P}(r)=\frac{P(r)}{r^{1}}=R(r) and (44) reduces to (4).

  • Finally, for α=l+1\alpha=l+1, (which corresponds to the known asymptotic (42)) we obtain P~(r)=P(r)rl+1\tilde{P}(r)=\frac{P(r)}{r^{l+1}}, which tends to a nonzero value at the origin for all ll and (44) becomes

    121r2(l+1)(r2(l+1)P~(r))+V(r)P~(r)=EP~(r).-\frac{1}{2}{1\over r^{2(l+1)}}\left(r^{2(l+1)}\tilde{P}^{\prime}(r)\right)^{\prime}+V(r)\tilde{P}(r)=E\tilde{P}(r). (45)

3.1.2 Weak form

To obtain the weak form, we multiply both sides of (44) by a test function v(r)v(r) and integrate from 0 to \infty. In addition, to facilitate the construction of a symmetric bilinear form, we multipy by a factor r2αr^{2\alpha} to get

0[12(r2αP~(r))v(r)+(V(r)+l(l+1)α(α1)2r2)P~(r)v(r)r2α]dr\displaystyle\int_{0}^{\infty}\left[-\frac{1}{2}\left(r^{2\alpha}\tilde{P}^{\prime}(r)\right)^{\prime}v(r)+\left(V(r)+\frac{l(l+1)-\alpha(\alpha-1)}{2r^{2}}\right)\tilde{P}(r)v(r)r^{2\alpha}\right]\differential r (46)
=E0P~(r)v(r)r2αdr.\displaystyle=E\int_{0}^{\infty}\tilde{P}(r)v(r)r^{2\alpha}\differential r.

We can now integrate by parts to obtain

0[12r2αP~(r)v(r)+(V(r)+l(l+1)α(α1)2r2)P~(r)v(r)r2α]dr\displaystyle\int_{0}^{\infty}\left[\frac{1}{2}r^{2\alpha}\tilde{P}^{\prime}(r)v^{\prime}(r)+\left(V(r)+\frac{l(l+1)-\alpha(\alpha-1)}{2r^{2}}\right)\tilde{P}(r)v(r)r^{2\alpha}\right]\differential r (47)
12[r2αP~(r)v(r)]0=E0P~(r)v(r)r2αdr.\displaystyle-{\textstyle\frac{1}{2}}\left[r^{2\alpha}\tilde{P}^{\prime}(r)v(r)\right]_{0}^{\infty}=E\int_{0}^{\infty}\tilde{P}(r)v(r)r^{2\alpha}\differential r.

Setting the boundary term to zero,

[r2αP~(r)v(r)]0=0,\left[r^{2\alpha}\tilde{P}^{\prime}(r)v(r)\right]_{0}^{\infty}=0, (48)

we then obtain the desired symmetric weak formulation

0[12P~(r)v(r)+(V(r)+l(l+1)α(α1)2r2)P~(r)v(r)]r2αdr\displaystyle\int_{0}^{\infty}\left[{\textstyle\frac{1}{2}}\tilde{P}^{\prime}(r)v^{\prime}(r)+\left(V(r)+\frac{l(l+1)-\alpha(\alpha-1)}{2r^{2}}\right)\tilde{P}(r)v(r)\right]r^{2\alpha}\differential r (49)
=E0P~(r)v(r)r2αdr.\displaystyle=E\int_{0}^{\infty}\tilde{P}(r)v(r)r^{2\alpha}\differential r.

As discussed below, by virtue of our choice of α\alpha and boundary conditions on v(r)v(r), the vanishing of the boundary term (48) imposes no natural boundary conditions on P~\tilde{P}.

3.1.3 Discretization

To discretize (49), we introduce finite element basis functions ϕi(r)\phi_{i}(r) to form trial and test functions

P~(r)\displaystyle\tilde{P}(r) =j=1Ncjϕj(r)andv(r)=ϕi(r),\displaystyle=\sum_{j=1}^{N}c_{j}\phi_{j}(r)\qquad\mathrm{and}\qquad v(r)=\phi_{i}(r), (50)

and substitute into (49). In so doing, we obtain a generalized eigenvalue problem

j=1NHijcj=Ej=1NSijcj,\sum_{j=1}^{N}H_{ij}c_{j}=E\sum_{j=1}^{N}S_{ij}c_{j}, (51)

where HijH_{ij} is the Hamiltonian matrix,

Hij=0[12ϕi(r)ϕj(r)+ϕi(r)(V+l(l+1)α(α1)2r2)ϕj(r)]r2αdr,H_{ij}=\int_{0}^{\infty}\left[{\textstyle\frac{1}{2}}\phi_{i}^{\prime}(r)\phi_{j}^{\prime}(r)+\phi_{i}(r)\left(V+\frac{l(l+1)-\alpha(\alpha-1)}{2r^{2}}\right)\phi_{j}(r)\right]r^{2\alpha}\differential r, (52)

and SijS_{ij} is the overlap matrix,

Sij=0ϕi(r)ϕj(r)r2αdr.S_{ij}=\int_{0}^{\infty}\phi_{i}(r)\phi_{j}(r)r^{2\alpha}\differential r. (53)

3.1.4 Basis

While, by virtue of the weak formulation, the above discretization can employ any basis in Sobolev space H1H^{1} satisfying the required boundary conditions (including standard C0C^{0} FE bases, C1C^{1} Hermite, and CkC^{k} B-splines), we employ a high-order C0C^{0} spectral element (SE) basis [34,35] in the present work. FE bases consist of local piecewise polynomials. SE bases are a form of FE basis constructed to enable well-conditioned, high polynomial-order discretization via definition over Lobatto nodes rather than uniformly spaced nodes within each finite element (mesh interval). In the present work, we employ polynomial orders up to p=31p=31.

In the electronic structure context, SE bases have a number of desirable properties, including:

  1. 1.

    Polynomial completeness and associated systematic convergence with increasing number and/or polynomial order of basis functions.

  2. 2.

    Well conditioned to high polynomial order by virtue of definition over Lobatto nodes.

  3. 3.

    Exponential convergence with respect to polynomial order, enabling high accuracy with a small basis.

  4. 4.

    Applicable to general nonsingular as well as singular Coulombic potentials, whether fixed or self-consistent.

  5. 5.

    Applicable to bound as well as excited states.

  6. 6.

    Can use uniform as well as nonuniform meshes.

  7. 7.

    Basis function evaluation, differentiation, and integration are inexpensive, enabling fast and accurate matrix element computations.

  8. 8.

    Dirichlet boundary conditions are readily imposed by virtue of cardinality, i.e.,

    ϕi(xj)=δij\phi_{i}(x_{j})=\delta_{ij}

    where xjx_{j} is a nodal point of the basis.

  9. 9.

    Derivative boundary conditions are readily imposed via the weak formulation.

  10. 10.

    Diagonal overlap matrix using Lobatto quadrature, thus enabling solution of a standard rather than generalized eigenvalue problem, reducing both storage requirements and time to solution.

Properties (1)-(4), (7), and (10) are advantageous relative to Slater-type and Gaussian-type bases, which can be nontrivial to converge; can become ill-conditioned as the number of basis functions is increased, limiting accuracies attainable in practice; and produce a non-diagonal overlap matrix, requiring solution of a generalized rather than standard matrix eigenvalue problem.

Properties (2) and (10) are advantageous relative to B-spline bases, which are generally employed at lower polynomial orders in practice and give rise to a non-diagonal overlap matrix, thus requiring solution of a generalized rather than standard matrix eigenvalue problem.

3.1.5 Boundary conditions

Since we seek bound states, which vanish as rr\to\infty, we impose a homogeneous Dirichlet boundary condition on v(r)v(r) and P~(r)\tilde{P}(r) at r=r=\infty by employing a finite element basis {ϕi}\{\phi_{i}\} satisfying this condition.

For α=0\alpha=0, P~(r)=P(r)=0\tilde{P}(r)=P(r)=0 at r=0r=0 for all quantum numbers ll according to (42). Thus we impose a homogeneous Dirichlet boundary condition on v(r)v(r) and P~(r)\tilde{P}(r) at r=0r=0 by employing a finite element basis {ϕi}\{\phi_{i}\} satisfying this condition, whereupon the boundary term (48) as a whole vanishes, consistent with the weak formulation (49).

For α=1\alpha=1, P~(r)=P(r)r=R(r)=0\tilde{P}(r)=\frac{P(r)}{r}=R(r)=0 at r=0r=0 for all quantum numbers >0\ell>0 according to (42). However, P~(r)0\tilde{P}(r)\neq 0 at r=0r=0 for =0\ell=0. Thus a homogeneous Dirichlet boundary condition cannot be imposed for =0\ell=0. However, for α>0\alpha>0, the r2αr^{2\alpha} factor in (48) vanishes at r=0r=0, whereupon the boundary term as a whole vanishes, consistent with the weak formulation (49), regardless of boundary condition on v(r)v(r) and P~(r)\tilde{P}(r) at r=0r=0. Hence for α>0\alpha>0, we impose a homogeneous Dirichlet boundary condition on v(r)v(r) and P~(r)\tilde{P}(r) at r=r=\infty only, by employing a finite element basis {ϕi}\{\phi_{i}\} satisfying this condition. This is sufficient due to the singularity of the associated Sturm-Liouville problem.

Similarly, for α=+1\alpha=\ell+1, P~(r)=P(r)r+10\tilde{P}(r)=\frac{P(r)}{r^{\ell+1}}\neq 0 at r=0r=0 for all quantum numbers \ell according to (42) and, since α>0\alpha>0, we again impose a homogeneous Dirichlet boundary condition on v(r)v(r) and P~(r)\tilde{P}(r) at r=r=\infty only.

In practice, the featom code defaults to α=0\alpha=0 with homogeneous Dirichlet boundary conditions at r=0r=0 and r=r=\infty.

Note that, while α=0\alpha=0 yields a rapidly convergent formulation in the context of the Schrödinger equation, it does not suffice in the context of the Dirac equation, as discussed in Section 3.2.4.

3.2 Radial Dirac equation

For small rr, the central potential has the form V(r)=Z/r+Z1+O(r)V(r)=-Z/r+Z_{1}+O(r), which gives rise to the following asymptotic behavior at the origin for Z0Z\neq 0 (Coulombic) [34, 24]:

Pnκ(r)rβ,\displaystyle P_{n\kappa}(r)\sim r^{\beta}, (54a)
Qnκ(r)rβc(β+κ)Z,\displaystyle Q_{n\kappa}(r)\sim r^{\beta}{c(\beta+\kappa)\over Z}, (54b)
β=κ2(Zc)2.\displaystyle\beta=\sqrt{\kappa^{2}-\left(Z\over c\right)^{2}}. (54c)

For Z=0Z=0 (nonsingular) the asymptotic is, for κ<0\kappa<0 [34]

Pnκ(r)\displaystyle P_{n\kappa}(r) rl+1,\displaystyle\sim r^{l+1}, (55a)
Qnκ(r)\displaystyle Q_{n\kappa}(r) rl+2E+Z1c(2l+3),\displaystyle\sim r^{l+2}{E+Z_{1}\over c(2l+3)}, (55b)

and for κ>0\kappa>0

Pnκ(r)\displaystyle P_{n\kappa}(r) rl+2E+Z1c(2l+1),\displaystyle\sim-r^{l+2}{E+Z_{1}\over c(2l+1)}, (56a)
Qnκ(r)\displaystyle Q_{n\kappa}(r) rl+1.\displaystyle\sim r^{l+1}. (56b)

For large rr, assuming V(r)0V(r)\to 0 as rr\to\infty, the asymptotic is [33]

Pnκ(r)eλr,\displaystyle P_{n\kappa}(r)\sim e^{-\lambda r}, (57a)
Qnκ(r)EE+2c2Pnκ(r),\displaystyle Q_{n\kappa}(r)\sim-\sqrt{-{E\over E+2c^{2}}}P_{n\kappa}(r), (57b)
λ=c2(E+c2)2c2=2EE2c2.\displaystyle\lambda=\sqrt{c^{2}-{(E+c^{2})^{2}\over c^{2}}}=\sqrt{-2E-{E^{2}\over c^{2}}}. (57c)

Consistent with the coupled equations (6a) and (6b), the Dirac Hamiltonian can be written as (see, e.g., [7, (7)])

H=(V(r)c(ddr+κr)c(ddr+κr)V(r)2c2).H=\begin{pmatrix}V(r)&c\left(-{\derivative{r}}+{\kappa\over r}\right)\\ c\left({\derivative{r}}+{\kappa\over r}\right)&V(r)-2c^{2}\\ \end{pmatrix}. (58)

The corresponding eigenvalue problem is then

H(P(r)Q(r))=E(P(r)Q(r)).H\begin{pmatrix}P(r)\\ Q(r)\\ \end{pmatrix}=E\begin{pmatrix}P(r)\\ Q(r)\\ \end{pmatrix}. (59)

To discretize, we expand the solution vector in a basis:

(P(r)Q(r))=j=12Ncj(ϕja(r)ϕjb(r)),\begin{pmatrix}P(r)\\ Q(r)\end{pmatrix}=\sum_{j=1}^{2N}c_{j}\begin{pmatrix}\phi_{j}^{a}(r)\\ \phi_{j}^{b}(r)\end{pmatrix}, (60)

where aa and bb denote the upper and lower components of the vector. We have 2N2N basis functions (degrees of freedom), NN for each wave function component. As such, the function P(r)P(r) is expanded in terms of basis functions ϕia(r)\phi_{i}^{a}(r) and the function Q(r)Q(r) in terms of ϕib(r)\phi_{i}^{b}(r). However, these two expansions are not independent but are rather coupled via coefficients cic_{i}.

3.2.1 Squared Hamiltonian formulation

The above eigenvalue formulation of the radial Dirac equation can be solved using the finite element method. However, due to the fact that the operator is not bounded from below, one obtains spurious eigenvalues in the spectrum [10]. To eliminate spurious states, we work with the square of the Hamiltonian [22, 15], which is bounded from below, rather than the Hamiltonian itself. Since the eigenfunctions of the square of an operator are the same as those of the operator itself, and the eigenvalues are the squares, the approach is straightforward and enables direct and efficient solution by the finite element method.

Let us derive the equations for the squared radial Dirac Hamiltonian. First we shift the energy by c2c^{2} to obtain the relativistic energy, making the Hamiltonian more symmetric, using (58) to get

H+𝕀c2=(V(r)+c2c(ddr+κr)c(ddr+κr)V(r)c2).H+\mathbb{I}c^{2}=\begin{pmatrix}V(r)+c^{2}&c\left(-{\derivative{r}}+{\kappa\over r}\right)\\ c\left({\derivative{r}}+{\kappa\over r}\right)&V(r)-c^{2}\\ \end{pmatrix}. (61)

Then we square the Hamiltonian using (59) to obtain the following equations to solve for P(r)P(r) and Q(r)Q(r):

(H+𝕀c2)2(P(r)Q(r))=(E+c2)2(P(r)Q(r)),(H+\mathbb{I}c^{2})^{2}\begin{pmatrix}P(r)\\ Q(r)\\ \end{pmatrix}=(E+c^{2})^{2}\begin{pmatrix}P(r)\\ Q(r)\\ \end{pmatrix}, (62)

where 𝕀\mathbb{I} is the 2×22\times 2 identity matrix.

As can be seen, the eigenvectors P(r)P(r) and Q(r)Q(r) are the same as before but the eigenvalues are now equal to (E+c2)2(E+c^{2})^{2} and the original non-relativistic energies EE can be obtained by taking the square root of these new eigenvalues and subtracting c2c^{2}.

3.2.2 Weak form

We follow a similar approach as for the Schrödinger equation: instead of solving for P(r)P(r) and Q(r)Q(r), we solve for P~(r)=P(r)rα\tilde{P}(r)={P(r)\over r^{\alpha}} and Q~(r)=Q(r)rα\tilde{Q}(r)={Q(r)\over r^{\alpha}}, which introduces a parameter α\alpha that can be chosen to facilitate rapid convergence and the application of the desired boundary conditions in a finite element basis. We then multiply the eigenvectors by rαr^{\alpha} to obtain P(r)P(r) and Q(r)Q(r).

Now we can write the finite element formulation as

A\displaystyle A =0(ϕia(r)ϕib(r))rα(H+𝕀c2)2rα(ϕja(r)ϕjb(r))dr,\displaystyle=\int_{0}^{\infty}\!\!\begin{pmatrix}\phi_{i}^{a}(r)&\phi_{i}^{b}(r)\\ \end{pmatrix}r^{\alpha}(H+\mathbb{I}c^{2})^{2}r^{\alpha}\begin{pmatrix}\phi_{j}^{a}(r)\\ \phi_{j}^{b}(r)\end{pmatrix}\differential r, (63a)
S\displaystyle S =0(ϕia(r)ϕib(r))rαrα(ϕja(r)ϕjb(r))dr,\displaystyle=\int_{0}^{\infty}\begin{pmatrix}\phi_{i}^{a}(r)&\phi_{i}^{b}(r)\\ \end{pmatrix}r^{\alpha}r^{\alpha}\begin{pmatrix}\phi_{j}^{a}(r)\\ \phi_{j}^{b}(r)\end{pmatrix}\differential r, (63b)
Ax\displaystyle Ax =(E+c2)2Sx.\displaystyle=(E+c^{2})^{2}Sx. (63c)

This is a generalized eigenvalue problem, with eigenvectors xx (coefficients of (P~(r),Q~(r))(\tilde{P}(r),\tilde{Q}(r))), eigenvalues (E+c2)2(E+c^{2})^{2}, and 2×22\times 2 block matrices AA and SS. Note that the basis functions from both sides were multiplied by rαr^{\alpha} due to the substitutions P(r)=rαP~(r)P(r)=r^{\alpha}\tilde{P}(r) and Q(r)=rαQ~(r)Q(r)=r^{\alpha}\tilde{Q}(r). We can denote the middle factor in the integral for AA as H=rα(H+𝕀c2)2rαH^{\prime}=r^{\alpha}\left(H+\mathbb{I}c^{2}\right)^{2}r^{\alpha} and compute it using (61) with rearrangement of rαr^{\alpha} factors as follows:

H\displaystyle H^{\prime} =rα(H+𝕀c2)2rα\displaystyle=r^{\alpha}\left(H+\mathbb{I}c^{2}\right)^{2}r^{\alpha} (64a)
=r2α(V(r)+c2c(ddr+καr)c(ddr+κ+αr)V(r)c2)2.\displaystyle=r^{2\alpha}\begin{pmatrix}V(r)+c^{2}&c\left(-{\derivative{r}}+{\kappa-\alpha\over r}\right)\\ c\left({\derivative{r}}+{\kappa+\alpha\over r}\right)&V(r)-c^{2}\\ \end{pmatrix}^{2}. (64b)

Let

H=(H11H12H21H22).H^{\prime}=\begin{pmatrix}H^{11}&H^{12}\\ H^{21}&H^{22}\end{pmatrix}. (65)

Then

H11\displaystyle H^{11} =r2α(V(r)+c2)2+r2αc2(d2dr22αrddr+Φ),\displaystyle=r^{2\alpha}\left(V(r)+c^{2}\right)^{2}+r^{2\alpha}c^{2}\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}+\Phi\right), (66a)
H12\displaystyle H^{12} =r2αc(2(κα)rV(r)2V(r)ddrV(r)),\displaystyle=r^{2\alpha}c\left(2{\left(\kappa-\alpha\right)\over r}V(r)-2V(r){\derivative{r}}-V^{\prime}(r)\right), (66b)
H21\displaystyle H^{21} =r2αc(2(κ+α)rV(r)+2V(r)ddr+V(r)),\displaystyle=r^{2\alpha}c\left(2{\left(\kappa+\alpha\right)\over r}V(r)+2V(r){\derivative{r}}+V^{\prime}(r)\right), (66c)
H22\displaystyle H^{22} =r2α(V(r)c2)2+r2αc2(d2dr22αrddr+Φ),\displaystyle=r^{2\alpha}\left(V(r)-c^{2}\right)^{2}+r^{2\alpha}c^{2}\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}+\Phi\right), (66d)

where Φ=(κ(κ+1)α(α1))r2\displaystyle\Phi=\frac{\left(\kappa\left(\kappa+1\right)-\alpha\left(\alpha-1\right)\right)}{r^{2}}.

The full derivation of these expressions is given in A.1.

The usual approach when applying the finite element method to a system of equations is to choose the basis functions in the following form:

ϕia(r)\displaystyle\phi_{i}^{a}(r) ={πi(r)for i=1,,N,0for i=N+1,,2N.\displaystyle=\begin{cases}\pi_{i}(r)&\text{for $i=1,\dots,N$},\\ 0&\text{for $i=N+1,\dots,2N$}.\end{cases} (67a)
ϕib(r)\displaystyle\phi_{i}^{b}(r) ={0for i=1,,N,πiN(r)for i=N+1,,2N.\displaystyle=\begin{cases}0&\text{for $i=1,\dots,N$},\\ \pi_{i-N}(r)&\text{for $i=N+1,\dots,2N$}.\end{cases} (67b)

Substituting (67) into (63), we obtain the following expressions after simplification (A.2):

A\displaystyle A =(A11A12A21A22),\displaystyle=\begin{pmatrix}A^{11}&A^{12}\\ A^{21}&A^{22}\end{pmatrix}, (68a)
S\displaystyle S =(S1100S22),\displaystyle=\begin{pmatrix}S^{11}&0\\ 0&S^{22}\\ \end{pmatrix}, (68b)

with components given by

Aij11\displaystyle A^{11}_{ij} =0(c2πi(r)πj(r)+((V(r)+c2)2+c2Φ)πi(r)πj(r))r2αdr,\displaystyle=\int_{0}^{\infty}\left(c^{2}\pi_{i}^{\prime}(r)\pi_{j}^{\prime}(r)+\left(\left(V(r)+c^{2}\right)^{2}+c^{2}\Phi\right)\pi_{i}(r)\pi_{j}(r)\right)r^{2\alpha}\textrm{d}r, (69a)
Aij22\displaystyle A^{22}_{ij} =0(c2πi(r)πj(r)+((V(r)c2)2+c2Φ)πi(r)πj(r))r2αdr,\displaystyle=\int_{0}^{\infty}\left(c^{2}\pi_{i}^{\prime}(r)\pi_{j}^{\prime}(r)+\left(\left(V(r)-c^{2}\right)^{2}+c^{2}\Phi\right)\pi_{i}(r)\pi_{j}(r)\right)r^{2\alpha}\textrm{d}r, (69b)
Aij12\displaystyle A^{12}_{ij} =0cV(r)(+πi(r)πj(r)πi(r)πj(r)+2κrπi(r)πj(r))r2αdr,\displaystyle=\int_{0}^{\infty}cV(r)\left(+\pi_{i}^{\prime}(r)\pi_{j}(r)-\pi_{i}(r)\pi_{j}^{\prime}(r)+2{\kappa\over r}\pi_{i}(r)\pi_{j}(r)\right)r^{2\alpha}\textrm{d}r, (69c)
Aij21\displaystyle A^{21}_{ij} =0cV(r)(πi(r)πj(r)+πi(r)πj(r)+2κrπi(r)πj(r))r2αdr,\displaystyle=\int_{0}^{\infty}cV(r)\left(-\pi_{i}^{\prime}(r)\pi_{j}(r)+\pi_{i}(r)\pi_{j}^{\prime}(r)+2{\kappa\over r}\pi_{i}(r)\pi_{j}(r)\right)r^{2\alpha}\textrm{d}r, (69d)
Sij11\displaystyle S^{11}_{ij} =Sij22=0πi(r)πj(r)r2αdr,\displaystyle=S^{22}_{ij}=\int_{0}^{\infty}\pi_{i}(r)\pi_{j}(r)r^{2\alpha}\textrm{d}r, (69e)

where Φ=κ(κ+1)α(α1)r2\displaystyle\Phi=\frac{\kappa\left(\kappa+1\right)-\alpha\left(\alpha-1\right)}{r^{2}}.

These are the expressions implemented in the featom code.

3.2.3 Basis

Because we solve the squared Dirac Hamiltonian problem (62), whose spectrum has a lower bound, rather than the Dirac Hamiltonian problem (59), whose spectrum is unbounded above and below, we can employ a high-order C0C^{0} SE basis [35, 36], as in the Schrödinger case, as discussed in Section 3.1.5, with exponential convergence to high accuracy and no spurious states.

As discussed in Section 1, a number of approaches have been developed over the past few decades to solve (59) directly without spurious states, with varying degrees of success. Perhaps most common is to use different bases for large and small components, P(r)P(r) and Q(r)Q(r), of the Dirac wavefunction, e.g., [6, 11, 12, 7, 13, 14]. And among these approaches, perhaps most common is to impose some form of “kinetic balance,” e.g., [13, 4] and references therein, on the bases for PP and QQ. However, imposing such conditions significantly complicates the basis, increasing the cost of evaluations and matrix element integrals, and while highly effective in practice is not guaranteed to eliminate spurious states all cases [13]. In any case, for a C0C^{0} basis as employed in the present work, such balance cannot be imposed since it produces basis functions which are discontinuous and thus not in Sobolev space H1H^{1} as required (Section 3.1.5). Another approach which has proven successful in the context of B-spline bases is to use different orders of B-splines as bases for PP and QQ [7, 37, 38].

However, this too creates additional complexity [38], did not eliminate all spurious states in our implementation using pp and p+1p+1 degree SE bases for PP and QQ, respectively, nor eliminate all spurious states in previous work [39]. Thus we opt instead for the squared Hamiltonian approach in the present work in order to allow the robust and efficient use of a high-order C0C^{0} SE basis, with all desired properties enumerated in Section 3.1.5. In addition, the squared Hamiltonian approach allows direct solution for just the positive (electron) states, rather than having to solve for both positive and negative, e.g., [37], thus saving computation.

Finally, as discussed in Section 3.2.4, we note that by solving for P~=P/rα\tilde{P}=P/r^{\alpha} and Q~=Q/rα\tilde{Q}=Q/r^{\alpha}, with α\alpha set according to the known asymptotic as r0r\rightarrow 0, rather than for PP and QQ themselves, we obtain rapid convergence for singular Coulomb as well as nonsingular potentials using our C0C^{0} SE basis. On the other hand, singular Coulomb potentials have posed significant difficulty for B-spline bases [37]. However, since B-splines have polynomial completeness to specified degree, like SE bases, solving for P~\tilde{P} and Q~\tilde{Q} rather than PP and QQ directly should yield rapid convergence for such singular potentials using B-spline bases as well.

3.2.4 Boundary conditions

To construct a symmetric weak form, the following two boundary terms are set to zero in the derivation (A.2):

c2r2απi(r)πj(r)|0\displaystyle c^{2}r^{2\alpha}\pi_{i}(r)\pi_{j}^{\prime}(r)\Biggr{|}^{\infty}_{0} =0,\displaystyle=0\,, (70a)
cV(r)r2απi(r)πj(r)|0\displaystyle cV(r)r^{2\alpha}\pi_{i}(r)\pi_{j}(r)\Biggr{|}^{\infty}_{0} =0.\displaystyle=0\,. (70b)

As in the Schrödinger case, since we seek bound states which vanish as rr\to\infty, we impose a homogeneous Dirichlet boundary condition on the test function v(r)v(r) and solutions P~(r)\tilde{P}(r) and Q~(r)\tilde{Q}(r) at r=r=\infty by employing a finite element basis {πi}\{\pi_{i}\} satisfying this condition.

Unlike the Schrödinger case, however, the appropriate exponent α\alpha and boundary condition at r=0r=0 depends on the regularity of the potential V(r)V(r).

For nonsingular potentials V(r)V(r), P(r)r+1P(r)\sim r^{\ell+1} and Q(r)r+2Q(r)\sim r^{\ell+2} as r0r\to 0 for relativistic quantum numbers κ<0\kappa<0 while P(r)r+2P(r)\sim r^{\ell+2} and Q(r)r+1Q(r)\sim r^{\ell+1} for κ>0\kappa>0 according to (55) and (56). Hence, as in the Schrödinger case, for α=0\alpha=0, P~(r)=P(r)=0\tilde{P}(r)=P(r)=0 and Q~(r)=Q(r)=0\tilde{Q}(r)=Q(r)=0 at r=0r=0 for all quantum numbers κ\kappa and \ell. Thus we impose a homogeneous Dirichlet bounday condition on v(r)v(r), P~(r)\tilde{P}(r), and Q~(r)\tilde{Q}(r) at r=0r=0 by employing a finite element basis {πi}\{\pi_{i}\} satisfying this condition, whereupon the boundary terms (70) vanish, consistent with the weak formulation (63). This is the default in the featom code for such potentials.

For singular potentials V(r)V(r) with leading term Zr-\frac{Z}{r} (Coulombic), however, P(r)P(r) and Q(r)Q(r) have leading terms varying as rβr^{\beta} as r0r\to 0 for all relativistic quantum numbers κ\kappa according to (54). However, while β>1\beta>1 for |κ|>1|\kappa|>1, we have 0.74<β<0.999980.74<\beta<0.99998 for κ=±1\kappa=\pm 1 (for 1Z921\leq Z\leq 92), so that P(r)P(r) and Q(r)Q(r) have non-polynomial behavior at small rr and divergent derivatives at r=0r=0, leading to numerical difficulties for methods attempting to compute them directly. To address this issue, we leverage the generality of the formulation (63) to solve for P~(r)=P(r)/rα\tilde{P}(r)=P(r)/r^{\alpha} and Q~(r)=Q(r)/rα\tilde{Q}(r)=Q(r)/r^{\alpha} with α=β\alpha=\beta, rather than solving for P(r)P(r) and Q(r)Q(r) directly. With α=β\alpha=\beta, P~(r)\tilde{P}(r) and Q~(r)\tilde{Q}(r) have polynomial behavior at small rr and bounded nonzero values at r=0r=0 for all κ\kappa, including κ=±1\kappa=\pm 1, thus eliminating the aforementioned numerical difficulties completely and facilitating rapid convergence in a polynomial basis. Finally, for α=β\alpha=\beta, the r2αr^{2\alpha} factors in the boundary terms (70) vanish at r=0r=0, whereupon the boundary terms as a whole vanish, consistent with the weak formulation (63), regardless of boundary condition on v(r)v(r), P~(r)\tilde{P}(r), and Q~(r)\tilde{Q}(r) at r=0r=0. Hence, for α=β\alpha=\beta, we impose a homogeneous Dirichlet boundary condition at r=r=\infty only, by employing a finite element basis {πi}\{\pi_{i}\} satisfying this condition. This is the default in the featom code for such potentials.

For integrals involving non-integer α\alpha, we employ Gauss-Jacobi quadrature for accuracy and efficiency, while for integrals involving only integer exponents, we use Gauss-Legendre quadrature with the exception of overlap integrals where we employ Gauss-Lobatto quadrature to obtain a diagonal overlap matrix.

4 Results and discussion

To demonstrate the accuracy and performance of the featom implementation of the above described finite element formulation, we present results for fixed potentials as well as self-consistent DFT calculations, with comparisons to analytic results where available and to the state-of-the-art dftatom solver otherwise. Code outputs are collected in B.

4.1 Coulombic systems

The accuracy of the Schrödinger and Dirac solvers was verified using the Coulomb potential V=ZrV=-\frac{Z}{r} for Z=92Z=92 (uranium). Eigenvalues are given by the corresponding analytic formula [5]. All eigenvalues with n<7n<7 are used for the study. The reference eigenvalues here are from the analytic solutions: Enl=Z22n2E_{nl}=-\frac{Z^{2}}{2n^{2}} for the Schrödinger equation, and

Enκ\displaystyle E_{n\kappa} =c21+(Z/c)2(n|κ|+β)2c2,\displaystyle=\frac{c^{2}}{\sqrt{1+\frac{(Z/c)^{2}}{(n-|\kappa|+\beta)^{2}}}}-c^{2}, (71a)
β\displaystyle\beta =κ2(Z/c)2\displaystyle=\sqrt{\kappa^{2}-(Z/c)^{2}} (71b)

for the Dirac equation.

Refer to caption
(a) pp study for sum of eigenvalues
Refer to caption
(b) rmaxr_{\mathrm{max}} study for sum of eigenvalues
Refer to caption
(c) rmaxr_{\mathrm{max}} study for eigenvalues
Refer to caption
(d) NeN_{e} study for sum of eigenvalues
Figure 1: Convergence studies for the Schrödinger equation with a Coulomb potential with Z=92Z=92.

Figure 1a shows the convergence of the Schrödinger total energy error with respect to the polynomial order pp for different numbers of elements NeN_{e}. The graph, when observed for a given number of elements, forms a straight line on the log-linear scale, showing that the error decreases exponentially with the polynomial order pp until it reaches the numerical precision limit of approximately 10910^{-9}.

For five elements, we considered the behavior of the error with respect to rmaxr_{\mathrm{max}}. Figure 1b shows the total energy error. It is observed that rmax10r_{\mathrm{max}}\geq 10 results in an error of 10810^{-8} or less. The eigenvalues converge to 10910^{-9} for rmax10r_{\mathrm{max}}\geq 10, as depicted in Figure 1c.

The theoretical convergence rate for the finite element method is given by Ne2pN_{e}^{-2p}. Figure 1d shows the error with respect to NeN_{e}, juxtaposed with the theoretical convergence represented as a dotted line. The slope of the solid lines is used to determine the rate of convergence. In all instances, we observe that the theoretical convergence rate is achieved. For polynomial orders p8p\leq 8, it is attained asymptotically, while for p>8p>8, it approaches the limiting numerical precision of around 10910^{-9}.

Refer to caption
(a) pp study for sum of eigenvalues
Refer to caption
(b) rmaxr_{\mathrm{max}} study for sum of eigenvalues
Refer to caption
(c) rmaxr_{\mathrm{max}} study for eigenvalues
Refer to caption
(d) NeN_{e} study for sum of eigenvalues
Figure 2: Convergence studies for the Dirac equation with a Coulomb potential with Z=92Z=92.

Figure 2a shows the error in the Dirac total energy with respect to pp for various NeN_{e}. We find the same exponential relationship between the error and polynomial order pp.

As before, for five elements, we consider the error with respect to rmaxr_{\mathrm{max}}. Figure 2b shows the total Dirac energy error, and it is observed that rmax10r_{\mathrm{max}}\geq 10 results in an error of 10810^{-8} or less. The eigenvalues converge to 10810^{-8} for rmax10r_{\mathrm{max}}\geq 10, as depicted in Figure 2c.

Figure 2d shows the error as NeN_{e} is increased alongside the theoretical convergence represented as a dotted line. In all instances, we observe that the theoretical convergence rate is achieved. For polynomial orders p8p\leq 8, it is attained asymptotically, while for p>8p>8, it approaches the limiting numerical precision of around 10910^{-9}.

4.2 Quantum harmonic oscillator

Next, we consider a nonsingular potential: the harmonic oscillator potential given by V(r)=12ω2r2V(r)=\frac{1}{2}\omega^{2}r^{2}. For the Schrödinger equation, we take ω=1\omega=1 and compare against the exact values given by

Enl=ω(2nl12).\displaystyle E_{nl}=\omega(2n-l-\frac{1}{2}). (72)
Refer to caption
(a) pp study for sum of eigenvalues
Refer to caption
(b) rmaxr_{\mathrm{max}} study for sum of eigenvalues
Refer to caption
(c) rmaxr_{\mathrm{max}} study for eigenvalues
Refer to caption
(d) NeN_{e} study for sum of eigenvalues
Figure 3: Convergence studies for the Schrödinger equation with a harmonic oscillator potential.

Figure 3a shows the total Schrödinger energy error with respect to the polynomial order pp for various NeN_{e} values. For fixed NeN_{e}, the straight line on the log-linear graph shows the exponential dependency of the error on pp until hitting the numerical precision limit ( 101010^{-10}).

The effect of rmaxr_{\mathrm{max}} on the error was tested with five elements. Figure 3b indicates that rmax10r_{\mathrm{max}}\geq 10 gives a total energy error of 101010^{-10} or lower. Figure 3c shows that the eigenvalues converge to 101110^{-11} under the same condition.

The dependence of the error on NeN_{e}, together with the theoretical convergence rate (Ne2pN_{e}^{-2p}), is shown in Figure 3d. The slope of the solid lines confirms that the theoretical convergence rate is achieved. It is asymptotically achieved for p8p\leq 8, while for p>8p>8, it approaches the limiting numerical precision of approximately 10910^{-9}.

For the Dirac equation, comparisons are with respect to dftatom results.

Refer to caption
(a) pp study for sum of eigenvalues
Refer to caption
(b) rmaxr_{\mathrm{max}} study for sum of eigenvalues
Refer to caption
(c) rmaxr_{\mathrm{max}} study for eigenvalues
Refer to caption
(d) NeN_{e} study for sum of eigenvalues
Figure 4: Convergence studies for the Dirac equation with a harmonic oscillator potential.

Figure 4a shows an exponential error decrease with respect to pp for various NeN_{e}. A similar pattern is observed with rmax10r_{\mathrm{max}}\geq 10, reducing the total Dirac energy error to 10810^{-8} or less (Figure 4b). Eigenvalue convergence to 10810^{-8} is also seen (Figure 4c).

The theoretical convergence rate (Ne2pN_{e}^{-2p}) is confirmed in Figure 4d, attained asymptotically for p8p\leq 8 and reaching a numerical precision limit of  10910^{-9} for p>8p>8.

4.3 DFT calculations

The accuracy of the DFT solvers using both Schrödinger and Dirac equations is compared against dftatom results for the challenging case of uranium. The non-relativistic Schrödinger calculation yields the following electronic configuration:

1s22s22p63s23p63d104s24p64d104f145s25p65d105f36s26p66d17s2.1s^{2}2s^{2}2p^{6}3s^{2}3p^{6}3d^{10}4s^{2}4p^{6}4d^{10}4f^{14}5s^{2}5p^{6}5d^{10}5f^{3}6s^{2}6p^{6}6d^{1}7s^{2}.

With the Dirac solver, the ll-shell occupation splits according to the degeneracy of the j=l+12j=l+\frac{1}{2} and j=l12j=l-\frac{1}{2} subshells.

Figures 5a and 6a demonstrate an exponential decrease in total energy error with increasing pp for various NeN_{e}. As rmaxr_{\mathrm{max}} increases to 25\geq 25 for five elements, the error decreases to 10810^{-8} or less (Figures 5b and 6b). Convergence of eigenvalues to 10910^{-9} is seen at rmax30r_{\mathrm{max}}\geq 30 (Figures 5c and 6c).

In Figures 5d and 6d, the theoretical convergence rate (Ne2pN_{e}^{-2p}) manifests when Ne12N_{e}\geq 12, below which numerical instabilities prevent convergence.

Refer to caption
(a) pp study for total energy
Refer to caption
(b) rmaxr_{\mathrm{max}} study for total energy
Refer to caption
(c) rmaxr_{\mathrm{max}} study for eigenvalues
Refer to caption
(d) NeN_{e} study for total energy
Figure 5: Convergence studies for DFT with the Schrödinger equation for uranium.
Refer to caption
(a) pp study for total energy
Refer to caption
(b) rmaxr_{\mathrm{max}} study for total energy
Refer to caption
(c) rmaxr_{\mathrm{max}} study for eigenvalues
Refer to caption
(d) NeN_{e} study for total energy
Figure 6: Convergence studies for DFT with the Dirac equation for uranium.

4.4 Numerical considerations

The mesh parameters used to achieve 10810^{-8} a.u. accuracy for the DFT Schrödinger and Dirac calulations are shown in Table 1. The mesh parameters used for 10610^{-6} a.u. accuracy are shown in Table 2.

Table 1: Mesh parameters for achieving 10810^{-8} a.u. accuracy in DFT Schrödinger and Dirac calculations of uranium.
Parameter DFT Schrödinger Dirac
ZZ 92 92
rminr_{\text{min}} 0 0
rmaxr_{\text{max}} 50 30
aa 200 600
NeN_{e} 4 6
NqN_{q} 53 64
pp 26 25
r0r_{0} 0.005
Table 2: Mesh parameters for achieving 10610^{-6} a.u. accuracy in DFT Schrödinger and Dirac calculations of uranium.
Parameter DFT Schrödinger Dirac
ZZ 92 92
rminr_{\text{min}} 0 0
rmaxr_{\text{max}} 30 30
aa 200 100
NeN_{e} 4 5
NqN_{q} 35 40
pp 17 24
r0r_{0} 0.005

4.5 Benchmarks

The presented featom implementation is written in Fortran and runs on every platform with a modern Fortran compiler. To get an idea of the speed, we benchmarked against dftatom on a laptop with an Apple M1 Max processor using GFortran 11.3.0. We carry out the uranium DFT calculation to 10610^{-6} a.u. accuracy in total energy and all eigenvalues. The timings are as follows:

(Apple M1)  featom   dftatom
Schrdinger 28 ms     166 ms
Dirac       360 ms    276 ms

We also benchmarked the Coulombic system from section 4.1:

(Apple M1)  featom   dftatom
Dirac        49 ms     64 ms

5 Summary and conclusions

We have presented a robust and general finite element formulation for the solution of the radial Schrödinger, Dirac, and Kohn–Sham equations of density functional theory; and provided a modular, portable, and efficient Fortran implementation,featom222Available on Github: https://github.com/atomic-solvers/featom, along with interfaces to other languages and full suite of examples and tests. To eliminate spurious states in the solution of the Dirac equation, we work with the square of the Hamiltonian rather than the Hamiltonian itself. Additionally, to eliminate convergence difficulties associated with divergent derivatives and non-polynomial variation in the vicinity of the origin, we solve for P~=Prα\tilde{P}=\frac{P}{r^{\alpha}} and Q~=Qrα\tilde{Q}=\frac{Q}{r^{\alpha}} rather than for PP and QQ directly. We then employ a high-order finite element method to solve the resulting Schrödinger, Dirac, and Poisson equations which can accommodate any potential, whether singular Coulombic or finite, and any mesh, whether linear, exponential, or otherwise. We have demonstrated the flexibility and accuracy of the associated code with solutions of Schrödinger and Dirac equations for Coulombic and harmonic oscillator potentials; and solutions of Kohn–Sham and Dirac–Kohn–Sham equations for the challenging case of uranium, obtaining energies accurate to 10810^{-8} a.u., thus verifying current benchmarks [5, 40]. We have shown detailed convergence studies in each case, providing mesh parameters to facilitate straightforward convergence to any desired accuracy by simply increasing the polynomial order.

At all points in the design of the associated code, we have tried to emphasize simplicity and modularity so that the routines provided can be straightforwardly employed for a range of applications purposes, while retaining high efficiency. We have made the code available as open source to facilitate distribution, modification, and use as needed. We expect the present solvers will be of benefit to a broad range of large-scale electronic structure methods that rely on atomic structure calculations and/or radial integration more generally as key components.

6 Acknowledgements

We would like to thank Radek Kolman, Andreas Klöckner and Jed Brown for helpful discussions. This work performed, in part, under the auspices of the U.S. Department of Energy by Los Alamos National Laboratory under Contract DE-AC52-06NA2539 and U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. RG was partially supported by the Icelandic Research Fund, grant number 217436052217436052.

References

  • [1] Hohenberg P, Kohn W. Inhomogeneous Electron Gas. Physical Review. 1964 Nov;136(3B):B864-71.
  • [2] Kohn W, Sham LJ. Self-Consistent Equations Including Exchange and Correlation Effects. Physical Review. 1965 Nov;140(4A):A1133-8.
  • [3] Martin RM. Electronic Structure: Basic Theory and Practical Methods. Cambridge, UK ; New York: Cambridge University Press; 2004.
  • [4] Grant IP. Relativistic Quantum Theory of Atoms and Molecules: Theory and Computation. No. 40 in Springer Series on Atomic, Optical, and Plasma Physics. New York: Springer; 2007.
  • [5] Čertík O, Pask JE, Vackář J. Dftatom: A Robust and General Schrödinger and Dirac Solver for Atomic Structure Calculations. Computer Physics Communications. 2013 Jul;184(7):1777-91.
  • [6] Dyall KG, Fægri K. Kinetic Balance and Variational Bounds Failure in the Solution of the Dirac Equation in a Finite Gaussian Basis Set. Chemical Physics Letters. 1990 Nov;174(1):25-32.
  • [7] Fischer CF, Zatsarinny O. A B-spline Galerkin Method for the Dirac Equation. Computer Physics Communications. 2009 Jun;180(6):879.
  • [8] Grant IP. B-Spline Methods for Radial Dirac Equations. Journal of Physics B: Atomic, Molecular and Optical Physics. 2009 Feb;42(5):055002.
  • [9] Almanasreh H, Salomonson S, Svanstedt N. Stabilized Finite Element Method for the Radial Dirac Equation. Journal of Computational Physics. 2013 Mar;236:426-42.
  • [10] Tupitsyn II, Shabaev VM. Spurious States of the Dirac Equation in a Finite Basis Set. Optics and Spectroscopy. 2008 Aug;105(2):183-8.
  • [11] Shabaev VM, Tupitsyn II, Yerokhin VA, Plunien G, Soff G. Dual Kinetic Balance Approach to Basis-Set Expansions for the Dirac Equation. Physical Review Letters. 2004 Sep;93(13):130405.
  • [12] Beloy K, Derevianko A. Application of the Dual-Kinetic-Balance Sets in the Relativistic Many-Body Problem of Atomic Structure. Computer Physics Communications. 2008 Sep;179(5):310-9.
  • [13] Sun Q, Liu W, Kutzelnigg W. Comparison of Restricted, Unrestricted, Inverse, and Dual Kinetic Balances for Four-Component Relativistic Calculations. Theoretical Chemistry Accounts. 2011 Jun;129(3-5):423-36.
  • [14] Jiao LG, He YY, Liu A, Zhang YZ, Ho YK. Development of the Kinetically and Atomically Balanced Generalized Pseudospectral Method. Physical Review A. 2021 Aug;104(2):022801.
  • [15] Kutzelnigg W. Basis set expansion of the Dirac operator without variational collapse. International Journal of Quantum Chemistry. 1984;25(1):107-29.
  • [16] Almanasreh H. Finite Element Method for Solving the Dirac Eigenvalue Problem with Linear Basis Functions. Journal of Computational Physics. 2019 Jan;376:1199-211.
  • [17] Fang JY, Chen SW, Heng TH. Solution to the Dirac Equation Using the Finite Difference Method. Nuclear Science and Techniques. 2020 Jan;31(2):15.
  • [18] Johnson WR, Blundell SA, Sapirstein J. Finite Basis Sets for the Dirac Equation Constructed from B Splines. Physical Review A. 1988 Jan;37(2):307-15.
  • [19] Sapirstein J, Johnson WR. The Use of Basis Splines in Theoretical Atomic Physics. Journal of Physics B: Atomic, Molecular and Optical Physics. 1996 Nov;29(22):5213-25.
  • [20] Salomonson S, Öster P. Relativistic All-Order Pair Functions from a Discretized Single-Particle Dirac Hamiltonian. Physical Review A. 1989 Nov;40(10):5548-58.
  • [21] Zhang Y, Bao Y, Shen H, Hu J. Resolving the Spurious-State Problem in the Dirac Equation with the Finite-Difference Method. Physical Review C. 2022 Nov;106(5):L051303.
  • [22] Wallmeier H, Kutzelnigg W. Use of the Squared Dirac Operator in Variational Relativistic Calculations. Chemical Physics Letters. 1981 Mar;78(2):341-6.
  • [23] Strange P. Relativistic Quantum Mechanics: With Applications in Condensed Matter and Atomic Physics. Cambridge University Press; 1998.
  • [24] Zabloudil J, Hammerling R, Szunyogh L, Weinberger P. Electron Scattering in Solid Matter: A Theoretical and Computational Treatise. Springer Science & Business Media; 2006.
  • [25] Novák M, Vackář J, Cimrman R, Šipr O. Adaptive Anderson Mixing for Electronic Structure Calculations. Computer Physics Communications. 2023 Nov;292:108865.
  • [26] Banerjee AS, Suryanarayana P, Pask JE. Periodic Pulay Method for Robust and Efficient Convergence Acceleration of Self-Consistent Field Iterations. Chemical Physics Letters. 2016 Mar;647:31-5.
  • [27] Oulne M. Variation and Series Approach to the Thomas–Fermi Equation. Applied Mathematics and Computation. 2011 Sep;218(2):303-7.
  • [28] Marques MAL, Oliveira MJT, Burnus T. Libxc: A Library of Exchange and Correlation Functionals for Density Functional Theory. Computer Physics Communications. 2012 Oct;183(10):2272-81.
  • [29] Lehtola S, Steigemann C, Oliveira MJT, Marques MAL. Recent Developments in Libxc — A Comprehensive Library of Functionals for Density Functional Theory. SoftwareX. 2018 Jan;7:1-5.
  • [30] Cohen ER, Taylor BN. The 1986 Adjustment of the Fundamental Physical Constants. Reviews of Modern Physics. 1987 Oct;59(4):1121-48.
  • [31] Vosko SH, Wilk L, Nusair M. Accurate Spin-Dependent Electron Liquid Correlation Energies for Local Spin Density Calculations: A Critical Analysis. Canadian Journal of Physics. 1980 Aug;58(8):1200-11.
  • [32] MacDonald AH, Vosko SH. A Relativistic Density Functional Formalism. Journal of Physics C: Solid State Physics. 1979 Aug;12(15):2977-90.
  • [33] Johnson WR. Atomic Structure Theory: Lectures on Atomic Physics. Berlin ; London: Springer; 2007.
  • [34] Grant IP. The Dirac Operator on a Finite Domain and the R-matrix Method. Journal of Physics B: Atomic, Molecular and Optical Physics. 2008 Feb;41(5):055002.
  • [35] Patera AT. A Spectral Element Method for Fluid Dynamics: Laminar Flow in a Channel Expansion. Journal of Computational Physics. 1984 Jun;54(3):468-88.
  • [36] Hafeez MB, Krawczuk M. A Review: Applications of the Spectral Finite Element Method. Archives of Computational Methods in Engineering. 2023 Jun;30(5):3453-65.
  • [37] Zatsarinny O, Froese Fischer C. DBSR_HF: A B-spline Dirac–Hartree–Fock Program. Computer Physics Communications. 2016 May;202:287-303.
  • [38] Fischer CF. Towards B-Spline Atomic Structure Calculations. Atoms. 2021 Jul;9(3):50.
  • [39] Igarashi A. B-Spline Expansions in Radial Dirac Equation. Journal of the Physical Society of Japan. 2006 Nov;75(11):114301.
  • [40] Clark C. Atomic Reference Data for Electronic Structural Calculations, NIST Standard Reference Database 141. National Institute of Standards and Technology; 1997.

Appendix A Derivations for the squared radial Dirac finite element formulation

A.1 Components of the Squared Radial Dirac Hamiltonian

Starting from (64), we have HH^{\prime},

H=r2α(V(r)+c2c(ddr+(κα)r)c(ddr+(κ+α)r)V(r)c2)2.\displaystyle H^{\prime}=r^{2\alpha}\begin{pmatrix}V(r)+c^{2}&c\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)\\ c\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)&V(r)-c^{2}\\ \end{pmatrix}^{2}.

Let

r2αH=(G11G12G21G22),r^{-2\alpha}H^{\prime}=\begin{pmatrix}G^{11}&G^{12}\\ G^{21}&G^{22}\\ \end{pmatrix}, (73)

where

G11\displaystyle G^{11} =(V(r)+c2)2+c2(ddr+(κα)r)(ddr+(κ+α)r),\displaystyle=\left(V(r)+c^{2}\right)^{2}+c^{2}\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right), (74a)
G12\displaystyle G^{12} =(V(r)+c2)c(ddr+(κα)r)+c(ddr+(κα)r)(V(r)c2),\displaystyle=\left(V(r)+c^{2}\right)c\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)+c\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)\left(V(r)-c^{2}\right), (74b)
G21\displaystyle G^{21} =c(ddr+(κ+α)r)(V(r)+c2)+(V(r)c2)c(ddr+(κ+α)r),\displaystyle=c\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)\left(V(r)+c^{2}\right)+\left(V(r)-c^{2}\right)c\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right), (74c)
G22\displaystyle G^{22} =(V(r)c2)2+c2(ddr+(κ+α)r)(ddr+(κα)r)\displaystyle=\left(V(r)-c^{2}\right)^{2}+c^{2}\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)\left({-\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right) (74d)

We now simplify each term to obtain

G11f\displaystyle G^{11}f =(V(r)+c2)2f+c2(ddr+(κα)r)(ddr+(κ+α)r)f,\displaystyle=\left(V(r)+c^{2}\right)^{2}f+c^{2}\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)f, (75a)
G11f\displaystyle G^{11}f =(V(r)+c2)2f+c2(d2fdr2+(κα)rdfdr+(κ2α2)fr2ddr(κ+α)fr).\displaystyle=\left(V(r)+c^{2}\right)^{2}f+c^{2}\left(-{\derivative[2]{f}{r}}+{\left(\kappa-\alpha\right)\over r}{\derivative{f}{r}}+{\left(\kappa^{2}-\alpha^{2}\right)f\over r^{2}}-{\derivative{r}}{\left(\kappa+\alpha\right)f\over r}\right). (75b)

Recall that

ddr(κ+α)fr\displaystyle-{\derivative{r}}{\left(\kappa+\alpha\right)f\over r} =(κ+α)(1rdfdrfr2),\displaystyle=-\left(\kappa+\alpha\right)\left({1\over r}{\derivative{f}{r}}-{f\over r^{2}}\right), (76a)
ddr(κ+α)fr\displaystyle-{\derivative{r}}{\left(\kappa+\alpha\right)f\over r} =(κ+α)rdfdr+(κ+α)fr2.\displaystyle=-{\left(\kappa+\alpha\right)\over r}{\derivative{f}{r}}+{\left(\kappa+\alpha\right)f\over r^{2}}. (76b)

Substituting (76a) in (75a), with Φ=(κ(κ+1)α(α1))r2\displaystyle\Phi=\frac{(\kappa(\kappa+1)-\alpha(\alpha-1))}{r^{2}} we have

G11f\displaystyle G^{11}f =(V(r)+c2)2f+c2(d2fdr2+(κα)rdfdr+(κ2α2)fr2\displaystyle=\left(V(r)+c^{2}\right)^{2}f+c^{2}\left(-{\derivative[2]{f}{r}}+{\left(\kappa-\alpha\right)\over r}{\derivative{f}{r}}+\,{\left(\kappa^{2}-\alpha^{2}\right)f\over r^{2}}\right.
(κ+α)rdfdr+(κ+α)fr2)\displaystyle\qquad\qquad\qquad\qquad\qquad\quad\left.-{\left(\kappa+\alpha\right)\over r}{\derivative{f}{r}}+{\left(\kappa+\alpha\right)f\over r^{2}}\right) (77)
=(V(r)+c2)2f+c2(d2fdr22αrdfdr+Φf),\displaystyle=\left(V(r)+c^{2}\right)^{2}f+c^{2}\left(-{\derivative[2]{f}{r}}-{2\alpha\over r}{\derivative{f}{r}}+\Phi f\right), (78)

So we obtain

G11=(V(r)+c2)2+c2(d2dr22αrddr+Φ).G^{11}=\left(V(r)+c^{2}\right)^{2}+c^{2}\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}+\Phi\right). (79)

For G22G^{22}, we have

G22\displaystyle G^{22} =(V(r)c2)2+c2(ddr+(κ+α)r)(ddr+(κα)r)\displaystyle=\left(V(r)-c^{2}\right)^{2}+c^{2}\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)\left({-\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)
=(V(r)c2)2+c2(ddr+(κα)r)(ddr+(κ+α)r).\displaystyle=\left(V(r)-c^{2}\right)^{2}+c^{2}\left({-\derivative{r}}+{\left(-\kappa-\alpha\right)\over r}\right)\left({\derivative{r}}+{\left(-\kappa+\alpha\right)\over r}\right). (80)

Since

(ddr+(κα)r)(ddr+(κ+α)r)\displaystyle\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right) =(d2dr22αrddr\displaystyle=\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}\right.
+(κ(κ+1)α(α1))r2),\displaystyle\qquad\left.+\frac{(\kappa(\kappa+1)-\alpha(\alpha-1))}{r^{2}}\right), (81a)
(ddr+(κα)r)(ddr+(κ+α)r)\displaystyle\left(-{\derivative{r}}+{\left(-\kappa-\alpha\right)\over r}\right)\left({\derivative{r}}+{\left(-\kappa+\alpha\right)\over r}\right) =(d2dr22αrddr\displaystyle=\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}\right.
+(κ(κ+1)α(α1))r2),\displaystyle\qquad\left.+{\left(-\kappa\left(-\kappa+1\right)-\alpha\left(\alpha-1\right)\right)\over r^{2}}\right), (81b)
=(d2dr22αrddr\displaystyle=\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}\right.
+(κ(κ1)α(α1))r2).\displaystyle\qquad\left.+{\left(\kappa\left(\kappa-1\right)-\alpha\left(\alpha-1\right)\right)\over r^{2}}\right). (81c)

Therefore, after substituting (81) in (A.1)

G22=(V(r)c2)2+c2(d2dr22αrddr+(κ(κ1)α(α1))r2).G^{22}=\left(V(r)-c^{2}\right)^{2}+c^{2}\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}+{\left(\kappa\left(\kappa-1\right)-\alpha\left(\alpha-1\right)\right)\over r^{2}}\right). (82)

For G12G^{12}, we have

G12f\displaystyle G^{12}f =(V(r)+c2)c(ddr+(κα)r)f+c(ddr+(κα)r)(V(r)c2)f,\displaystyle=\left(V(r)+c^{2}\right)c\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)f+c\left(-{\derivative{r}}+{\left(\kappa-\alpha\right)\over r}\right)\left(V(r)-c^{2}\right)f, (83)
=c(κα)r(V(r)+c2+V(r)c2)f(V(r)+c2)cdfdrcd(V(r)c2)fdr,\displaystyle=c{\left(\kappa-\alpha\right)\over r}\left(V(r)+c^{2}+V(r)-c^{2}\right)f-\left(V(r)+c^{2}\right)c{\derivative{f}{r}}-c{\derivative{\left(V(r)-c^{2}\right)f}{r}},
=c(2(κα)rV(r)f(V(r)+c2)dfdr(V(r)c2)dfdrV(r)f),\displaystyle=c\left(2{\left(\kappa-\alpha\right)\over r}V(r)f-\left(V(r)+c^{2}\right){\derivative{f}{r}}-\left(V(r)-c^{2}\right){\derivative{f}{r}}-V^{\prime}(r)f\right),
=c(2(κα)rV(r)f2V(r)dfdrV(r)f),\displaystyle=c\left(2{\left(\kappa-\alpha\right)\over r}V(r)f-2V(r){\derivative{f}{r}}-V^{\prime}(r)f\right),

so

G12=c(2(κα)rV(r)2V(r)ddrV(r)).G^{12}=c\left(2{\left(\kappa-\alpha\right)\over r}V(r)-2V(r){\derivative{r}}-V^{\prime}(r)\right). (84)

Similarly

G21f\displaystyle G^{21}f =c(ddr+(κ+α)r)(V(r)+c2)f+(V(r)c2)c(ddr+(κ+α)r)f\displaystyle=c\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)\left(V(r)+c^{2}\right)f+\left(V(r)-c^{2}\right)c\left({\derivative{r}}+{\left(\kappa+\alpha\right)\over r}\right)f (85)
=c(κ+α)r(V(r)+c2+V(r)c2)f+(V(r)c2)cdfdr+cd(V(r)+c2)fdr\displaystyle=c{\left(\kappa+\alpha\right)\over r}\left(V(r)+c^{2}+V(r)-c^{2}\right)f+\left(V(r)-c^{2}\right)c{\derivative{f}{r}}+c{\derivative{\left(V(r)+c^{2}\right)f}{r}}
=c(2(κ+α)rV(r)f+(V(r)c2)dfdr+(V(r)+c2)dfdr+V(r)f)\displaystyle=c\left(2{\left(\kappa+\alpha\right)\over r}V(r)f+\left(V(r)-c^{2}\right){\derivative{f}{r}}+\left(V(r)+c^{2}\right){\derivative{f}{r}}+V^{\prime}(r)f\right)
=c(2(κ+α)rV(r)f+2V(r)dfdr+V(r)f)\displaystyle=c\left(2{\left(\kappa+\alpha\right)\over r}V(r)f+2V(r){\derivative{f}{r}}+V^{\prime}(r)f\right)

which leads to

G21=c(2(κ+α)rV(r)+2V(r)ddr+V(r)).G^{21}=c\left(2{\left(\kappa+\alpha\right)\over r}V(r)+2V(r){\derivative{r}}+V^{\prime}(r)\right). (86)

A.2 Weak formulation of the squared Hamiltonian for the radial Dirac

Starting from (63),

A=0(ϕia(r)ϕib(r))H(ϕja(r)ϕjb(r))dr,A=(A11A12A21A22)A=\int_{0}^{\infty}\!\!\begin{pmatrix}\phi_{i}^{a}(r)&\phi_{i}^{b}(r)\\ \end{pmatrix}H^{\prime}\begin{pmatrix}\phi_{j}^{a}(r)\\ \phi_{j}^{b}(r)\\ \end{pmatrix}\differential r,\qquad A=\begin{pmatrix}A^{11}&A^{12}\\ A^{21}&A^{22}\\ \end{pmatrix}

and also

ϕia(r)\displaystyle\phi_{i}^{a}(r) ={πi(r)for i=1,,N,0for i=N+1,,2N.\displaystyle=\begin{cases}\pi_{i}(r)&\text{for $i=1,\dots,N$},\\ 0&\text{for $i=N+1,\dots,2N$}.\end{cases}
ϕib(r)\displaystyle\phi_{i}^{b}(r) ={0for i=1,,N,πiN(r)for i=N+1,,2N.\displaystyle=\begin{cases}0&\text{for $i=1,\dots,N$},\\ \pi_{i-N}(r)&\text{for $i=N+1,\dots,2N$}.\end{cases}

With Φ=(κ(κ+1)α(α1))r2\displaystyle\Phi=\frac{(\kappa(\kappa+1)-\alpha(\alpha-1))}{r^{2}} we have

Aij11\displaystyle A^{11}_{ij} =0πi(r)(r2α(V(r)+c2)2+r2αc2(d2dr22αrddr+Φ))πj(r)dr,\displaystyle=\int_{0}^{\infty}\pi_{i}(r)\left(r^{2\alpha}(V(r)+c^{2})^{2}+r^{2\alpha}c^{2}\left(-\derivative[2]{r}-\frac{2\alpha}{r}\derivative{r}+\Phi\right)\right)\pi_{j}(r)\textrm{d}r, (87a)
Aij12\displaystyle A^{12}_{ij} =0πi(r)r2αc(2(κα)rV(r)2V(r)ddrV(r))πj(r)dr,\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2\frac{(\kappa-\alpha)}{r}V(r)-2V(r)\derivative{r}-V^{\prime}(r)\right)\pi_{j}(r)\textrm{d}r, (87b)
Aij21\displaystyle A_{ij}^{21} =0πi(r)r2αc(2(κ+α)rV(r)+2V(r)ddr+V(r))πj(r)dr,\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2\frac{(\kappa+\alpha)}{r}V(r)+2V(r)\derivative{r}+V^{\prime}(r)\right)\pi_{j}(r)\textrm{d}r, (87c)
Aij22\displaystyle A_{ij}^{22} =0πi(r)(r2α(V(r)c2)2+r2αc2(d2dr22αrddr+Φ))dr.\displaystyle=\int_{0}^{\infty}\pi_{i}(r)\left(r^{2\alpha}(V(r)-c^{2})^{2}+r^{2\alpha}c^{2}\left(-\derivative[2]{r}-\frac{2\alpha}{r}\derivative{r}+\Phi\right)\right)\textrm{d}r. (87d)

The second term in (87a) and (87d) can be simplified as

0πi(r)r2αc2(d2dr22αrddr)πj(r)dr\displaystyle\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c^{2}\left(-{\derivative[2]{r}}-{2\alpha\over r}{\derivative{r}}\right)\pi_{j}(r)\textrm{d}r (88a)
=0dπj(r)drc2(r2αdπi(r)dr+2αr2α1πi(r))dr\displaystyle=\int_{0}^{\infty}{\derivative{\pi_{j}(r)}{r}}c^{2}\left(r^{2\alpha}{\derivative{\pi_{i}(r)}{r}}+2\alpha r^{2\alpha-1}\pi_{i}(r)\right)\textrm{d}r
πi(r)(r2αc22αrddr)πj(r)πi(r)r2αc2dπj(r)dr|00\displaystyle\quad-\pi_{i}(r)\left(r^{2\alpha}c^{2}{2\alpha\over r}{\derivative{r}}\right)\pi_{j}(r)-\cancelto{0}{\pi_{i}(r)r^{2\alpha}c^{2}{\derivative{\pi_{j}(r)}{r}}\Biggr{|}^{\infty}_{0}} (88b)
=0dπj(r)drc2r2αdπi(r)drdr.\displaystyle=\int_{0}^{\infty}{\derivative{\pi_{j}(r)}{r}}c^{2}r^{2\alpha}{\derivative{\pi_{i}(r)}{r}}\textrm{d}r. (88c)

Therefore,

Aij11=0r2α(πi(r)((V(r)+c2)2+c2Φ)πj(r)+πj(r)c2πi(r))dr\displaystyle A^{11}_{ij}=\int_{0}^{\infty}r^{2\alpha}\left(\pi_{i}(r)\left(\left(V(r)+c^{2}\right)^{2}+c^{2}\Phi\right)\pi_{j}(r)+\pi_{j}^{\prime}(r)c^{2}\pi_{i}^{\prime}(r)\right)\textrm{d}r (89a)
Aij22=0r2α(πi(r)((V(r)c2)2+c2Φ)πj(r)+πj(r)c2πi(r))dr\displaystyle A^{22}_{ij}=\int_{0}^{\infty}r^{2\alpha}\left(\pi_{i}(r)\left(\left(V(r)-c^{2}\right)^{2}+c^{2}\Phi\right)\pi_{j}(r)+\pi_{j}^{\prime}(r)c^{2}\pi_{i}^{\prime}(r)\right)\textrm{d}r (89b)

which implies that A11A^{11} and A22A^{22} are symmetric.

The off diagonal terms can be simplified by rewriting the derivative of the potential VV^{\prime} using integration by parts

Aij12\displaystyle A^{12}_{ij} =0πi(r)r2αc(2(κα)rV(r)2V(r)ddrV(r))πj(r)dr\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2{\left(\kappa-\alpha\right)\over r}V(r)-2V(r){\derivative{r}}-V^{\prime}(r)\right)\pi_{j}(r)\textrm{d}r (90a)
=0πi(r)r2αc(2(κα)rV(r)2V(r)ddr)πj(r)dr\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2{\left(\kappa-\alpha\right)\over r}V(r)-2V(r){\derivative{r}}\right)\pi_{j}(r)\textrm{d}r
+0πi(r)r2αc(V(r))πj(r)dr\displaystyle\quad+\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(-V^{\prime}(r)\right)\pi_{j}(r)\textrm{d}r (90b)
=0πi(r)r2αc(2(κα)rV(r)2V(r)ddr)πj(r)dr\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2{\left(\kappa-\alpha\right)\over r}V(r)-2V(r){\derivative{r}}\right)\pi_{j}(r)\textrm{d}r
+0V(r)(πi(r)r2αcπj(r))dr+V(r)πi(r)r2αcπj(r)|00\displaystyle\quad+\int_{0}^{\infty}V(r)\left(\pi_{i}(r)r^{2\alpha}c\pi_{j}(r)\right)^{\prime}{\textrm{d}r}+\cancelto{0}{V(r)\pi_{i}(r)r^{2\alpha}c\pi_{j}(r)\Biggr{|}^{\infty}_{0}} (90c)
=0πi(r)r2αc(2(κα)rV(r)2V(r)ddr)πj(r)dr\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2{\left(\kappa-\alpha\right)\over r}V(r)-2V(r){\derivative{r}}\right)\pi_{j}(r)\textrm{d}r
+0cV(r)(πi(r)πj(r)+πi(r)πj(r)+2πiπjαr)r2αdr\displaystyle\quad+\int_{0}^{\infty}cV(r)\left(\pi_{i}^{\prime}(r)\pi_{j}(r)+\pi_{i}(r)\pi_{j}^{\prime}(r)+2\pi_{i}\pi_{j}{\alpha\over r}\right)r^{2\alpha}\textrm{d}r (90d)
=0r2αcV(r)(πi(r)πj(r)+2κrπi(r)πj(r)+πi(r)πj(r))dr.\displaystyle=\int_{0}^{\infty}r^{2\alpha}cV(r)\left(-\pi_{i}(r)\pi_{j}^{\prime}(r)+2{\kappa\over r}\pi_{i}(r)\pi_{j}(r)+\pi_{i}^{\prime}(r)\pi_{j}(r)\right)\textrm{d}r. (90e)

Similarly,

Aij21\displaystyle A^{21}_{ij} =0πi(r)r2αc(2(κ+α)rV(r)+2V(r)ddr+V(r))πj(r)dr\displaystyle=\int_{0}^{\infty}\pi_{i}(r)r^{2\alpha}c\left(2{\left(\kappa+\alpha\right)\over r}V(r)+2V(r){\derivative{r}}+V^{\prime}(r)\right)\pi_{j}(r)\textrm{d}r
=0r2αcV(r)(+πi(r)πj(r)+2κrπi(r)πj(r)πi(r)πj(r))dr\displaystyle=\int_{0}^{\infty}r^{2\alpha}cV(r)\left(+\pi_{i}(r)\pi_{j}^{\prime}(r)+2{\kappa\over r}\pi_{i}(r)\pi_{j}(r)-\pi_{i}^{\prime}(r)\pi_{j}(r)\right)\textrm{d}r (91)

By exchanging the ijij indices, we see that Aij12=Aji21A^{12}_{ij}=A^{21}_{ji}. Since A11A^{11} and A22A^{22} are symmetric and Aij12=Aji21A^{12}_{ij}=A^{21}_{ji}, the finite element matrix AA is symmetric. The last four equations for A11A^{11}, A22A^{22}, A12A^{12} and A21A^{21} are the equations that are implemented in the code.

Appendix B Converged runs for systems

The Coulomb potential results and the harmonic Schrödinger results are compared to the analytic results. The remaining systems are compared against dftatom [5].

B.1 Schrödinger equation with a Coulomb potential with Z=92Z=92

  Z  rmax   Ne       a  p Nq DOFs
 92  50.0    7   100.0 31 53  216   -10972.971428571371

 Comparison of calculated and reference energies

 Total energy:
                   E               E_ref     error
 -10972.971428571371 -10972.971428571391  2.00E-11
 Eigenvalues:
   n                   E               E_ref     error
   1  -4231.999999999996  -4232.000000000000  3.64E-12
   2  -1057.999999999942  -1058.000000000000  5.80E-11
   3  -1057.999999999930  -1058.000000000000  7.03E-11
   4   -470.222222222330   -470.222222222222  1.08E-10
   5   -470.222222222260   -470.222222222222  3.74E-11
   6   -470.222222222187   -470.222222222222  3.56E-11
   7   -264.500000000015   -264.500000000000  1.49E-11
   8   -264.499999999977   -264.500000000000  2.28E-11
   9   -264.499999999988   -264.500000000000  1.24E-11
  10   -264.499999999965   -264.500000000000  3.52E-11
  11   -169.280000000003   -169.280000000000  3.27E-12
  12   -169.279999999990   -169.280000000000  9.66E-12
  13   -169.279999999997   -169.280000000000  2.96E-12
  14   -169.280000000012   -169.280000000000  1.20E-11
  15   -169.279999999994   -169.280000000000  5.68E-12
  16   -117.555555555556   -117.555555555556  7.53E-13
  17   -117.555555555550   -117.555555555556  5.37E-12
  18   -117.555555555554   -117.555555555556  1.71E-12
  19   -117.555555555564   -117.555555555556  8.38E-12
  20   -117.555555555555   -117.555555555556  4.26E-13
  21   -117.555555555565   -117.555555555556  9.02E-12
  22    -86.367346938776    -86.367346938770  6.45E-12
  23    -86.367346938773    -86.367346938770  3.27E-12
  24    -86.367346938773    -86.367346938770  3.40E-12
  25    -86.367346938780    -86.367346938770  1.02E-11
  26    -86.367346938780    -86.367346938770  9.54E-12
  27    -86.367346938787    -86.367346938770  1.73E-11
  28    -86.367346938776    -86.367346938770  6.38E-12

B.2 Dirac equation with a Coulomb potential with Z=92Z=92

 Comparison of calculated and reference energies

 Total energy:
                   E               E_ref     error
 -16991.208873101066 -16991.208873101074  7.28E-12
 Eigenvalues:
   n                   E               E_ref     error
   1  -4861.198023119523  -4861.198023119372  1.51E-10
   2  -1257.395890257783  -1257.395890257889  1.06E-10
   3  -1089.611420919755  -1089.611420919875  1.20E-10
   4  -1257.395890257871  -1257.395890257889  1.82E-11
   5   -539.093341793807   -539.093341793890  8.37E-11
   6   -489.037087678178   -489.037087678200  2.18E-11
   7   -539.093341793909   -539.093341793890  1.82E-11
   8   -476.261595161184   -476.261595161155  2.91E-11
   9   -489.037087678164   -489.037087678200  3.64E-11
  10   -295.257844100346   -295.257844100397  5.09E-11
  11   -274.407758840011   -274.407758840065  5.46E-11
  12   -295.257844100397   -295.257844100397  0.00E+00
  13   -268.965877827151   -268.965877827130  2.18E-11
  14   -274.407758840043   -274.407758840065  2.18E-11
  15   -266.389447187838   -266.389447187816  2.18E-11
  16   -268.965877827159   -268.965877827130  2.91E-11
  17   -185.485191678526   -185.485191678552  2.55E-11
  18   -174.944613583455   -174.944613583462  7.28E-12
  19   -185.485191678534   -185.485191678552  1.82E-11
  20   -172.155252323719   -172.155252323737  1.82E-11
  21   -174.944613583462   -174.944613583462  0.00E+00
  22   -170.828937049882   -170.828937049879  3.64E-12
  23   -172.155252323751   -172.155252323737  1.46E-11
  24   -170.049934288658   -170.049934288552  1.06E-10
  25   -170.828937049879   -170.828937049879  0.00E+00
  26   -127.093638842631   -127.093638842631  0.00E+00
  27   -121.057538029541   -121.057538029549  7.28E-12
  28   -127.093638842609   -127.093638842631  2.18E-11
  29   -119.445271987144   -119.445271987141  3.64E-12
  30   -121.057538029545   -121.057538029549  3.64E-12
  31   -118.676410324362   -118.676410324351  1.09E-11
  32   -119.445271987144   -119.445271987141  3.64E-12
  33   -118.224144624910   -118.224144624903  7.28E-12
  34   -118.676410324355   -118.676410324351  3.64E-12
  35   -117.925825597409   -117.925825597293  1.16E-10
  36   -118.224144624906   -118.224144624903  3.64E-12
  37    -92.440787600957    -92.440787600943  1.46E-11
  38    -88.671749052020    -88.671749052017  3.64E-12
  39    -92.440787600932    -92.440787600943  1.09E-11
  40    -87.658287631897    -87.658287631893  3.64E-12
  41    -88.671749052013    -88.671749052017  3.64E-12
  42    -87.173966671959    -87.173966671948  1.09E-11
  43    -87.658287631897    -87.658287631893  3.64E-12
  44    -86.888766390952    -86.888766390941  1.09E-11
  45    -87.173966671948    -87.173966671948  0.00E+00
  46    -86.700519572882    -86.700519572809  7.28E-11
  47    -86.888766390948    -86.888766390941  7.28E-12
  48    -86.566875102300    -86.566875102359  5.82E-11
  49    -86.700519572820    -86.700519572809  1.09E-11

B.3 Schrödinger equation with a harmonic oscillator potential

  Z  rmax   Ne       a  p Nq DOFs
 92  50.0    7   100.0 31 64  216      209.999999999991

 Comparison of calculated and reference energies

 Total energy:
                   E               E_ref     error
    209.999999999991    210.000000000000  9.35E-12
 Eigenvalues:
   n                   E               E_ref     error
   1      1.500000000000      1.500000000000  3.41E-13
   2      3.499999999999      3.500000000000  1.43E-12
   3      2.500000000000      2.500000000000  3.60E-14
   4      5.499999999999      5.500000000000  1.27E-12
   5      4.500000000000      4.500000000000  1.22E-13
   6      3.500000000000      3.500000000000  3.87E-13
   7      7.499999999998      7.500000000000  1.59E-12
   8      6.500000000000      6.500000000000  6.84E-14
   9      5.500000000000      5.500000000000  9.41E-14
  10      4.500000000000      4.500000000000  3.95E-13
  11      9.499999999998      9.500000000000  1.71E-12
  12      8.500000000000      8.500000000000  4.33E-13
  13      7.500000000000      7.500000000000  1.64E-13
  14      6.500000000000      6.500000000000  2.39E-13
  15      5.500000000000      5.500000000000  1.23E-13
  16     11.499999999998     11.500000000000  1.68E-12
  17     10.499999999999     10.500000000000  6.34E-13
  18      9.500000000000      9.500000000000  2.36E-13
  19      8.500000000000      8.500000000000  8.70E-14
  20      7.500000000000      7.500000000000  1.68E-13
  21      6.500000000000      6.500000000000  5.24E-14
  22     13.499999999998     13.500000000000  1.64E-12
  23     12.500000000000     12.500000000000  3.57E-13
  24     11.500000000000     11.500000000000  1.30E-13
  25     10.500000000000     10.500000000000  2.38E-13
  26      9.500000000000      9.500000000000  1.07E-14
  27      8.500000000000      8.500000000000  1.90E-13
  28      7.500000000000      7.500000000000  2.22E-14

B.4 Dirac equation with a harmonic oscillator potential

  Z  rmax   Ne       a  p Nq DOFs
 92  50.0    7   100.0 23 53  320      367.470826694655

 Comparison of calculated and reference energies

 Total energy:
                   E               E_ref     error
    367.470826694655    367.470826700800  6.15E-09
 Eigenvalues:
   n              E          E_ref     error
   1     1.49999501     1.49999501  3.46E-11
   2     3.49989517     3.49989517  8.93E-12
   3     2.49997504     2.49997504  5.07E-11
   4     2.49993510     2.49993511  6.83E-10
   5     5.49971548     5.49971548  3.35E-11
   6     4.49983527     4.49983527  1.15E-12
   7     4.49979534     4.49979534  3.15E-09
   8     3.49994176     3.49994176  2.21E-11
   9     3.49987520     3.49987520  2.43E-11
  10     7.49945594     7.49945594  8.47E-11
  11     6.49961565     6.49961565  8.60E-12
  12     6.49957572     6.49957572  3.51E-10
  13     5.49976206     5.49976206  1.70E-11
  14     5.49969551     5.49969551  3.34E-12
  15     4.49989517     4.49989517  1.82E-11
  16     4.49980199     4.49980199  1.92E-11
  17     9.49911657     9.49911657  1.39E-10
  18     8.49931620     8.49931620  9.65E-11
  19     8.49927627     8.49927627  3.27E-10
  20     7.49950252     7.49950252  8.64E-11
  21     7.49943598     7.49943598  6.13E-11
  22     6.49967554     6.49967554  1.81E-11
  23     6.49958238     6.49958238  1.16E-10
  24     5.49983526     5.49983526  3.35E-11
  25     5.49971547     5.49971547  1.40E-11
  26    11.49869739    11.49869739  1.91E-10
  27    10.49893692    10.49893692  1.04E-10
  28    10.49889700    10.49889700  2.10E-10
  29     9.49916315     9.49916315  1.59E-10
  30     9.49909661     9.49909661  1.22E-10
  31     8.49937608     8.49937608  7.65E-11
  32     8.49928292     8.49928292  1.31E-10
  33     7.49957572     7.49957572  7.69E-11
  34     7.49945594     7.49945594  6.51E-11
  35     6.49976205     6.49976205  1.62E-12
  36     6.49961565     6.49961565  4.14E-11
  37    13.49819839    13.49819839  2.13E-10
  38    12.49847782    12.49847782  1.97E-10
  39    12.49843791    12.49843790  6.08E-10
  40    11.49874396    11.49874396  1.25E-10
  41    11.49867742    11.49867742  1.74E-10
  42    10.49899680    10.49899680  1.30E-10
  43    10.49890365    10.49890365  1.45E-10
  44     9.49923634     9.49923634  1.23E-10
  45     9.49911657     9.49911657  1.47E-10
  46     8.49946258     8.49946258  5.86E-11
  47     8.49931619     8.49931619  1.05E-10
  48     7.49967553     7.49967553  5.61E-11
  49     7.49950251     7.49950251  5.40E-11

B.5 DFT with the Schrödinger equation for uranium

 Total energy:
               E           E_ref     error
 -25658.41788885 -25658.41788885  3.17E-09

 Eigenvalues:
   n               E           E_ref     error
   1  -3689.35513984  -3689.35513984  7.72E-10
   2   -639.77872809   -639.77872809  3.69E-10
   3   -619.10855018   -619.10855018  3.77E-10
   4   -161.11807321   -161.11807321  1.40E-11
   5   -150.97898016   -150.97898016  3.23E-11
   6   -131.97735828   -131.97735828  1.87E-10
   7    -40.52808425    -40.52808425  4.94E-11
   8    -35.85332083    -35.85332083  6.29E-11
   9    -27.12321230    -27.12321230  8.18E-11
  10    -15.02746007    -15.02746007  1.07E-10
  11     -8.82408940     -8.82408940  5.36E-11
  12     -7.01809220     -7.01809220  5.26E-11
  13     -3.86617513     -3.86617513  5.65E-11
  14     -0.36654335     -0.36654335  1.05E-11
  15     -1.32597632     -1.32597632  4.04E-11
  16     -0.82253797     -0.82253797  2.32E-12
  17     -0.14319018     -0.14319018  1.42E-11
  18     -0.13094786     -0.13094786  5.33E-11

B.6 DFT with the Dirac equation for uranium

 Total energy:
               E           E_ref     error
 -28001.13232549 -28001.13232549  2.47E-09

 Eigenvalues:
   n               E           E_ref     error
   1  -4223.41902046  -4223.41902046  5.20E-09
   2   -789.48978233   -789.48978233  3.31E-10
   3   -761.37447597   -761.37447597  4.48E-10
   4   -622.84809456   -622.84809456  4.34E-10
   5   -199.42980564   -199.42980564  2.78E-10
   6   -186.66371312   -186.66371312  4.58E-10
   7   -154.70102667   -154.70102667  5.59E-10
   8   -134.54118029   -134.54118029  5.01E-10
   9   -128.01665738   -128.01665738  4.67E-10
  10    -50.78894806    -50.78894806  4.61E-10
  11    -45.03717129    -45.03717129  4.90E-10
  12    -36.68861049    -36.68861049  5.42E-10
  13    -27.52930624    -27.52930624  5.68E-10
  14    -25.98542891    -25.98542891  4.89E-10
  15    -13.88951423    -13.88951423  5.00E-10
  16    -13.48546969    -13.48546969  5.56E-10
  17    -11.29558710    -11.29558710  5.65E-10
  18     -9.05796425     -9.05796425  5.41E-10
  19     -7.06929563     -7.06929563  5.24E-10
  20     -3.79741623     -3.79741623  5.96E-10
  21     -3.50121718     -3.50121718  5.47E-10
  22     -0.14678838     -0.14678838  5.73E-10
  23     -0.11604716     -0.11604717  6.20E-10
  24     -1.74803995     -1.74803995  7.11E-10
  25     -1.10111900     -1.10111900  6.52E-10
  26     -0.77578418     -0.77578418  6.41E-10
  27     -0.10304081     -0.10304082  5.51E-10
  28     -0.08480202     -0.08480202  5.48E-10
  29     -0.16094728     -0.16094728  3.25E-10