Skip to main content
Log in

Numerical stability and efficiency of response property calculations in density functional theory

  • Published:
Letters in Mathematical Physics Aims and scope Submit manuscript

Abstract

Response calculations in density functional theory aim at computing the change in ground-state density induced by an external perturbation. At finite temperature, these are usually performed by computing variations of orbitals, which involve the iterative solution of potentially badly conditioned linear systems, the Sternheimer equations. Since many sets of variations of orbitals yield the same variation of density matrix, this involves a choice of gauge. Taking a numerical analysis point of view, we present the various gauge choices proposed in the literature in a common framework and study their stability. Beyond existing methods, we propose a new approach, based on a Schur complement using extra orbitals from the self-consistent field calculations, to improve the stability and efficiency of the iterative solution of Sternheimer equations. We show the success of this strategy on nontrivial examples of practical interest, such as Heusler transition metal alloy compounds, where savings of around 40% in the number of required cost-determining Hamiltonian applications have been achieved.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Notes

  1. https://github.com/gkemlin/response-calculations-metals.

References

  1. Baroni, S., de Gironcoli, S., Dal Corso, A., Giannozzi, P.: Phonons and related crystal properties from density-functional perturbation theory. Rev. Mod. Phys. 73(2), 515–562 (2001)

    Article  ADS  Google Scholar 

  2. Baroni, S., Giannozzi, P., Testa, A.: Green’s-function approach to linear response in solids. Phys. Rev. Lett. 58(18), 1861–1864 (1987)

    Article  ADS  Google Scholar 

  3. Cancès, E., Chakir, R., Maday, Y.: Numerical analysis of the planewave discretization of some orbital-free and Kohn-Sham models. ESAIM Math. Model. Numer. Anal. 46(2), 341–388 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  4. Cancès, É., Deleurence, A., Lewin, M.: A new approach to the modeling of local defects in crystals: The reduced Hartree-Fock case. Commun. Math. Phys. 281(1), 129–177 (2008)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  5. Cancès, E., Ehrlacher, V., Gontier, D., Levitt, A., Lombardi, D.: Numerical quadrature in the Brillouin zone for periodic Schrödinger operators. Numer. Math. 144(3), 479–526 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  6. Cancès, E., Kemlin, G., Levitt, A.: Convergence analysis of direct minimization and self-consistent iterations. SIAM J. Matrix Anal. Appl. 42(1), 243–274 (2021)

    Article  MathSciNet  MATH  Google Scholar 

  7. Cancès, E., Levitt, A., Maday, Y., Yang, C.: Numerical methods for Kohn-Sham models: discretization, algorithms, and error analysis. In: Cancès, E., Friesecke, G. (eds.) Density Functional Theory. Springer, Berlin (2021)

    Google Scholar 

  8. Cancès, E., Lewin, M.: The Dielectric Permittivity of Crystals in the Reduced Hartree-Fock Approximation. Arch. Ration. Mech. Anal. 197(1), 139–177 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  9. Cancès, E., Mourad, N.: A mathematical perspective on density functional perturbation theory. Nonlinearity 27(9), 1999–2033 (2014)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  10. Catto, I., Bris, C.L., Lions, P.L.: Mathematical Theory of Thermodynamic Limits : Thomas- Fermi Type Models. Oxford University Press, Oxford (1998)

    MATH  Google Scholar 

  11. Dusson, G., Sigal, I., Stamm, B.: Analysis of the Feshbach-Schur method for the planewave discretizations of Schrödinger operators. Math comput. 92, 217–249 (2020)

  12. Giannozzi, P., Baroni, S., Bonini, N., Calandra, M., Car, R., Cavazzoni, C., Ceresoli, D., Chiarotti, G.L., Cococcioni, M., Dabo, I., Dal Corso, A., de Gironcoli, S., Fabris, S., Fratesi, G., Gebauer, R., Gerstmann, U., Gougoussis, C., Kokalj, A., Lazzeri, M., Martin-Samos, L., Marzari, N., Mauri, F., Mazzarello, R., Paolini, S., Pasquarello, A., Paulatto, L., Sbraccia, C., Scandolo, S., Sclauzero, G., Seitsonen, A.P., Smogunov, A., Umari, P., Wentzcovitch, R.M.: QUANTUM ESPRESSO: a modular and open-source software project for quantum simulations of materials. J. Phys. Condens. Matter. Inst. Phys. J. 21(39), 395502 (2009)

    Article  Google Scholar 

  13. Goedecker, S., Teter, M., Hutter, J.: Separable dual-space Gaussian pseudopotentials. Phys. Rev. B 54(3), 1703 (1996)

    Article  ADS  Google Scholar 

  14. Gontier, D., Lahbabi, S.: Convergence rates of supercell calculations in the reduced Hartree-Fock model. ESAIM Math. Model. Numer. Anal. 50(5), 1403–1424 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  15. Gonze, X.: Adiabatic density-functional perturbation theory. Phys. Rev. A 52(2), 1096–1114 (1995)

    Article  ADS  Google Scholar 

  16. Gonze, X.: Perturbation expansion of variational principles at arbitrary order. Phys. Rev. A 52(2), 1086–1095 (1995)

    Article  ADS  Google Scholar 

  17. Gonze, X., Amadon, B., Antonius, G., Arnardi, F., Baguet, L., Beuken, J.-M., Bieder, J., Bottin, F., Bouchet, J., Bousquet, E., Brouwer, N., Bruneval, F., Brunin, G., Cavignac, T., Charraud, J.-B., Chen, W., Côté, M., Cottenier, S., Denier, J., Geneste, G., Ghosez, P., Giantomassi, M., Gillet, Y., Gingras, O., Hamann, D.R., Hautier, G., He, X., Helbig, N., Holzwarth, N., Jia, Y., Jollet, F., Lafargue-Dit-Hauret, W., Lejaeghere, K., Marques, M.A.L., Martin, A., Martins, C., Miranda, H.P.C., Naccarato, F., Persson, K., Petretto, G., Planes, V., Pouillon, Y., Prokhorenko, S., Ricci, F., Rignanese, G.-M., Romero, A.H., Schmitt, M.M., Torrent, M., van Setten, M.J., Van Troeye, B., Verstraete, M.J., Zérah, G., Zwanziger, J.W.: The Abinit project: impact, environment and recent developments. Comput. Phys. Commun. 248, 107042 (2020)

    Article  Google Scholar 

  18. Gonze, X., Vigneron, J.-P.: Density-functional approach to nonlinear-response coefficients of solids. Phys. Rev. B 39(18), 13120–13128 (1989)

    Article  ADS  Google Scholar 

  19. Griewank, A., Walther, A.: Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation, Second Edition. Society for Industrial and Applied Mathematics, second edition, (2008)

  20. Hartwigsen, C., Goedecker, S., Hutter, J.: Relativistic separable dual-space Gaussian pseudopotentials from H to Rn. Phys. Rev. B 58(7), 3641–3662 (1998)

    Article  ADS  Google Scholar 

  21. Hellmann, H.: Einführung in die Quantenchemie. J.W, Edwards (1944)

  22. Herbst, M.F., Levitt, A.: Black-box inhomogeneous preconditioning for self-consistent field iterations in density functional theory. J. Phys. Condens. Matter 33(8), 085503 (2020)

    Article  ADS  Google Scholar 

  23. Herbst, M.F., Levitt, A.: A robust and efficient line search for self-consistent field iterations. J. Comput. Phys. 459(C), 111–127 (2022)

    MathSciNet  MATH  Google Scholar 

  24. Herbst, M.F., Levitt, A., Cancès, E.: A posteriori error estimation for the non-self-consistent Kohn-Sham equations. Faraday Discuss. 224, 227–246 (2020)

    Article  ADS  Google Scholar 

  25. Herbst, M.F., Levitt, A., Cancès, E.: DFTK: a Julian approach for simulating electrons in solids. Proc. JuliaCon Conf. 3(26), 69 (2021)

    Article  Google Scholar 

  26. Hohenberg, P., Kohn, W.: Inhomogeneous electron gas. Phys. Rev. 136(3B), B864–B871 (1964)

    Article  ADS  MathSciNet  Google Scholar 

  27. Kasim, M.F., Vinko, S.M.: Learning the exchange-correlation functional from nature with fully differentiable density functional theory. Phys. Rev. Lett. 127(12), 126403 (2021)

    Article  ADS  Google Scholar 

  28. Kerker, G.P.: Efficient iteration scheme for self-consistent pseudopotential calculations. Phys. Rev. B 23(6), 3082–3084 (1981)

    Article  ADS  Google Scholar 

  29. Kirkpatrick, J., McMorrow, B., Turban, D.H.P., Gaunt, A.L., Spencer, J.S., Matthews, A.G.D.G., Obika, A., Thiry, L., Fortunato, M., Pfau, D., Castellanos, L.R., Petersen, S., Nelson, A.W.R., Kohli, P., Mori-Sánchez, P., Hassabis, D., Cohen, A.J.: Pushing the frontiers of density functionals by solving the fractional electron problem. Science 374(6573), 1385–1389 (2021)

    Article  ADS  Google Scholar 

  30. Kleinman, L., Bylander, D.M.: Efficacious form for model pseudopotentials. Phys. Rev. Lett. 48(20), 1425–1428 (1982)

    Article  ADS  Google Scholar 

  31. Knyazev, A.V.: Toward the optimal preconditioned Eigensolver: locally optimal block preconditioned conjugate gradient method. SIAM J. Sci. Comput. 23(2), 517–541 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  32. Kohn, W., Sham, L.J.: Self-consistent equations including exchange and correlation effects. Phys. Rev. 140(4A), A1133–A1138 (1965)

    Article  ADS  MathSciNet  Google Scholar 

  33. Levitt, A.: Screening in the finite-temperature reduced Hartree-Fock model. Arch. Ration. Mech. Anal. 238(2), 901–927 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  34. Li, L., Hoyer, S., Pederson, R., Sun, R., Cubuk, E.D., Riley, P., Burke, K.: Kohn–Sham equations as regularizer: building prior knowledge into machine-learned physics. Phys. Rev. Lett. 126(3), 036401 (2021)

    Article  ADS  Google Scholar 

  35. Lin, L., Lu, J.: A Mathematical Introduction to Electronic Structure Theory. Society for Industrial and Applied Mathematics, SIAM Spotlights (2019)

  36. Monkhorst, H.J., Pack, J.D.: Special points for Brillouin-zone integrations. Phys. Rev. B 13(12), 5188–5192 (1976)

    Article  ADS  MathSciNet  Google Scholar 

  37. Norman, P., Ruud, K., Saue, T.: Principles and Practices of Molecular Properties: Theory. Modeling and Simulations. Wiley, Chichester (2018)

    Book  Google Scholar 

  38. Payne, M.C., Teter, M.P., Allan, D.C., Arias, T., Joannopoulos, J.: Iterative minimization techniques for ab initio total-energy calculations: molecular dynamics and conjugate gradients. Rev. Mod. Phys. 64(4), 1045 (1992)

    Article  ADS  Google Scholar 

  39. Perdew, J.P., Burke, K., Ernzerhof, M.: Generalized gradient approximation made simple. Phys. Rev. Lett. 77(18), 3865–3868 (1996)

    Article  ADS  Google Scholar 

  40. Reed, M., Simon, B.: Analysis of Operators. Number 4 in Methods of Modern Mathematical Physics. Academic Press, Cambridge (1978)

    MATH  Google Scholar 

  41. Romero, A.H., Allan, D.C., Amadon, B., Antonius, G., Applencourt, T., Baguet, L., Bieder, J., Bottin, F., Bouchet, J., Bousquet, E., Bruneval, F., Brunin, G., Caliste, D., Côté, M., Denier, J., Dreyer, C., Ghosez, P., Giantomassi, M., Gillet, Y., Gingras, O., Hamann, D.R., Hautier, G., Jollet, F., Jomard, G., Martin, A., Miranda, H.P.C., Naccarato, F., Petretto, G., Pike, N.A., Planes, V., Prokhorenko, S., Rangel, T., Ricci, F., Rignanese, G.-M., Royo, M., Stengel, M., Torrent, M., van Setten, M.J., Van Troeye, B., Verstraete, M.J., Wiktor, J., Zwanziger, J.W., Gonze, X.: ABINIT: overview and focus on selected capabilities. J. Chem. Phys. 152(12), 124102 (2020)

    Article  ADS  Google Scholar 

  42. Saad, Y.: Numerical Methods for Large Eigenvalue Problems: Revised Edition. Society for Industrial and Applied Mathematics, (2011)

  43. Shewchuk, J.R.: An introduction to the conjugate gradient method without the agonizing pain. (1994)

  44. Sternheimer, R.M.: Electronic polarizabilities of ions from the Hartree-Fock wave functions. Phys. Rev. 96(4), 951–968 (1954)

    Article  ADS  MATH  Google Scholar 

