Abstract
The quest for accurate exchangecorrelation functionals has long remained a grand challenge in density functional theory (DFT), as it describes the manyelectron quantum mechanical behavior through a computationally tractable quantity—the electron density—without resorting to multielectron wave functions. The inverse DFT problem of mapping the groundstate density to its exchangecorrelation potential is instrumental in aiding functional development in DFT. However, the lack of an accurate and systematically convergent approach has left the problem unresolved, heretofore. This work presents a numerically robust and accurate scheme to evaluate the exact exchangecorrelation potentials from correlated abinitio densities. We cast the inverse DFT problem as a constrained optimization problem and employ a finiteelement basis—a systematically convergent and complete basis—to discretize the problem. We demonstrate the accuracy and efficacy of our approach for both weakly and strongly correlated molecular systems, including up to 58 electrons, showing relevance to realistic polyatomic molecules.
Introduction
Density functional theory (DFT)^{1,2} is an essential method for describing electronic states in all manner of nanoscale phenomena, including chemical bonds in molecules, band structures of materials, electron transfer, and reactive metal clusters of proteins. In principle, an exact theory, DFT in practice^{3,4,5,6,7,8}, has remained far from exact due to the unavailability of exact exchangecorrelation (xc) potentials (\({v}_{{\rm{xc}}}\)), which are responsible for describing the quantum mechanical behavior of electrons. Fortunately, \({v}_{{\rm{xc}}}\) is a unique functional of the electron density (\(\rho ({\bf{r}})\)), so there exists a onetoone relationship from \({v}_{{\rm{xc}}}({\bf{r}})\) to \(\rho ({\bf{r}})\) and vice versa. This observation presents a possible route forward to construct accurate xc functionals via the transformation of the electron density into \({v}_{{\rm{xc}}}({\bf{r}})\) through the socalled inverse DFT problem^{9,10,11,12,13} (refer to the schematic in Fig. 1). The inverse problem not only provides a route for finding the sole unknown quantity in DFT, it is also central for describing quantum mechanics without resorting to complicated multielectron wave functions.
Given the large importance of this problem, there have been several attempts to solve the inverse DFT problem, employing either iterative updates^{10,11,14,15,16} or constrained optimization approaches^{9,12,17,18}. However, these approaches have suffered from illconditioning, thereby resulting in nonunique solutions or causing spurious oscillations in the resultant \({v}_{{\rm{xc}}}({\bf{r}})\). This illconditioning has been largely attributed to the incompleteness of the Gaussian basis sets that were employed to solve the inverse DFT problem^{18,19,20}. Recent efforts^{21,22,23} have presented a different approach, which utilizes the twoelectron reduced density matrix to remedy the nonuniqueness and the spurious oscillations in the obtained \({v}_{{\rm{xc}}}({\bf{r}})\). However, this does not represent the solution of the inverse DFT problem, i.e., the \({v}_{{\rm{xc}}}\) obtained from this approach is not guaranteed to yield the input electron density^{23}. Thus, the inverse DFT problem has, heretofore, remained an open challenge.
In this work, we present an advance that provides an accurate solution to the inverse DFT problem, enabling the evaluation of the exact \({v}_{{\rm{xc}}}\) from an abinitio density. Specifically, the approach uses a finiteelement (FE) basis that is systematically convergent and complete, thereby eliminating illconditioning in the discrete solution of the inverse DFT problem. Our approach is tested on a range of molecular systems, both weakly and strongly correlated, showing robustness and efficacy in treating realistic polyatomic molecules. The proposed approach therefore unlocks the door to constructing accurate xc functionals that provide precise energies and electronic properties of a huge range of chemical, materials, and biological systems. To elaborate, we envisage the inverse DFT problem to be instrumental in generating \(\{{\rho }^{(i)},{v}_{{\rm{xc}}}^{(i)}\}\) pairs, using \({\rho }^{(i)}\)’s from correlated abinitio calculations. Subsequently, these can be used as training data to model \({v}_{{\rm{xc}}}[\rho ]\) through machinelearning algorithms^{24,25}, which are designed to preserve the functional derivative requirement on \({v}_{{\rm{xc}}}[\rho ]\)^{26}. Furthermore, the xc energy (\({E}_{{\rm{xc}}}[\rho ]\)) can be directly evaluated through line integration on \({v}_{{\rm{xc}}}[\rho ]\).
Results
Constrained optimization for inverse DFT
We cast the inverse DFT problem of finding the \({v}_{{\rm{xc}}}({\bf{r}})\) that yields a given density \({\rho }_{{\rm{data}}}({\bf{r}})\) as the following partial differential equation (PDE)constrained optimization:
subject to
In the above equation, \(w({\bf{r}})\) is an appropriately chosen weight to expedite convergence, \({v}_{{\rm{ext}}}({\bf{r}})\) represents the nuclear potential, \({v}_{{\rm{H}}}({\bf{r}})\) is the Hartree potential corresponding to \({\rho }_{{\rm{data}}}({\bf{r}})\), and \({\psi }_{i}\) and \({\epsilon }_{i}\) denote the Kohn–Sham orbitals and eigenvalues, respectively. For simplicity, we restrict ourselves to only closedshell systems and, hence, the Kohn–Sham density \(\rho ({\bf{r}})=2{\sum }_{i=1}^{{N}_{e}/2} {\psi }_{i}({\bf{r}}){ }^{2}\). Equivalently, the above PDEconstrained optimization can be solved by minimizing the following Lagrangian,
with respect to all its constituent variables—\({p}_{i}\), \({\mu }_{i}\), \({\psi }_{i}\), \({\epsilon }_{i}\) and \({v}_{{\rm{xc}}}\). In the above equation, \(\hat{H}=\frac{1}{2}{\nabla }^{2}+{v}_{{\rm{ext}}}({\bf{r}})+{v}_{{\rm{H}}}({\bf{r}})+{v}_{{\rm{xc}}}({\bf{r}})\) is the Kohn–Sham Hamiltonian, \({p}_{i}\) is the adjoint function that enforces the Kohn–Sham eigenvalue equation corresponding to \({\psi }_{i}\), and \({\mu }_{i}\) is the Lagrange multiplier corresponding to the normality condition of \({\psi }_{i}\). The optimality of \({\mathcal{L}}\) with respect to \({p}_{i}\), \({\mu }_{i}\), \({\psi }_{i}\), and \({\epsilon }_{i}\) are given by:
where \({g}_{i}({\bf{r}})=8w({\bf{r}})({\rho }_{{\rm{data}}}({\bf{r}})\rho ({\bf{r}})){\psi }_{i}2{\mu }_{i}{\psi }_{i}\). We remark that the operator \(\hat{H}{\epsilon }_{i}\) in Eq. 7 is singular with \({\psi }_{i}\) as its null vector. However, the orthogonality of \({g}_{i}\) and \({\psi }_{i}\) (consequence of Eq. 7) along with the orthogonality of \({p}_{i}\) and \({\psi }_{i}\) (Eq. 8) guarantee a unique solution for \({p}_{i}\). Having solved the above optimality conditions in Eqs. 5–8, the variation (gradient) of \({\mathcal{L}}\) with respect to \({v}_{{\rm{xc}}}\) is given by
This constitutes the central equation for updating \({v}_{{\rm{xc}}}({\bf{r}})\) via any gradientbased optimization technique.
Summing up, the proposed approach involves: (i) obtaining \({\rho }_{{\rm{data}}}({\bf{r}})\) from correlated abinitio calculations (i.e., configuration interaction (CI) calculations); (ii) using an initial guess for \({v}_{{\rm{xc}}}({\bf{r}})\); (iii) solving Eqs. 5–8 using the current iterate of \({v}_{{\rm{xc}}}\); (iv) updating \({v}_{{\rm{xc}}}\) using Eq. 9 as the gradient; (v) repeating (iii)–(iv) until \(\rho ({\bf{r}})\) converges to \({\rho }_{{\rm{data}}}({\bf{r}})\). We note that the general idea of PDEconstrained optimization has been explored recently in ref. ^{13}. However, its utility had only been demonstrated on noninteracting model systems in one dimension.
Verification with LDAbased densities
To assess the accuracy and robustness of the proposed approach, we use \({\rho }_{{\rm{data}}}\) obtained from local density approximation (LDA)^{27,28}based DFT calculations, discretized using the FE basis—a systematically improvable and complete basis constructed from piecewise polynomials. This verification test allows us to compare the \({v}_{{\rm{xc}}}\) obtained from the inverse DFT calculation against \({v}_{{\rm{xc}}}^{{\rm{LDA}}}[{\rho }_{{\rm{data}}}]\). As remarked earlier, most of the previous attempts at this verification test have suffered from either nonunique solutions or had resulted in unphysical oscillations in \({v}_{{\rm{xc}}}\), owing to the incompleteness of the Gaussian basis employed in these works. Figure 2 presents the comparison of \({v}_{{\rm{xc}}}^{{\rm{LDA}}}[{\rho }_{{\rm{data}}}]\) against the \({v}_{{\rm{xc}}}\) obtained from the inverse calculation, for various atomic systems (also see Supplementary Fig. 2). We also provide, in Fig. 3, the \({v}_{{\rm{xc}}}\) for 1,3dimethylbenzene (\({{\rm{C}}}_{8}{{\rm{H}}}_{10}\)) obtained from the inverse calculation with LDAbased \({\rho }_{{\rm{data}}}\) (cf. Supplementary Fig. 3 for the error in \({v}_{{\rm{xc}}}\)), highlighting the efficacy of our approach in accurately treating large systems. We note that all the inverse DFT calculations have been performed in three dimensions and the \({L}^{2}\) norm error in the density, \(  {\rho }_{{\rm{data}}}\rho  { }_{{L}^{2}}\), is driven below \(1{0}^{5}\). As evident from these figures, the \({v}_{{\rm{xc}}}\) determined from the inverse DFT calculation is devoid of any spurious oscillations and is in excellent agreement with \({v}_{{\rm{xc}}}^{{\rm{LDA}}}[{\rho }_{{\rm{data}}}]\). In addition, the Kohn–Sham eigenvalues computed using the inverted \({v}_{{\rm{xc}}}\) are in excellent agreement (i.e., \( {\epsilon }_{i}^{{\rm{LDA}}}{\epsilon }_{i} < 1\) mHa), further validating the accuracy of the method. Although we have reported the verification of our method for LDAbased densities, similar accuracy was obtained using generalized gradient approximation (GGA)based densities. We refer to the Supplementary Discussion for a comparison of these verification results against similar studies conducted using existing methods.
Removing Gaussian basisset artifacts
We next turn to employing the proposed method with input densities generated from CI calculations. All the CI calculations reported in this work are performed using the incremental fullCI approach presented in ref. ^{29} and discretized using the universal Gaussian basis set (UGBS)^{30} or polarized triple zeta (ccPVTZ) Gaussian basis set^{31}. It is known that Gaussian basisset densities, owing to their lack of cusp at the nuclei as well as incorrect farfield decay, induce highly unphysical features in the \({v}_{{\rm{xc}}}\)s obtained from inverse calculations. To this end, we provide two numerical strategies, which, for all practical purposes, remedy the Gaussian basisset artifacts and thereby allow for accurate evaluation of the exact \({v}_{{\rm{xc}}}\)s from CI densities. It is to be noted that the following numerical strategies are only necessitated due to the unphysical asymptotics in the Gaussian basisset densities and not due to any inadequacy of the proposed inverse DFT algorithm.
To begin with, the CI density obtained from a Gaussian basis has wrong decay characteristics away from the nuclei (i.e., Gaussian decay instead of exponential decay). This, in turn, results in incorrect asymptotics in the \({v}_{{\rm{xc}}}\) obtained from an inverse DFT calculation. Thus, to ensure the correct asymptotics in \({v}_{{\rm{xc}}}\), we employ the following approach. First, we use an initial guess for \({v}_{{\rm{xc}}}\) that satisfies the correct \(1/r\) decay. In particular, we use the Fermi–Amaldi potential (\({v}_{{\rm{FA}}}\))^{32}. Next, we enforce homogeneous Dirichlet boundary condition on the adjoint function (\({p}_{i}\)) in the lowdensity region (i.e., \({\rho }_{{\rm{data}}}< 1{0}^{6}\)), while solving Eq. 7. In effect, this fixes the \({v}_{{\rm{xc}}}\) to its initial value in the lowdensity region, thereby ensuring correct farfield asymptotics in the \({v}_{{\rm{xc}}}\). This approach is also crucial to obtaining an agreement between the highest occupied Kohn–Sham eigenvalue (\({\epsilon }_{{\rm{H}}}\)) and the negative of the ionization potential (\({I}_{{\rm{p}}}\)), as mandated by the Koopmans’ theorem^{33,34}.
Furthermore, the Gaussian basissetbased CI densities lack the cusp at the nuclei, which, in turn, leads to undesirable oscillations in the \({v}_{{\rm{xc}}}\) near the nuclei in any inverse DFT calculation^{35,36,37}. We demonstrate this in the case of equilibrium \({{\rm{H}}}_{2}\) molecule (bondlength \({R}_{\text{HH}}=1.4\) a.u.), henceforth denoted as \({{\rm{H}}}_{2}(eq)\). Figure 4 shows the \({v}_{{\rm{xc}}}\) profile for \({{\rm{H}}}_{2}(eq)\) corresponding to the \({\rho }_{{\rm{data}}}({\bf{r}})\) obtained from a CI calculation, discretized using UGBS. As evident, we observe large unphysical oscillations in the \({v}_{{\rm{xc}}}\) near the nuclei. We remedy these oscillations by adding a small correction, \(\Delta \rho ({\bf{r}})\) to \({\rho }_{{\rm{data}}}({\bf{r}})\), so as to correct for the missing cusp at the nuclei. The \(\Delta \rho ({\bf{r}})\) is given by
where \({\rho }_{{\rm{FE}}}^{{\rm{DFT}}}({\bf{r}})\) is the groundstate density obtained from a forward DFT calculation using a known xc functional (e.g., LDA and GGA) and discretized using the FE basis, and \({\rho }_{{\rm{G}}}^{{\rm{DFT}}}({\bf{r}})\) denotes the same, albeit obtained using the Gaussian basis employed in the CI calculation. The key idea here is that \({\rho }_{{\rm{FE}}}^{{\rm{DFT}}}({\bf{r}})\), obtained from the FE basis, contains the cusp. Thus, one can expect \(\Delta \rho\) to reasonably capture the Gaussian basisset error near the nuclei. In addition, \(\int \Delta \rho ({\bf{r}})\ d{\bf{r}}=0\), preserving the number of electrons. A conceptually similar approach has been explored in ref. ^{37}, wherein one postprocesses the \({v}_{{\rm{xc}}}\) instead of preprocessing the \({\rho }_{{\rm{data}}}\), to remove the oscillations arising from the lack of cusp in \({\rho }_{{\rm{data}}}\). We illustrate the efficacy of the \(\Delta \rho\) correction with the \({{\rm{H}}}_{2}(eq)\) molecule as an example. Figure 5 presents the \({v}_{{\rm{xc}}}\) corresponding to the cuspcorrected density (i.e., \({\rho }_{{\rm{data}}}+\Delta \rho\)) for \({{\rm{H}}}_{2}(eq)\), with two different \(\Delta \rho\): \(\Delta {\rho }_{{\rm{LDA}}}\) evaluated using an LDA functional^{27,28} and \(\Delta {\rho }_{{\rm{GGA}}}\) evaluated using a GGA functional^{38}. As evident, both \(\Delta {\rho }_{{\rm{LDA}}}\) and \(\Delta {\rho }_{GGA}\)based cusp correction generate smooth \({v}_{{\rm{xc}}}\) profiles. More importantly, both the profiles are nearly identical, except for small differences in the bonding region between the H atoms. Further, a comparison of both these \({v}_{{\rm{xc}}}\)s against the LDAbased xc potential (\({v}_{{\rm{xc}}}^{{\rm{LDA}}}\)) elucidates the significant difference between the exact \({v}_{{\rm{xc}}}\) and \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\) even for a simple system that is not strongly correlated. Lastly, for both the \({v}_{{\rm{xc}}}\)s, we obtain the same \({\epsilon }_{{\rm{H}}}\) of \(0.601\) Ha, which, in turn, is in excellent agreement with the \({I}_{{\rm{p}}}\) (listed in Table 1). We remark that the agreement of \({\epsilon }_{{\rm{H}}}\) with \({I}_{{\rm{p}}}\) is a stringent test of the accuracy of the inversion and is particularly sensitive to the \({v}_{{\rm{xc}}}\) in the far field.
Exact \({v}_{{\rm{xc}}}\) from CI densities for molecules
We now combine the above numerical strategies to evaluate the exact \({v}_{{\rm{xc}}}\) for four other benchmark systems—two stretched \({{\rm{H}}}_{2}\) molecules and two polyatomic systems (water and orthobenzyne molecules). The CI calculations for all the molecules, excepting orthobenzyne, are performed using the UGBS. For orthobenzyne, we used the ccPVTZ basis. Given the weak sensitivity of the inverted \({v}_{{\rm{xc}}}\) to the choice of xc functional used in \(\Delta \rho\), we employ \(\Delta {\rho }_{{\rm{LDA}}}\) for performing the cusp correction in all our calculations. Further, for all the systems, the inverse problem is deemed to have converged when \(  {\rho }_{{\rm{data}}}\rho  { }_{{L}^{2}}< 1{0}^{4}\). We remark that the \({L}^{2}\) error norm is a natural convergence criterion, given the form of the objective function in Eq. 1. However, given that previous works on this inverse problem have reported the \({L}^{1}\) error, we provide the same in the Supplementary Table 2, for all the benchmark systems considered. Figure 6 compares the \({v}_{{\rm{xc}}}\) for two stretched \({{\rm{H}}}_{2}\) molecules—\({{\rm{H}}}_{2}(2eq)\) (\({R}_{\text{HH}}=2.83\) a.u., roughly twice the equilibrium bond length) and \({{\rm{H}}}_{2}(d)\) (\({R}_{\text{HH}}=7.56\) a.u., at dissociation). We emphasize that these are prototypical systems where all existing xc approximations perform poorly, owing to their failure in handling strong correlations. We could successfully solve the inverse DFT problem for these systems (\(  {\rho }_{{\rm{data}}}\rho  { }_{{L}^{2}} \sim 8\times 1{0}^{5}\)), thereby suggesting that our approach works equally well for strongly correlated systems. As indicated in Table 1, we get remarkable agreement between \({\epsilon }_{{\rm{H}}}\) and \({I}_{{\rm{p}}}\) for \({{\rm{H}}}_{2}(2eq)\). However, for \({{\rm{H}}}_{2}(d)\), we obtain \({\epsilon }_{{\rm{H}}}\) within 19 mHa of \({I}_{{\rm{p}}}\). We attribute this larger difference between \({\epsilon }_{{\rm{H}}}\) and \({I}_{{\rm{p}}}\) (as compared with \({{\rm{H}}}_{2}(eq)\) and \({{\rm{H}}}_{2}(2eq)\)) to the use of \({v}_{{\rm{FA}}}\) as the boundary condition for \({v}_{{\rm{xc}}}\) in the lowdensity region. To elaborate, for a singleorbital system, \({v}_{{\rm{FA}}}\) is the exact \({v}_{{\rm{x}}}\) (exchangeonly potential) and, hence, represents the exact \({v}_{{\rm{xc}}}\) in regions where the correlations are negligible. Although for the \({{\rm{H}}}_{2}(eq)\) and \({{\rm{H}}}_{2}(2eq)\) molecules the correlations are shortranged, they are relatively longerranged for \({{\rm{H}}}_{2}(d)\). We highlight this in Fig. 7 by comparing the \({v}_{{\rm{xc}}}\) against \({v}_{{\rm{x}}}\) for \({{\rm{H}}}_{2}(eq)\), \({{\rm{H}}}_{2}(2eq)\), and \({{\rm{H}}}_{2}(d)\). As evident, \({{\rm{H}}}_{2}(d)\) has strong correlations extending to a significantly larger domain (in the farfield) in comparison with \({{\rm{H}}}_{2}(eq)\) and \({{\rm{H}}}_{2}(2eq)\). Thus, for \({{\rm{H}}}_{2}(d)\), the use of \({v}_{{\rm{FA}}}\) is warranted only in regions of much lower density (i.e., \({\rho }_{{\rm{data}}}\ll 1{0}^{6}\)) than considered here. However, at such low densities, the wrong farfield asymptotics of a Gaussian basisset density produces spurious oscillations in the farfield \({v}_{{\rm{xc}}}\). Thus, for the want of more accurate densities, we are restricted to using \({v}_{{\rm{FA}}}\) in regions where \({\rho }_{{\rm{data}}}< 1{0}^{6}\), at the cost of incurring some error in \({\epsilon }_{{\rm{H}}}\).
We now turn to a polyatomic system—the \({{\rm{H}}}_{2}{\rm{O}}\) molecule. Figure 8 compares the exact \({v}_{{\rm{xc}}}\) against \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\), on the plane of the \({{\rm{H}}}_{2}{\rm{O}}\) molecule. In particular, Fig. 8c provides the comparison along the O–H bond. For the exact \({v}_{{\rm{xc}}}\), we observe an atomic intershell structure—marked by a yellow ring around the O atom in Fig. 8b (as well as the local maxima and minima at around \(r=\pm 0.4\) a.u. in Fig. 8c). This atomic intershell structure is a distinctive feature of the exact \({v}_{{\rm{xc}}}\)^{39,40} and is absent in the standard xc approximations, as evident from \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\). Further, we observe a deeper potential around the O atom, as compared with \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\), thereby suggesting a higher electronegativity on the O atom than that predicted by LDA. Moreover, we observe a distinct local maximum at the H atom, as opposed to a local minimum in \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\). Lastly, as indicated in Table 1, we obtain striking agreement between \({\epsilon }_{{\rm{H}}}\) and \({I}_{{\rm{p}}}\) for this polyatomic system.
Finally, we evaluate the exact \({v}_{{\rm{xc}}}\) for the singlet state of the orthobenzyne radical (\({{\rm{C}}}_{6}{{\rm{H}}}_{4}\))—a strongly correlated species that has previously served as a test for accurate wavefunction theories^{41}. Figure 9 compares the exact \({v}_{{\rm{xc}}}\) against \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\), on the plane of the benzyne molecule. This example underscores the efficacy of our approach in handling both large and strongly correlated systems. As expected for the exact \({v}_{{\rm{xc}}}\), we observe an atomic intershell structure—marked by a yellow ring around the C atoms, which, on the other hand, are absent in the case of \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\). As is the case with \({{\rm{H}}}_{2}{\rm{O}}\), we observe a deeper potential around the C atom, as compared with \({v}_{{\rm{xc}}}^{{\rm{LDA}}}\), suggesting a higher electronegativity on the C atom than that predicted by LDA. Furthermore, as indicated in Table 1, we obtain remarkable agreement between \({\epsilon }_{{\rm{H}}}\) and \({I}_{{\rm{p}}}\).
Discussion
We have presented an accurate and robust method to evaluate the exact \({v}_{{\rm{xc}}}\), solely from the groundstate electron density. The key ingredients in our approach are—(a) the effective use of FE basis, which is a systematically convergent and complete basis, and, in turn, results in a wellposed inverse DFT problem; (b) the use of \(\Delta \rho\) correction and appropriate farfield boundary conditions to alleviate the unphysical artifacts associated with Gaussian basisset densities. We emphasize that the proposed approach can easily drive the error in the target densities, i.e., \(  {\rho }_{{\rm{data}}}\rho  { }_{{L}^{2}}\), to tight tolerances of \({\mathcal{O}}(1{0}^{5}1{0}^{4})\)—which represents a stringent accuracy (see the Supplementary Discussion for a comparison with existing methods). Notably, as demonstrated through the 1,3dimethylbenzene and the orthobenzyne molecules, our approach can competently handle system sizes, which have, heretofore, remained challenging for other inverse DFT methods. Furthermore, for all the exact \({v}_{{\rm{xc}}}\)s obtained from CI densities, we obtain excellent agreement between \({\epsilon }_{{\rm{H}}}\) and \({I}_{{\rm{p}}}\) (excepting in the case of \({{\rm{H}}}_{2}(d)\)), further validating the accuracy and robustness of the approach. We remark that the larger discrepancy between \({\epsilon }_{{\rm{H}}}\) and \({I}_{{\rm{p}}}\) in the case of \({{\rm{H}}}_{2}(d)\) is a consequence of longrange (static) correlations in this system coupled with incorrect farfield asymptotics of Gaussian basisset densities and can be remedied with the availability of more accurate densities. The ability to evaluate the exact xc potentials from groundstate electron densities, enabled by this method, will provide a powerful tool in the future testing and development of approximate xc functionals. Further, it paves the way for using machine learning to construct the functional dependence of \({v}_{{\rm{xc}}}\) on \(\rho\), i.e., \({v}_{{\rm{xc}}}[\rho ]\), providing another avenue to develop density functionals^{24,42,43} that can systematically improve both groundstate densities and energies^{44} as well as satisfy the known conditions on the exact functional^{45,46,47}.
Methods
Discretization
We employ spectral FE basis to discretize all the spatial fields—\({v}_{{\rm{xc}}}\), \(\{{\psi }_{i}\}\), \(\{{p}_{i}\}\). The FE basis is constructed from piecewise polynomials on nonoverlapping subdomains called elements. The basis, thus constructed, can be systematically improved to completeness by reducing the element size and/or increasing the polynomial order^{48}. We remark that the spectral FE basis are not orthogonal and, hence, result in a generalized eigenvalue problem as opposed to the more desirable case of standard eigenvalue problem. To this end, we use special reducedorder quadrature (Gauss–Legendre–Lobatto quadrature rule) to render the overlap matrix diagonal and, thereby, trivially transform the generalized eigenvalue problem into a standard one. For all the \({{\rm{H}}}_{2}\) molecules, we used adaptively refined quadratic FEs to discretize the \(\{{\psi }_{i}\}\) and \(\{{p}_{i}\}\), whereas for all other systems we used adaptively refined fourthorder FEs. The \({v}_{{\rm{xc}}}\), in all the calculations, is discretized using linear FEs. Most importantly, the form of the FE basis is chosen carefully, so as to guarantee the cusp in \({\psi }_{i}\)s (and hence in \(\rho\)) at the nuclei, which in turn is critical to obtaining accurate \({v}_{{\rm{xc}}}\)s near the nuclei (refer to the Supplementary Note 1 for more information).
Solvers
In order to efficiently solve the Kohn–Sham eigenvalue problem in Eq. 5, we employ the Chebyshev polynomialbased filtering technique^{48,49,50}. We remark that, compared with a forward groundstate DFT calculation, the inverse DFT calculation warrants much tighter accuracy in solving the Kohn–Sham eigenvalue equation(s). However, the use of a very high polynomial degree Chebyshev filter can generate an illconditioned subspace, akin to any power iterationbased eigen solver. To circumvent the ill conditioning and attain higher accuracy, we employ multiple passes of a low polynomial degree Chebyshev filter (polynomial order \(\sim 1000\)) and orthonormalize the Chebyshevfiltered vectors between two successive passes. The number of passes is determined adaptively so as to guarantee an accuracy of \(1{0}^{9}\) in \(  \hat{H}{\psi }_{i}{\epsilon }_{i}{\psi }_{i} { }_{{L}^{2}}\).
The discrete adjoint function (\({p}_{i}\)) is solved by, first, projecting Eq. 7 onto a space orthogonal to the corresponding \({\psi }_{i}\) (or degenerate \({\psi }_{i}\)s) and then employing the conjugategradient method to compute the solution. The discrete adjoint problem is solved to an accuracy of \(1{0}^{12}\) in \(  (\hat{H}{\epsilon }_{i}){p}_{i}{g}_{i} { }_{{L}^{2}}\).
The update for \({v}_{{\rm{xc}}}\) is computed using limitedmemory BroydenFletcherGoldfarbShanno (BFGS) algorithm, a memoryefficient quasiNewton solver, which constructs approximate Hessian matrices using the history of the gradients^{51}. In all the calculations, we used a history of size \(100\) to construct the approximate Hessian. We refer to Supplementary Discussion for details on the rate of convergence and the factors affecting it.
Weights
To expedite the convergence of the nonlinear solver, we make use of two different weights, \(w({\bf{r}})=1\) and \(w({\bf{r}})=1/{\rho }_{{\rm{data}}}^{\alpha }\) (\(1\le \alpha \le 2\)), in sequence. The latter penalizes the objective function in the lowdensity region.
Ab initio densities
Accurate electron densities were generated using the incremental full CI (iFCI) method^{29} in the QChem software package^{52}. This method solves the electronic Schrödinger equation via a manybody expansion and asymptotically produces the exact electronic energy and density as the number of bodies in the expansion approaches the allelectron limit. For this study, electron densities were provided in the allvalenceelectron limit of iFCI, i.e., where the full valence set is fully correlated and the core orbitals of \({{\rm{H}}}_{2}{\rm{O}}\) and \({{\rm{C}}}_{6}{{\rm{H}}}_{4}\) are treated as uncorrelated electron pairs. Reference ionization energies were obtained at the same level of theory, for each system with one less electron.
Data availability
The authors declare that all the data supporting the results of this study are available upon reasonable request to the corresponding author.
Code availability
The code used to perform inverse DFT calculations is available upon reasonable request to the corresponding author.
References
Hohenberg, P. & Kohn, W. Inhomogeneous electron gas. Phys. Rev. 136, B864–B871 (1964).
Kohn, W. & Sham, L. J. Selfconsistent equations including exchange and correlation effects. Phys. Rev. 140, A1133–A1138 (1965).
Kohn, W., Becke, A. D. & Parr, R. G. Density functional theory of electronic structure. J. Phys. Chem. 100, 12974–12980 (1996).
Cohen, A. J., MoriSánchez, P. & Yang, W. Challenges for density functional theory. Chem. Rev. 112, 289–320 (2012).
Burke, K. Perspective on density functional theory. J. Chem. Phys. 136, 150901 (2012).
Becke, A. D. Perspective: fifty years of densityfunctional theory in chemical physics. J. Chem. Phys. 140, 18A301 (2014).
Jones, R. O. Density functional theory: Its origins, rise to prominence, and future. Rev. Mod. Phys. 87, 897–923 (2015).
Mardirossian, N. & HeadGordon, M. Thirty years of density functional theory in computational chemistry: an overview and extensive assessment of 200 density functionals. Mol. Phys. 115, 2315–2372 (2017).
Zhao, Q., Morrison, R. C. & Parr, R. G. From electron densities to KohnSham kinetic energies, orbital energies, exchangecorrelation potentials, and exchangecorrelation energies. Phys. Rev. A 50, 2138–2142 (1994).
van Leeuwen, R. & Baerends, E. J. Exchangecorrelation potential with correct asymptotic behavior. Phys. Rev. A 49, 2421–2431 (1994).
Peirs, K., VanNeck, D. & Waroquier, M. Algorithm to derive exact exchangecorrelation potentials from correlated densities in atoms. Phys. Rev. A 67, 012505 (2003).
Wu, Q. & Yang, W. A direct optimization method for calculating density functionals and exchangecorrelation potentials from electron densities. J. Chem. Phys. 118, 2498–2509 (2003).
Jensen, D. S. & Wasserman, A. Numerical methods for the inverse problem of density functional theory. Int. J. Quant. Chem. 118, e25425 (2018).
Wang, Y. & Parr, R. G. Construction of exact KohnSham orbitals from a given electron density. Phys. Rev. A 47, R1591–R1593 (1993).
Gritsenko, O. V., van Leeuwen, R. & Baerends, E. J. Molecular KohnSham exchangecorrelation potential from the correlated ab initio electron density. Phys. Rev. A 52, 1870–1874 (1995).
Ryabinkin, I. G. & Staroverov, V. N. Determination of KohnSham effective potentials from electron densities using the differential virial theorem. J. Chem. Phys. 137, 164113 (2012).
Tozer, D. J., Ingamells, V. E. & Handy, N. C. Exchangecorrelation potentials. J. Chem. Phys. 105, 9200–9213 (1996).
Jacob, C. R. Unambiguous optimization of effective potentials in finite basis sets. J. Chem. Phys. 135, 244102 (2011).
HeatonBurgess, T., Bulat, F. A. & Yang, W. Optimized effective potentials in finite basis sets. Phys. Rev. Lett. 98, 256401 (2007).
Bulat, F. A., HeatonBurgess, T., Cohen, A. J. & Yang, W. Optimized effective potentials from electron densities in finite basis sets. J. Chem. Phys. 127, 174101 (2007).
Ryabinkin, I. G., Kohut, S. V. & Staroverov, V. N. Reduction of electronic wave functions to KohnSham effective potentials. Phys. Rev. Lett. 115, 083001 (2015).
CuevasSaavedra, R., Ayers, P. W. & Staroverov, V. N. KohnSham exchangecorrelation potentials from secondorder reduced density matrices. J. Chem. Phys. 143, 244116 (2015).
Ospadov, E., Ryabinkin, I. G. & Staroverov, V. N. Improved method for generating exchangecorrelation potentials from electronic wave functions. J. Chem. Phys. 146, 084103 (2017).
Brockherde, F. et al. Bypassing the KohnSham equations with machine learning. Nat. Commun. 8, 872 (2017).
Nagai, R., Akashi, R., Sasaki, S. & Tsuneyuki, S. Neuralnetwork KohnSham exchangecorrelation potential and its outoftraining transferability. J. Chem. Phys. 148, 241737 (2018).
vanLeeuwen, R. & Baerends, E. J. Energy expressions in densityfunctional theory using line integrals. Phys. Rev. A 51, 170–178 (1995).
Slater, J. C. & Johnson, K. H. Selfconsistentfield \(X\alpha\) cluster method for polyatomic molecules and solids. Phys. Rev. B 5, 844–853 (1972).
Perdew, J. P. & Wang, Y. Accurate and simple analytic representation of the electrongas correlation energy. Phys. Rev. B 45, 13244–13249 (1992).
Zimmerman, P. M. Incremental full configuration interaction. J. Chem. Phys. 146, 104102 (2017).
de Castro, E. V. R. & Jorge, F. E. Accurate universal Gaussian basis set for all atoms of the Periodic Table. J. Chem. Phys. 108, 5225–5229 (1998).
Dunning, T. H. Gaussian basis sets for use in correlated molecular calculations. I. The atoms boron through neon and hydrogen. J. Chem. Phys. 90, 1007–1023 (1989).
Ayers, P. W., Morrison, R. C. & Parr, R. G. FermiAmaldi model for exchangecorrelation: atomic excitation energies from orbital energy differences. Mol. Phys. 103, 2061–2072 (2005).
Perdew, J. P. & Levy, M. Comment on “significance of the highest occupied KohnSham eigenvalue”. Phys. Rev. B 56, 16021–16028 (1997).
Casida, M. E. Correlated optimized effectivepotential treatment of the derivative discontinuity and of the highest occupied KohnSham eigenvalue: a Janaktype theorem for the optimized effectivepotential model. Phys. Rev. B 59, 4694–4698 (1999).
Mura, M. E., Knowles, P. J. & Reynolds, C. A. Accurate numerical determination of KohnSham potentials from electronic densities: I. Twoelectron systems. J. Chem. Phys. 106, 9659–9667 (1997).
Schipper, P. R. T., Gritsenko, O. V. & Baerends, E. J. KohnSham potentials corresponding to Slater and Gaussian basis set densities. Theor. Chem. Acc. 98, 16–24 (1997).
Gaiduk, A. P., Ryabinkin, I. G. & Staroverov, V. N. Removal of basisset artifacts in KohnSham potentials recovered from electron densities. J. Chem. Theory Comput. 9, 3959–3964 (2013).
Perdew, J. P., Burke, K. & Ernzerhof, M. Generalized gradient approximation made simple. Phys. Rev. Lett. 77, 3865–3868 (1996).
Gritsenko, O., vanLeeuwen, R. & Baerends, E. J. Analysis of electron interaction and atomic shell structure in terms of local potentials. J. Chem. Phys. 101, 8955–8963 (1994).
Gritsenko, O. V., Leeuwen, Rv & Baerends, E. J. Molecular exchangecorrelation KohnSham potential and energy density from ab initio first and secondorder density matrices: Examples for XH (X=Li, B, F). J. Chem. Phys. 104, 8535–8545 (1996).
Zimmerman, P. M. Singlettriplet gaps through incremental full configuration interaction. J. Phys. Chem. A 121, 4712–4720 (2017).
Snyder, J. C., Rupp, M., Hansen, K., Müller, K.R. & Burke, K. Finding density functionals with machine learning. Phys. Rev. Lett. 108, 253002 (2012).
Li, L., Baker, T. E., White, S. R. & Burke, K. Pure density functional for strong correlation and the thermodynamic limit from machine learning. Phys. Rev. B 94, 245129 (2016).
Medvedev, M. G., Bushmarinov, I. S., Sun, J., Perdew, J. P. & Lyssenko, K. A. Density functional theory is straying from the path toward the exact functional. Science 355, 49–52 (2017).
Sun, J., Ruzsinszky, A. & Perdew, J. P. Strongly constrained and appropriately normed semilocal density functional. Phys. Rev. Lett. 115, 036402 (2015).
Li, C., Zheng, X., Su, N. Q. & Yang, W. Localized orbital scaling correction for systematic elimination of delocalization error in density functional approximations. Natl Sci. Rev. 5, 203–215 (2017).
Su, N. Q., Li, C. & Yang, W. Describing strong correlation with fractionalspin correction in density functional theory. Proc. Natl Acad. Sci. USA 115, 9678–9683 (2018).
Motamarri, P., et al. DFTFE  A massively parallel adaptive finiteelement code for largescale density functional theory calculations. Comput. Phys. Commun. (in press).
Zhou, Y., Saad, Y., Tiago, M. L. & Chelikowsky, J. R. Parallel selfconsistentfield calculations via Chebyshevfiltered subspace acceleration. Phys. Rev. E 74, 066704 (2006).
Motamarri, P., Nowak, M., Leiter, K., Knap, J. & Gavini, V. Higherorder adaptive finiteelement methods for KohnSham density functional theory. J. Comput. Phys. 253, 308–343 (2013).
Nocedal, J. Updating quasiNewton matrices with limited storage. Math. Comput. 35, 773–782 (1980).
Shao, Y. et al. Advances in molecular quantum chemistry contained in the QChem 4 program package. Mol. Phys. 113, 184–215 (2015).
Acknowledgements
We thank O. Ghattas for fruitful discussions. We are grateful for the support of Toyota Research Institute under the auspices of which this work was conducted. We also acknowledge the support of Department of Energy, Office of Science, under grant number DESC0017380, which supported the development of allelectron DFT calculations using the finiteelement basis that was instrumental in this work. V.G. also acknowledges the support of Air Force Office of Scientific Research under grant number FA95501710172, which supported the development of some aspects of the computational framework used in this work. This research used resources of the National Energy Research Scientific Computing Center, a DOE Office of Science User Facility supported by the Office of Science of the US Department of Energy under Contract Number DEAC0205CH11231. This work used the Extreme Science and Engineering Discovery Environment (XSEDE), which is supported by National Science Foundation Grant number ACI1053575. V.G. also gratefully acknowledges the support of the Army Research Office through the DURIP grant W911NF1810242, which also provided computational resources for this work.
Author information
Authors and Affiliations
Contributions
V.G. designed the research. B.K. performed the inverse DFT calculations. P.M.Z. performed the CI calculations. B.K. and V.G. analyzed the data. All authors contributed to the manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Peer review information Nature Communications thanks Jason D. Goodpaster and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Peer reviewer reports are available.
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Kanungo, B., Zimmerman, P.M. & Gavini, V. Exact exchangecorrelation potentials from groundstate electron densities. Nat Commun 10, 4497 (2019). https://doi.org/10.1038/s41467019124670
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41467019124670
Further reading

Building Kohn–Sham Potentials for Ground and Excited States
Archive for Rational Mechanics and Analysis (2022)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.