WorksPhysics and Astronomy
Gapped-filtering for efficient Chebyshev expansion of the density projection operator
Abstract
We develop the gapped-filtering method, whereby a short Chebyshev expansion accurately represents the density-matrix operator. The method optimizes the Chebyshev coefficients to give the correct density matrix at all energies except within the gapped region where there are no eigenstates. Gapped filtering reduces the number of required terms in the Chebyshev expansion compared to traditional expansion methods, as long as one knows or can determine efficiently the HOMO and LUMO positions. The reduction is especially noticeable (factors of 2-3) when high accuracy is sought. To exemplify the method, we use gapped-filtering to increase the efficiency of stochastic-GW calculations.
Introduction
A fundamental ingredient in many electronic structure and dynamics methodologies is the polynomial expansion of the density matrix operator. Such methods include deterministic approaches to DFT that avoid the direct diagonalization of the Hamiltonian matrix, [1, 2] or allow for fast diagonalization of the Kohn-Sham Hamiltonian [3] when the Hamiltonian is a sparse matrix. These polynomial expansions are also the primary ingredient in stochastic quantum chemistry methods, [4] including stochastic DFT [5, 6, 7] and beyond-DFT approaches. The latter include the linear-scaling stochastic-GW method (sGW) [8] which calculates the quasiparticle (QP) energy as a perturbative correction to the DFT eigenvalue [9, 10, 11, 12], as well as, e.g., stochastic-MP2 [13] stochastic Bethe Salpeter Equation [14] and stochastic Time-Dependent DFT (TDDFT) [15].
In the usual Chebyshev approach [16, 17, 18] the coefficients in the polynomial expansion of the density matrix are obtained analytically by requiring that the scalar function converges uniformly as a function of [17, 18]. In practice, to converge the expansion one usually replaces the sharp Heaviside function with a smoothed one. However, for most systems the gap is small relative to the full energy range of the Hamiltonian operator, so even a smoothed Heaviside function would require typically thousands of terms for convergence.
Here we suggest an alternative to the usual determination of the Chebyshev coefficients. For any desired number of coefficients, we only require that the Chebyshev expansion be correct for energies outside the gap. The logic is that it is immaterial what the values of the polynomial expansion are inside the gap since there are no eigenstates there. Within the gap the filter could have any form, including Gibbs oscillations, but they would be irrelevant to the final density matrix.
In Section II we develop the idea in detail and give a simple prescription, which we label gapped-filtering, for obtaining the Chebyshev coefficients. Numerically, gapped-filtering carries negligible overhead. One just specifies the desired length of the Chebyshev expansion, labeled , and then just inverts a single matrix of rank .
In Section III we numerically study gapped-filtering and show that the method converges rapidly with , which is the only parameter in the approach. The method is more efficient than traditional smoothed filters, where one needs to converge with both a smoothness parameter and . When high accuracy is required, gapped filtering is 2-3 times faster than the traditional approaches.
Section IV presents an application of the method to stochastic-GW, verifying this significant reduction in a large scale calculation. Conclusions are discussed in Section V.
Preprint submitted to Elsevier
Methodology
Gapped-filtering
Ignoring spin, the density matrix, i.e., the projection operator to the occupied manifold, is formally:
where are the eigenvectors of the 1-body Hamiltonian operator and is the number of occupied states. We only consider here systems with a gap where the physical temperature is tiny compared to the gap, i.e., a zero-temperature description.
Even if all eigenstates and eigenvalues are known, the memory required to store the eigenstates could be enormous for giant systems with tens of thousands of electrons. In those cases, it is better to use a polynomial expansion. Thus, the density matrix is equivalent to a Heaviside function of energy centered within the bandgap,
where is the chemical potential. To converge the expansion, a smoothed complementary-error function is typically used:
where is an inverse-temperature-like parameter that determines the sharpness of the function [1, 2, 3].
Note that the square root stems from the fact that in most cases, especially for stochastic quantum chemistry applications, the results of applying the filter are then squared to give the density or Green’s function. Throughout the paper, the analytical filters always refer to this square-root erfc form (abbreviated as sqrt-erfc). Further, we verified that gapped-filtering does analogously well when compared with an erfc filter without a square-root.
To apply the filter, the Chebyshev polynomial expansion is traditionally used:
where the expansion coefficients, , depend on and and which is the n’th order Chebyshev polynomial of the first kind. The argument of the Chebyshev function is a scaled Hamiltonian, , [17, 19] where the and parameters are the center and half-width of the spectrum of , so that the eigenvalues of are between -1 and 1. The length of the expansion, , is approximately proportional to , times a factor which depends on the relative position of relative to the spectrum bottom, . (Qualitatively that factor accounts for the “stretching” of the angle near the band bottom, where and becomes large. For a fuller discussion see [20].)
Usually the coefficients are determined by requiring that the expansion in Eq. (4) is valid uniformly over all between the minimum and maximum eigenvalues of . Due to the orthogonality of the Chebyshev polynomials, the coefficients are then simply:
where is the Chebyshev weighting function and we introduced the scaled chemical potential, .
Here we exploit a simple realization: because there are no states within the bandgap, the behavior of the expansion within the gap does not impact the density matrix. What is important is that the expansion is 1 for the occupied states and 0 for the unoccupied states, regardless of its values within the bandgap. As we show below, the increased flexibility, as the expansion is free to vary within the bandgap, suffices to reduce the number of polynomials for a given desired level of numerical accuracy.
Our derivation starts by defining a modified weighting function that vanishes within the scaled bandgap:
where the scaled energies are
where and are the HOMO and LUMO energies, while is a small padding factor, which we usually take to be about 1% of the scaled bandgap. This padding ensures that the weighting function does not go to 1/0 at exactly the HOMO/LUMO energies, thereby allowing for any uncertainties in the values of the HOMO/LUMO energies.
Since the weighting function is zero within the gap, we call the resulting method gapped-filtering, and the associated Chebyshev expansion gapped-filter. As the Chebyshev polynomials are not orthogonal under this weighting function, the coefficients need to be rederived. This is done by minimizing the norm squared of the difference between the Heaviside function and the Chebyshev expansion, weighted now by :
Minimizing with respect to gives:
i.e., , where
and
The matrix elements are easily calculated. Defining , we get:
where
where , and
Similarly,
where .
Additional considerations
We now discuss several issues associated with the method.
HOMO/LUMO determination: Our method requires knowledge of the HOMO/LUMO energies associated with the one-body Hamiltonian . In situations where these are not accurately given, it will often be worthwhile to do a single longer Chebyshev propagation to determine accurately, by filtering, the location of the HOMO and LUMO. For example, in stochastic GW the gapped filter will be applied thousands of times, so the initial overhead for finding the HOMO/LUMO energies by a narrow Chebyshev filter will be often small compared to the savings incurred by the subsequent use of gapped filtering in sGW.
The same considerations would also be true in DFT applications that rely on Chebyshev filtering, as long as the overall number of vectors on which one needs to apply Chebyshev filtering is much larger than 1, so that in each SCF step the extra overhead in a single long Chebyshev to determine the HOMO and LUMO would be negligible compared to the overall cost needed to filter all the required states.
HOMO/LUMO accuracy: Note that formally the HOMO and LUMO energies that are used need to be lower and upper bounds to the true HOMO and LUMO, but since the method is continuous even a small (circa 5% or less) deviation in the wrong direction (e.g., an applied HOMO energy which is higher than the true HOMO by about 2-3% of the gap, and analogously for the LUMO) still gives excellent results, as we verified.
Correlation function: Also note that when one is just looking for a correlation function, involving a matrix element of the density of state (rather than the full filtered function, Eq. (3)), then the total number of residues is halved by using simple trigonometric identities, e.g., where (see Eq. 3.10 in [21]). This reduction by a half is valid for both the regular Chebyshev approaches and for gapped filtering, so it does not change the relative performance of the approaches.
Filter design: To conclude this section, note that the problem we specifically try to solve, an optimum Chebyshev filter where we do not care what happens inside the gap, could be viewed as a specific subproblem of digital filter design [22, 23].
Gapped-filtering convergence study
We now turn to a numerical study of the new method. We use the band gap and energy width from an LDA calculation of Naphthalene. The calculations are detailed in the next section, but the relevant part here is that the gap is Hartree, the spectrum width is 13.5 Hartree, and the scaled HOMO/LUMO energies are and i.e., a scaled gap of .
In Figure 1 we show, for an expansion length of , the improved performance of gapped filter over the traditional approaches. We specifically plot as a function of the scaled energy , the numerical representation of (i.e., the RHS of Eq. (4)) at several values. As expected, convergence is faster for a lower , but if is too low then the analytic sqrt-erfc function deviates too much from the desired step function.
Figure 1. Gapped-filtering vs. various sqrt-erfc filters, using a Chebyshev expansion with polynomials, as a function of the scaled energy, . Naphthalene parameters are used ( Hartree, Hartree). The highlighted grey area denotes the gap region where the expansion need not be optimized. Note that is always reported in inverse Hartree, so, for example, for Hartree the product of with the gap is quite small, .
As a side note, a common approach [24] to avoid Gibbs oscillations is to multiply the Chebyshev coefficients by a filter, , where falls smoothly to almost 0 at . This is shown in Figure 2 (constructed for , like Figure 1), using the popular Jackson filter [24]. But while smoothing of the analytic coefficients does remove the Gibbs oscillations, this comes however at the expense of making the filter wider, so it is even further from the true step function filter.
Figure 2. Analogous to Fig. 1 but now the analytical coefficients are damped using the commonly used Jackson kernel coefficients to avoid a sharp cut at . While the Gibbs oscillations are damped the step function is even further widened, i.e., gets further from the analytical step function demonstrating that just damping the analytical coefficients is not sufficient.
The difference in Figure 1 at between the numerical representations and the desired step function is detailed in Figure 3. Interestingly, at this the gapped filter is also smooth inside the gap (gray region in Figure 1) even though the gapped-filtering method does not yet explicitly optimize the behaviour of the filter there. (Note: for very high which are irrelevant, , gapped-filtering does show Gibbs oscillations inside the gap.)
Figure 3. Analogous to Figure 1, but showing, away from the gap, the differences between the Chebyshev expansions and an exact step function.
In Figure 4 we show, again at , the expansion coefficients, , as a function of . The magnitude of the gapped-filtering coefficients decreases at a much faster rate than that of the traditional coefficients. The faster drop-off leads to a smoother expansion and therefore to less oscillations.
Figure 4. The absolute value of the expansion coefficients for for the gapped and traditional (sqrt-erfc) filters.
We now turn to an analysis of the performance of the gapped-filtering approach as a function of the number of Chebyshev polynomials. Figure 5 shows, as a function of , the maximum (over all energies outside the gap) of the absolute difference between Eq. (4) and Eq. (2) at several values. The relative advantage of gapped filtering is more pronounced when higher accuracy is sought, i.e., at larger . Thus small values (in our case or Hartree) require a small number of Chebyshev polynomials for convergence, that rivals the number in gapped-filtering. However, for such small values the analytical sqrt-error function deviates significantly from the desired step function, so that the error would be high at any value of . In contrast, a more accurate representation of the step function with small error requires a much larger number of polynomials for sqrt-erfc filters (see here the graphs for Hartree) than in gapped filtering.
Figure 5. The maximum, taken over all energies outside the bandgap, of the absolute value of the difference between the step function and its Chebyshev expansion (the RHS of Eq. (4)). The figure is plotted as a function of the number of Chebyshev terms, . Note that smoother low- filters converge initially faster but then their error reaches quickly a high plateau.
A technical point is that for very large , some of eigenvalues of will be close to zero; this would lead to round-off errors in the matrix inversion, which in our case would deteriorate the accuracy of the gapped filter when the maximum error is on the order of , i.e., beyond . We avoid such errors using, for such large , quadruple precision in calculating the coefficients (i.e., for yielding and , and then for inverting using a quadruple precision algorithm [25, 26]). Because the dimensions of are and is typically on the order of , this inversion has negligible cost. (To clarify, the coefficients are then well-behaved and are used in the usual double-precision Chebyshev algorithm, i.e., quadruple precision is only used to determine the coefficients.)
An advantage of gapped-filtering is that it avoids the use of an artificial temperature parameter, . We only need to worry about a single convergence parameter, , unlike the usual procedure of converging with respect to two parameters, and .
Application: stochastic-GW
Filtering in stochastic-GW
The polynomial expansion of the Chebyshev operator is crucial for our stochastic quantum chemistry approaches. Here we overview the relevant parts for one such method, stochastic-GW. Only the parts of the method where
see Refs. [8, 12] for further details. The stochastic-GW method, in its simplest version, calculates the HOMO (or LUMO) quasiparticle energy in the diagonal approximation , i.e., based on the HOMO/LUMO DFT eigenvector whose associated eigenvalue is modified.
Stochastic-GW has two filtering stages. First, one does a stochastic realization of . For each such realization, one takes an initially random white noise orbital , i.e., in a grid representation (or an analogous expression in a basis-set description). Then, the white noise orbital is filtered with the Heaviside operator to generate a function which contains only occupied states (with random coefficients):
We interchangeably label such a function as a stochastic occupied orbital, or more simply a filtered orbital.
Each such filtered function is then propagated in time under ; the correlation function of the result with equals the negative-time Green’s function, . The positive-time Green’s function is obtained analogously. The curly brackets indicate a statistical average over the stochastic orbitals. Typically we use to 2000 different random white noise functions. Fewer samples are needed for larger systems due to self-averaging.
Then, for each such stochastic realization of (i.e., for each ), one calculates the action of the time-dependent effective interaction on a vector related to . This is done by choosing, for each , several () white noise vectors, labeled , . These vectors are also filtered, . This set of filtered orbitals are then excited and propagated in time, under a time-dependent Hartree Hamiltonian . The crucial part of the evolution Hamiltonian, which also gives the action of , comes from the Hartree potential due to the time-dependent density
where is obtained by slightly ”kicking” the filtered orbital (for further details see Refs. [13, 15]). Note that we consider closed shell systems so the factor of 2 due to spin was restored here.
The sGW formalism is efficient since very few orbitals (typically , and less for larger systems) are needed to describe the response of molecules and solid-state systems within the short few-fs time for which is needed. Still, a total of – filtering projections is required, therefore motivating the use of the proposed gapped-filtering approach.
Gapped-filtering for stochastic-GW
We now demonstrate gapped-filtering in an sGW study of naphthalene. All calculations use stochastic samplings of , which gives the quasiparticle energy to within a statistical error of eV.
The DFT Hamiltonian uses the LDA exchange-correlation functional with Troullier-Martins norm-conserving pseudo-potentials [27]. The grid employed has points with a grid spacing of 0.5 Bohr. As mentioned, the DFT bandgap for naphthalene is then eV, i.e., 0.123 Hartree, while the spectrum half-width is 13.5 Hartree, i.e., 110 times higher than the bandgap.
Figure 6 shows the resulting HOMO QP energies for gapped-filtering and for the traditional filtering method from Eq. (4) at and . The statistical errors barely change with , so we do not show them in the figure.
Figure 6. The stochastic-GW quasiparticle energy of naphthalene, , as a function of the number of Chebyshev polynomials, , using gapped-filtering and sqrt-erfc filters with and . Gapped-filtering converges to the asymptotic QP energy at much lower than the traditional sqrt-erfc filters.
The figure shows that gapped-filtering requires very few Chebyshev terms. Thus, to have a systematic error of 0.015 eV or better, is sufficient for gapped-filtering.
Conclusions
In conclusion, our work has shown that, for gapped systems, a step-function filter in energy is best done by optimizing the Chebyshev coefficients to fit the gapped spectrum only, rather than using a smooth filter and unnecessarily fitting the irrelevant gapped region.
The final algorithm is very easy to adopt for practical systems. Given the HOMO/LUMO energies and the spectrum overall min/max energies, one should specify an acceptable tolerance of the deviation from the step function, and then do a similar calculation the red line in Figure 5 to extract the corresponding number of terms. With our parameters we find an acceptable tolerance at about , but this factor could be somewhat different depending on the application and the location of the gap relative to the spectrum minima. Our results would have immediate implication on cases such as sGW, where traditional Chebyshev filtering is expensive and the simpler alternative, explicit projection by (see Ref. [12]), requires for large systems huge memory for storing all the occupied eigenstates.
Finally, our work indicates that when there is at least partial knowledge of the system spectrum, a polynomial expansion could be made more efficient than an expansion which is designed to be uniformly convergent as a function of energy.
CRediT authorship contribution statement
Minh Nguyen: Investigation, Writing - Original Draft, Software, Visualization. Daniel Neuhauser: Conceptualization, Methodology, Supervision, Writing - Review & Editing, Funding acquisition
Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Data Availability Statement
The data that support the findings of this study are available from the corresponding author upon reasonable request.
Acknowledgements
We are grateful to Nadine Bradbury for useful discussions. This paper was supported by the Center for Computational Study of Excited State Phenomena in Energy Materials (C2SEPEM), which is funded by the U.S. Department of Energy, Office of Science, Basic Energy Sciences, Materials Sciences and Engineering Division via Contract No. DE-AC02-05CH11231, as part of the Computational Materials Sciences Program. Computational resources were supplied through the XSEDE allocation TG-CHE170058, and theNERSC project m4022.
This figure "expansion_with_jackson.jpeg" is available in "jpeg" format from:
http://arxiv.org/ps/2206.01187v3
References
- [1]R. Baer, M. Head-Gordon, Chebyshev expansion methods for electronic structure calculations on large molecular systems, The Journal of Chemical Physics 107 (1997) 10003–10013.DOI
- [2]L. O. Jay, H. Kim, Y. Saad, J. R. Chelikowsky, Electronic structure calculations for plane-wave codes without diagonalization, Computer Physics Communications 118 (1999) 21–30.DOI
- [3]W. Liang, C. Saravanan, Y. Shao, R. Baer, A. T. Bell, M. Head-Gordon, Improved Fermi operator expansion methods for fast electronic structure calculations, The Journal of Chemical Physics 119 (2003) 4117–4125.DOI
- [4]O. F. Sankey, D. A. Drabold, A. Gibson, Projected random vectors and the recursion method in the electronic-structure problem, Physical Review B 50 (1994) 1376.pubmed.ncbi.nlm.nih.gov/9976322
- [5]R. Baer, D. Neuhauser, E. Rabani, Self-averaging stochastic Kohn-Sham density-functional theory, Physical Review Letters 111 (2013) 106402.DOI
- [6]D. Neuhauser, R. Baer, E. Rabani, Embedded fragment stochastic density functional theory, Journal of Chemical Physics 141 (2014) 041102.DOI
- [7]R. Baer, D. Neuhauser, E. Rabani, Stochastic vector techniques in ground-state electronic structure, Annual Review of Physical Chemistry 73 (2022).DOI
- [8]D. Neuhauser, Y. Gao, C. Arntsen, C. Karshenas, E. Rabani, R. Baer, Breaking the theoretical scaling limit for predicting quasiparticle energies: The stochastic GW approach, Physical Review Letters 113 (2014) 076402.pubmed.ncbi.nlm.nih.gov/25170715
- [9]C. Friedrich, A. Schindlmayr, Many-body perturbation theory: the GW approximation, NlC Series 31 (2006) 335.
- [10]M. S. Hybertsen, S. G. Louie, Electron correlation in semiconductors and insulators: Band gaps and quasiparticle energies, Physical Review B 34 (1986) 5390.pubmed.ncbi.nlm.nih.gov/9940372
- [11]V. Vlcek, Stochastic many-body methods for quasiparticle excitations in realistic nanoscale systems, Bulletin of the American Physical Society 66 (2021).
- [12]V. Vlček, W. Li, R. Baer, E. Rabani, D. Neuhauser, Swift GW beyond 10,000 electrons using sparse stochastic compression, Physical Review B 98 (2018) 075107.DOI
- [13]D. Neuhauser, E. Rabani, R. Baer, Expeditious stochastic approach for MP2 energies in large electronic systems, Journal of Chemical Theory and Computation 9 (2013) 24–27.arxiv.org/abs/1210.8279
- [14]N. Bradbury, M. Nguyen, J. R. Caram, D. Neuhauser, Bethe Salpeter Equation spectra for very large systems, arXiv:2205.06690 (2022).DOI
- [15]Y. Gao, D. Neuhauser, R. Baer, E. Rabani, Sublinear scaling for time-dependent stochastic density functional theory, The Journal of Chemical Physics 142 (2015) 034106.DOI
- [16]H. Tal-Ezer, R. Kosloff, An accurate and efficient scheme for propagating the time dependent Schrödinger equation, The Journal of Chemical Physics 81 (1984) 3967–3971. URL: https://doi.org/10.1063/1.448136. doi:10.1063/1.448136.
- [17]R. Kosloff, Time-dependent quantum-mechanical methods for molecular dynamics, The Journal of Physical Chemistry 92 (1988) 2087–2100.DOI
- [18]A. Weiße, G. Wellein, A. Alvermann, H. Fehske, The kernel polynomial method, Reviews of Modern Physics 78 (2006) 275–306. URL: https://link.aps.org/doi/10.1103/RevModPhys.78.275. doi:10.1103/RevModPhys.78.275.
- [19]V. Mandelstam, T. Ravuri, H. Taylor, Calculation of the density of resonance states using the stabilization method, Physical Review Letters 70 (1993) 1932.pubmed.ncbi.nlm.nih.gov/10053423
- [20]P. Suryanarayana, On spectral quadrature for linear-scaling density functional theory, Chemical Physics Letters 584 (2013) 182–187. doi:10.1016/j.cplett.2013.08.035.DOI
- [21]M. R. Wall, D. Neuhauser, Extraction, through filter-diagonalization, of general quantum eigenvalues or classical normal mode frequencies from a small number of residues or a short-time segment of a signal. i. theory and application to a quantum-dynamics model, The Journal of Chemical Physics 102 (1995) 8011–8022. doi:10.1063/1.468999.DOI
- [22]J. McClellan, T. Parks, L. Rabiner, A computer program for designing optimum fir linear phase digital filters, IEEE Transactions on Audio and Electroacoustics 21 (1973) 506–526. doi:10.1109/TAU.1973.1162525.DOI
- [23]T. W. Parks, C. S. Burrus, Digital Filter Design, J. Wiley, 1987.
- [24]A. Weiße, G. Wellein, A. Alvermann, H. Fehske, The kernel polynomial method, Reviews of Modern Physics 78 (2006) 275–306. doi:10.1103/revmodphys.78.275.
- [25]J. J. Dongarra, C. B. Moler, J. R. Bunch, G. W. Stewart, LINPACK users’ guide, SIAM, 1979.
- [26]C. L. Lawson, R. J. Hanson, D. R. Kincaid, F. T. Krogh, Basic linear algebra subprograms for fortran usage, ACM Transactions on Mathematical Software (TOMS) 5 (1979) 308–323.DOI
- [27]D. Hamann, Optimized norm-conserving Vanderbilt pseudopotentials, Physical Review B 88 (2013) 085117.DOI
AI tools statement
No AI-use declaration is available for this version in Valency.
The available record does not establish whether AI systems or models contributed to this work.