Download references

Acknowledgements

This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 810367). M.H. and B.S. acknowledge funding by the Federal Ministry of Education and Research (BMBF) and the Ministry of Culture and Science of the German State of North Rhine-Westphalia (MKW) under the Excellence Strategy of the Federal Government and the Länder.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Antoine Levitt.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix A Choosing the number of extra bands

Appendix A Choosing the number of extra bands

In this paper, we saw through various numerical examples that using a Schur complement to compute the unoccupied–occupied contributions to the orbitals’ response improves the convergence of the Sternheimer equation. In this appendix, we quantify this acceleration and discuss how this idea can be used to select the number of bands to be computed. Considering the straight convergence curves from Figs. 5, 6 suggest that the convergence of the CG is indeed led by the square root of the condition number of the system matrix (see [43, Section 9]) when using the Schur complement. Key idea will thus be to estimate the condition number of the linear system (50).

1.1 A.1 Numerical analysis

To analyse the condition number of the Schur complement, we consider the following specific setting

$$\begin{aligned} {\left\{ \begin{array}{ll} H_\rho \phi _n = \varepsilon _n\phi _n,\quad \varepsilon _1 \leqslant \varepsilon _2 \leqslant \cdots \\ \left\langle \phi _n,\phi _m \right\rangle = \delta _{nm}, \end{array}\right. } \end{aligned}$$
(53)

where \(H_\rho \in {{\mathbb {C}}}^{{N_{\textrm{b}}}\times {N_{\textrm{b}}}}\) is typically the discretized self-consistent Hamiltonian of the system, at some k-point. We assume that we have N occupied orbitals that have an occupation number higher than the threshold we fixed and that we have \({N_{\textrm{ex}}}\) extra bands, as explained in Sect. 3.3. In summary, we have at our disposal \(N + {N_{\textrm{ex}}}\) bands in total: \(\Phi = (\phi _1,\dots ,\phi _N)\) are occupied, fully converged bands and the extra bands \(\Phi _{\textrm{ex}}^{\ell } = (\phi ^{\ell }_{N+1},\dots ,\phi ^{\ell }_{N+{N_{\textrm{ex}}}})\) are not necessarily all converged. We added here the exponent \(\ell \) as we make the following assumptions:

  • for any \(\ell \in {{\mathbb {N}}}\), \((\Phi ,\Phi _{\textrm{ex}}^{\ell })\) is an orthonormal family;

  • for any \(\ell \in {{\mathbb {N}}}\), \((\Phi _{\textrm{ex}}^{\ell })^* H_\rho \Phi _{\textrm{ex}}^{\ell } \in {{\mathbb {C}}}^{{N_{\textrm{ex}}}\times {N_{\textrm{ex}}}}\) is a diagonal matrix whose elements are labelled \(\varepsilon _{m}^{\ell } {:}{=}\left\langle \phi _m^{\ell },H_\rho \phi _m^{\ell } \right\rangle \) for \(N+1\leqslant m\leqslant N+{N_{\textrm{ex}}}\);

  • as \(\ell \rightarrow +\infty \), \((\phi ^{\ell }_{m}, \varepsilon ^{\ell }_{m}) \rightarrow (\phi _{m}, \varepsilon _{m})\).

All these assumptions are satisfied, for instance, if the sequence \((\Phi ,\Phi _{\textrm{ex}}^{\ell })_{l\in {{\mathbb {N}}}}\) is generated by any Rayleigh–Ritz-based eigensolver (for instance, the LOBPCG eigensolver [31]), which is the case by default in DFTK. For every \(\ell \), we can thus decompose the plane-wave approximation space \({{\mathcal {H}}}= X_{{N_{\textrm{b}}}}\) (with \({N_{\textrm{b}}}\gg N+{N_{\textrm{ex}}}\)) in two different ways:

$$\begin{aligned} {{\mathcal {H}}}= \textrm{Ran}(P) \oplus \textrm{Ran}(T) \oplus \textrm{Ran}(R) \quad \text {and}\quad {{\mathcal {H}}}= \textrm{Ran}(P) \oplus \textrm{Ran}(T^{\ell }) \oplus \textrm{Ran}(R^{\ell }), \nonumber \\ \end{aligned}$$
(54)

where

$$\begin{aligned} P {:}{=}\sum _{n=1}^N \phi _n\phi _n^*\quad \text {and}\quad {\left\{ \begin{array}{ll} T {:}{=}\sum _{n=N+1}^{{N_{\textrm{ex}}}} \phi _n\phi _n^*, \quad R {:}{=}1 - P - T \\ T^{\ell } {:}{=}\sum _{n=N+1}^{{N_{\textrm{ex}}}} \phi _n^{\ell }(\phi _n^{\ell })^*, \quad R^{\ell } {:}{=}1 - P - T^{\ell }, \end{array}\right. } \end{aligned}$$
(55)

are all orthogonal projectors. In these two decompositions, \(H_\rho \) has the associated block representations:

$$\begin{aligned} H_\rho = \begin{pmatrix} E &{} 0 &{} 0 \\ 0 &{} E_{\textrm{ex}} &{} 0 \\ 0 &{} 0 &{} \ddots \end{pmatrix} \quad \text {and}\quad H_\rho = \begin{pmatrix} E &{} 0 &{} 0 \\ 0 &{} E^{\ell }_{\textrm{ex}} &{} R^{\ell }H_\rho T^{\ell } \\ 0 &{} T^{\ell }H_\rho R^{\ell } &{} R^{\ell }H_\rho R^{\ell } \end{pmatrix} \end{aligned}$$
(56)

where \(E {:}{=}\textrm{Diag}(\varepsilon _1,\dots ,\varepsilon _n)\), \(E_{\textrm{ex}} {:}{=}\textrm{Diag}(\varepsilon _{N+1},\dots ,\varepsilon _{N+{N_{\textrm{ex}}}})\) and \(E_{\textrm{ex}}^{\ell } {:}{=}\textrm{Diag}(\varepsilon ^{\ell }_{N+1}, \dots ,\varepsilon ^{\ell }_{N+{N_{\textrm{ex}}}})\) are diagonal matrices. Moreover, note that as \(\Phi ^{\ell }_{\textrm{ex}} \rightarrow \Phi _{\textrm{ex}}\), the residuals \(R^{\ell }H_\rho T^{\ell }\) converge to 0.

Now, we fix \(n\leqslant N\) and we compute the condition number of the linear system (50). Enforcing the CG to stay at each iteration in \(\textrm{Ran}(R^{\ell })\), this condition number is given by the ratio of the largest and smallest nonzero eigenvalues of

$$\begin{aligned} H_n^{\ell } + X_n^{\ell }, \end{aligned}$$
(57)

where

$$\begin{aligned} \begin{aligned} H_n^{\ell } {:}{=}R^{\ell }(H_\rho - \varepsilon _n)R^{\ell } \quad \text {and}\quad X_n^{\ell }&= -R^{\ell }(H_\rho -\varepsilon _n)\Phi _{\textrm{ex}}^{\ell } (E_{\textrm{ex}}^{\ell } - \varepsilon _n)^{-1}\\&(\Phi _{\textrm{ex}}^{\ell })^*(H_\rho - \varepsilon _n)R^{\ell }\\&= -R^{\ell }H_\rho \Phi _{\textrm{ex}}^{\ell }(E_{\textrm{ex}}^{\ell } - \varepsilon _n)^{-1} (\Phi _{\textrm{ex}}^{\ell })^*H_\rho R^{\ell }. \end{aligned} \end{aligned}$$
(58)

Here, \(E^{\ell }_{\textrm{ex}}-\varepsilon _n\) is diagonal and thus explicitly invertible if \(\ell \) is large enough as \(\varepsilon _{N+1}^{\ell }\rightarrow \varepsilon _{N+1}>\varepsilon _N\geqslant \varepsilon _n\). We focus for the moment on the smallest nonzero eigenvalue, that is \(\varepsilon ^{\ell }_{N+{N_{\textrm{ex}}}+1} - \varepsilon _n\). The condition number being proportional to the inverse of the smallest eigenvalue, we now derive a lower bound of \(\varepsilon ^{\ell }_{N+{N_{\textrm{ex}}}+1} - \varepsilon _n\) in order to get an upper bound on the condition number of (57). When \(\ell \rightarrow +\infty \), we have \(X_n^{\ell }\rightarrow 0\) (as \(RH_\rho \Phi _{\textrm{ex}}=0\)) and \(H_n^{\ell }\rightarrow H_n{:}{=}R(H_\rho - \varepsilon _n)R\) whose smallest nonzero eigenvalue is \(\varepsilon _{N+{N_{\textrm{ex}}}+1} - \varepsilon _n\). We use next a perturbative approach to effectively approximate the condition number of (57).

We use a standard eigenvalue perturbation result, whose proof is recalled for the sake of completeness. It is directly adapted from the general case of self-adjoint bounded below operators with symmetric perturbations studied, for instance, in [11].

Proposition 1

Let \(N\in {{\mathbb {N}}}\), \(H_0,W\in {{\mathbb {C}}}^{N\times N}\) be Hermitian matrices and \(\alpha \geqslant 0\) such that \(H_0+\alpha >0\). Then, the eigenvalues of \(H{:}{=}H_0+W\) and \(H_0\) satisfy

$$\begin{aligned} \left| \nu _i(H) - \nu _i(H_0) \right| \leqslant (\nu _i(H_0)+\alpha )\left\| W \right\| _{H_0,\alpha }, \end{aligned}$$
(59)

where \(\left\| W \right\| _{H_0,\alpha }\) is the operator norm of \((H_0+\alpha )^{-1/2}W(H_0+\alpha )^{-1/2}\) and \(\nu _i(A)\) is the i-th lowest eigenvalue of the matrix A.

Proof

Let \(u\in {{\mathbb {C}}}^N\) and define \(v{:}{=}(H_0+\alpha )^{1/2}u\). Then,

$$\begin{aligned} \begin{aligned} \left| \left\langle u,Hu \right\rangle - \left\langle u,H_0u \right\rangle \right| = \left| \left\langle u,Wu \right\rangle \right|&= \left| \left\langle v, (H_0+\alpha )^{-1/2}W(H_0+\alpha )^{-1/2}v \right\rangle \right| \\&\leqslant \left\| W \right\| _{H_0,\alpha }\left\langle v,v \right\rangle = \left\| W \right\| _{H_0,\alpha }\left\langle u,(H_0+\alpha )u \right\rangle . \end{aligned}\nonumber \\ \end{aligned}$$
(60)

Therefore,

$$\begin{aligned}{} & {} (1 - \left\| W \right\| _{H_0,\alpha })\left\langle u,H_0u \right\rangle - \alpha \left\| W \right\| _{H_0,\alpha }\left\langle u,u \right\rangle \leqslant \left\langle u,Hu \right\rangle \leqslant (1 + \left\| W \right\| _{H_0,\alpha })\left\langle u,H_0u \right\rangle \nonumber \\{} & {} \quad + \alpha \left\| W \right\| _{H_0,\alpha }\left\langle u,u \right\rangle . \end{aligned}$$
(61)

The min–max theorem then yields for \(i=1,\dots ,N\),

$$\begin{aligned} (1 - \left\| W \right\| _{H_0,\alpha })\nu _i(H_0) - \alpha \left\| W \right\| _{H_0,\alpha }\nonumber \\ \leqslant \nu _i(H) \leqslant (1 + \left\| W \right\| _{H_0,\alpha })\nu _i(H_0) + \alpha \left\| W \right\| _{H_0,\alpha }, \end{aligned}$$
(62)

which gives the desired inequality. \(\square \)

In our case, we can apply this result to

$$\begin{aligned} H_n^{\ell } + X_n^{\ell } = H_n + (H_n^{\ell } - H_n) + X_n^{\ell }, \end{aligned}$$
(63)

with \(H_0 = H_n\), \(W = W_n^{\ell } {:}{=}(H_n^{\ell } - H_n) + X_n^{\ell }\) and \(\alpha =\varepsilon _{N+{N_{\textrm{ex}}}+1} -\varepsilon _n> 0\). Proposition 1 applied to the \((N+{N_{\textrm{ex}}}+1)\)-th eigenvalues then yields

$$\begin{aligned} \varepsilon _{N+{N_{\textrm{ex}}}+1}^{\ell } -\varepsilon _n\geqslant \left( \varepsilon _{N+{N_{\textrm{ex}}}+1}-\varepsilon _n \right) \left( 1 - 2\left\| W_n^{\ell } \right\| _{H_n,\varepsilon _{N+{N_{\textrm{ex}}}+1}-\varepsilon _n} \right) \nonumber \\ \approx \left( \varepsilon _{N+{N_{\textrm{ex}}}+1}-\varepsilon _n \right) , \end{aligned}$$
(64)

where we assume that \(2\left\| W_n^{\ell } \right\| _{H_n,\varepsilon _{N+{N_{\textrm{ex}}}+1}-\varepsilon _n}\) is small enough to be negligible with respect to 1, which is the case if the extra states are sufficiently converged. Now, if this bound is valid in theory, in practice we do not have access to \(\varepsilon _{N+{N_{\textrm{ex}}}+1}\) as we work with \(N+{N_{\textrm{ex}}}\) bands only. However, up to loosing sharpness, we can use that \(\varepsilon _{N+{N_{\textrm{ex}}}+1}\geqslant \varepsilon _{N+{N_{\textrm{ex}}}}\) where \(\varepsilon _{N+{N_{\textrm{ex}}}}\) can be estimated using the last extra band. Indeed, using, for instance, the Bauer–Fike bound ( [24, Theorem 1] or [42]), we obtain

$$\begin{aligned} \varepsilon _{N+{N_{\textrm{ex}}}} \geqslant \varepsilon _{N+{N_{\textrm{ex}}}}^{\ell } - \left\| r_{N+{N_{\textrm{ex}}}}^{\ell } \right\| , \end{aligned}$$
(65)

where \(r_{N+{N_{\textrm{ex}}}}^{\ell }\) is the residual associated with the last extra band. Of course, this estimate is not sharp as we expect the error on the eigenvalue to behave as the square of the residual, but this requires to estimate the gap to the rest of the spectrum, see, for instance, the Kato–Temple bound [24, Theorem 2]. In the end, we have the following lower bound for \(\varepsilon _{N+{N_{\textrm{ex}}}+1}^{\ell }-\varepsilon _n\):

$$\begin{aligned} \varepsilon _{N+{N_{\textrm{ex}}}+1}^{\ell } -\varepsilon _n\geqslant \left( \varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n - \left\| r_{N+{N_{\textrm{ex}}}}^{\ell } \right\| \right) \approx \varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n, \end{aligned}$$
(66)

where we assume again that \(\left\| r_{N+{N_{\textrm{ex}}}}^{\ell } \right\| \) is small enough with respect to \(\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n\).

We can now derive an upper bound on \(\kappa _{n}^{\ell }\), the condition number of (57). It is given by the ratio of its highest eigenvalue and \(\varepsilon _{N+{N_{\textrm{ex}}}+1}^{\ell } -\varepsilon _n\). Since the Laplace operator is the higher-order term in the Kohn–Sham Hamiltonian, the highest eigenvalue is, as usually in plane-wave simulations, of order \(E_{\textrm{cut}}\). With proper kinetic preconditioning, we can assume that its contribution to the condition number of the linear system is constant with respect to \(E_{\textrm{cut}}\) and n so that, finally,

$$\begin{aligned} \kappa _n^{\ell } \lesssim \frac{C}{\varepsilon _{N+{N_{\textrm{ex}}}+1}^{\ell } -\varepsilon _n} \lesssim \frac{C}{\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n}. \end{aligned}$$
(67)

Therefore, the condition number is bounded from above by \(C/(\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n)\) to first order. The number of CG iterations to solve the linear system (50) with a given accuracy is then proportional to the square root of the condition number of the matrix (57) (see [43]):

$$\begin{aligned} \sqrt{\kappa _n^{\ell }} \lesssim \sqrt{\frac{C}{{\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n}}}. \end{aligned}$$
(68)

Note that this upper bound is valid provided that the extra bands are converged enough, not necessarily fully, and proper kinetic preconditioning is employed.

Estimate (68) leads, as expected, to the qualitative conclusion that the more extra bands we use, the higher the difference \(\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _n\) and the faster the convergence. However, note that it is not possible to evaluate directly the convergence speed as the constant C is a priori unknown, in particular if we use preconditioners.

1.2 A.2 An adaptive strategy to choose the number of extra bands

The main bottleneck of (68) is the estimation of the constant C. However, one can reasonably assume that this constant does not depend too much on n, so that the ratio between the number of iterations to reach convergence between the last occupied band (\(n=N\)) and the first band \((n=1)\) can be estimated by

$$\begin{aligned} \xi _{{N_{\textrm{ex}}}}^{\ell } {:}{=}\sqrt{\frac{\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _1}{\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _N}}, \end{aligned}$$
(69)

This ratio can be of interest as (68) suggests that the Sternheimer solver converges the fastest for \(n=1\) and the slowest for \(n=N\).

Fig. 9
figure 9

Comparison between the ratio \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) (\(\times \)) and the ratios of the experimental number of iterations between the first and last occupied bands, with (\(\square \)) and without (\(\circ \)) the Schur complement (50). On the x-axis is the index of the k-point. [Left] Al\(_{40}\) [Middle] Fe\(_{2}\)MnAl spin up channels [Right] Fe\(_{2}\)MnAl spin down channels

We plot in Fig. 9 the upper bound \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) as well as the computed ratios between the number of iterations of the first and last bands for the systems we considered in Sect. 4. These plots show that \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) is indeed an upper bound of the actual ratio. This bound does not seem to be sharp however. This is due to the successive approximations we made to obtain this estimate. Plots in Fig. 9 also confirm that if, for every k-point, the ratio of the number of iterations between the first and last occupied bands is assumed to be an accurate indicator of the efficiency of the Sternheimer solver, then using the Schur complement (50) always makes this ratio smaller.

If we want the ratio of the number of iterations between the first and the last occupied bands to be lower than some target ratio \(\xi _T\) (for instance, 3), Fig. 9 suggests that the computable ratio \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) can help in choosing the number of extra bands to reach this target ratio. We propose in Algorithm 1 an adaptive algorithm to select the number of extra bands as a post-processing step after termination of the SCF. The basic idea is that, given the initial output \((\Phi ,\Phi _{\textrm{ex}}^{\ell })\) with \(\ell =0\) of an SCF calculation, one iterates \(\Phi _{\textrm{ex}}^\ell \rightarrow \Phi _{\textrm{ex}}^{\ell +1}\) where \(\Phi _{\textrm{ex}}^{\ell }\) gathers the extra bands. At each iteration \(\ell \), we compute \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) and check if it is below the target ratio. If not, we compute more approximated eigenvectors, that we converge until the residual \(\left\| r_{N+{N_{\textrm{ex}}}}^{\ell } \right\| \) is negligible with respect to \(\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }-\varepsilon _N\), and so on. To generate such a residual, after adding a random extra band properly orthonormalized, we update the extra bands using a LOBPCG with tolerance

$$\begin{aligned} \textrm{tol} = (\varepsilon _{N+{N_{\textrm{ex}}}-1}^{\ell }-\varepsilon _N)/50. \end{aligned}$$
(70)

Note that we use \(\varepsilon _{N+{N_{\textrm{ex}}}-1}^{\ell }\) instead of \(\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }\): this is done for the sake of simplicity, instead of updating the tolerance on the fly with \(\varepsilon _{N+{N_{\textrm{ex}}}}^{\ell }\) changing at each iteration of the LOBPCG.

figure a

1.3 A.3 Numerical tests

We test this strategy on the systems investigated in Sect. 4, with different values for the target ratio \(\xi _T\) in order to see a noticeable improvement for each system. In practice, we suggest this ratio to be between 2 and 3.

We first start with the Al\(_{40}\) system. Figure 9 [Left] suggests that the default choice of extra bands already gives satisfying results by reaching a ratio of approximately 2.5 for all k-points but the \(\Gamma \)-point (for which there is no real issue with the Sternheimer equation, according to Table 1). We thus run Algorithm 1 with a smaller target ratio \(\xi _T=2.2\). We use as initial value for \({N_{\textrm{ex}}}\) the default value for each k-point. Results are plotted in Table 3 [Left] and suggests adding 15 extra bands. Running again the simulations from Sect. 4 with 72 fully converged bands and 18 additional, not fully converged, bands yields indeed an improvement in the convergence of the CG when solving the Sternheimer equation with the Schur complement method. Moreover, in Fig. 10, the ratio \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) indeed lies below the target ratio \(\xi _T=2.2\) and matches this ratio for the k-points that caused difficulties for the Sternheimer equation solver to converge. In terms of computational time, the number of Hamiltonian applications to compute the response has been reduced from \(\sim 14,800\) with the default number of extra bands to \(\sim 12,800\). However, running the algorithm required \(\sim 3,400\) additional Hamiltonian applications, making the total amount of Hamiltonian applications higher than that of the Schur approach with the standard heuristic.

Table 3 Suggested number of extra bands for Al\(_{40}\) and Fe\(_{2}\)MnAl to reach the target ratio \(\xi _T\), obtained with Algorithm 1 with default \({N_{\textrm{ex}}}\) as starting point, as well as the number of iterations to reach convergence with the newly suggested \({N_{\textrm{ex}}}\). Note that the ratio between iterations indeed lies below the target ratio \(\xi _T\)
Fig. 10
figure 10

Comparison between the ratio \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) (\(\times \)) and the ratios of the measured number of iterations between the first and last occupied bands, with (\(\square \)) and without (\(\circ \)) the Schur complement (50). On the x-axis is the index of the k-point. [Left] Al\(_{40}\) with 15 additional extra bands. [Left] Fe\(_{2}\)MnAl spin \(\uparrow \) with 8 additional bands. [Right] Fe\(_{2}\)MnAl spin \(\downarrow \) with 8 additional bands

Similarly, for Fe\(_{2}\)MnAl, we run Algorithm 1 with target ratio \(\xi _T=2.5\) as well as initial value the default \({N_{\textrm{ex}}}\) for all the 140 k-points and spin polarizations. We present in Table 3 [Right] the output for both spin polarizations of two particular k-points. The results are similar for the rest of the k-points and the maximum additional extra bands suggested by the algorithm is 8. We thus run the same simulations as in Sect. 4 but this time with 35 fully converged bands and 11 extra, nonnecessarily converged, bands. We indeed see for these two k-points that the target ratio has been reached, and that the number of iterations to converge is smaller than for the default choice we made in Table 2. In Fig. 10, we plot the ratios \(\xi _{{N_{\textrm{ex}}}}^{\ell }\) as well as the actual ratios and they almost all lie below the target ratio. Contrarily to Al\(_{40}\), we note, however, that the actual measured ratios are not always below the indicator \(\xi _{{N_{\textrm{ex}}}}^{\ell }\). In terms of computational time, the number of Hamiltonian applications has been reduced from \(\sim 208,000\) with the default choice of \({N_{\textrm{ex}}}\) to \(\sim 179,000\). Again, running the algorithm required \(\sim 49,000\) additional Hamiltonian applications, making it more expensive than using the default number of extra bands.

It appears that Algorithm 1 can be used to choose the number of extra bands in order to reach a given ratio \(\xi _T\). However, using the algorithm as such is not useful in practice as it requires a too high number of Hamiltonian applications, making this strategy less interesting than the Schur approach we proposed with the default choice of extra bands. Strategies to reduce the number of Hamiltonian applications in order to choose an appropriate number of extra bands will be subject of future work.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Cancès, E., Herbst, M.F., Kemlin, G. et al. Numerical stability and efficiency of response property calculations in density functional theory. Lett Math Phys 113, 21 (2023). https://doi.org/10.1007/s11005-023-01645-3

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11005-023-01645-3

Keywords

Mathematics Subject Classification

Navigation