Robust Determination of the Chemical Potential in the Pole
Total Page:16
File Type:pdf, Size:1020Kb
Robust determination of the chemical potential in the pole expansion and selected inversion method for solving Kohn-Sham density functional theory Weile Jia, and Lin Lin Citation: The Journal of Chemical Physics 147, 144107 (2017); doi: 10.1063/1.5000255 View online: http://dx.doi.org/10.1063/1.5000255 View Table of Contents: http://aip.scitation.org/toc/jcp/147/14 Published by the American Institute of Physics THE JOURNAL OF CHEMICAL PHYSICS 147, 144107 (2017) Robust determination of the chemical potential in the pole expansion and selected inversion method for solving Kohn-Sham density functional theory Weile Jia1,a) and Lin Lin1,2,b) 1Department of Mathematics, University of California, Berkeley, California 94720, USA 2Computational Research Division, Lawrence Berkeley National Laboratory, Berkeley, California 94720, USA (Received 14 August 2017; accepted 24 September 2017; published online 11 October 2017) Fermi operator expansion (FOE) methods are powerful alternatives to diagonalization type methods for solving Kohn-Sham density functional theory (KSDFT). One example is the pole expansion and selected inversion (PEXSI) method, which approximates the Fermi operator by rational matrix functions and reduces the computational complexity to at most quadratic scaling for solving KSDFT. Unlike diagonalization type methods, the chemical potential often cannot be directly read off from the result of a single step of evaluation of the Fermi operator. Hence multiple evaluations are needed to be sequentially performed to compute the chemical potential to ensure the correct number of electrons within a given tolerance. This hinders the performance of FOE methods in practice. In this paper, we develop an efficient and robust strategy to determine the chemical potential in the context of the PEXSI method. The main idea of the new method is not to find the exact chemical potential at each self-consistent-field (SCF) iteration but to dynamically and rigorously update the upper and lower bounds for the true chemical potential, so that the chemical potential reaches its convergence along the SCF iteration. Instead of evaluating the Fermi operator for multiple times sequentially, our method uses a two-level strategy that evaluates the Fermi operators in parallel. In the regime of full parallelization, the wall clock time of each SCF iteration is always close to the time for one single evaluation of the Fermi operator, even when the initial guess is far away from the converged solution. We demonstrate the effectiveness of the new method using examples with metallic and insulating characters, as well as results from ab initio molecular dynamics. Published by AIP Publishing. https://doi.org/10.1063/1.5000255 I. INTRODUCTION from the diagonal. Among such methods, the Fermi operator expansion (FOE) method11 was also originally proposed as Kohn-Sham density functional theory (KSDFT) is the a linear scaling method for insulating systems. Recently, the most widely used theory for electronic-structure calculations. pole expansion and selected inversion (PEXSI) method, which In the framework of the self-consistent field (SCF) iteration, can be viewed as a FOE method by approximating the Fermi the computational cost for solving KSDFT is mainly deter- operator using rational matrix functions, first achieved com- mined by the cost associated with the evaluation of the electron putational complexity that is at most O(N2) for both insulating density for a given Kohn-Sham potential during each iteration. e and metallic systems.12–14 More specifically, the computa- The most widely used method to perform such an evaluation is tional complexity of PEXSI depends on the dimensionality of to partially or fully diagonalize the Kohn-Sham Hamiltonian, the system: the cost for quasi-1D systems such as nanotubes by means of computing a set of eigenvectors corresponding to is O(N ), i.e., linear scaling; for quasi-2D systems such as the algebraically smallest eigenvalues of the Hamiltonian. The e graphene and surfaces (slabs) it is O(N1.5); and for general 3D complexity of this approach is O(N3), where N is the number e e e bulk systems, it is O(N2). PEXSI can be accurately applied to of electrons in the atomistic system of interest. As the number e general material systems including small gapped systems and of atoms or electrons in the system increases, the cost of this metallic systems and remains accurate at low temperatures. diagonalization step becomes prohibitively expensive. The PEXSI method has a two-level parallelism structure and is In the past two decades, various numerical algorithms by design highly scalable using 10 000 ∼ 100 000 processors have been developed for solving KSDFT without invoking on high performance machines. The PEXSI software pack- the diagonalization procedure. One particular class of algo- age15 has been integrated into a number of electronic structure rithms are the linear scaling algorithms,1–8 which relies on software packages such as BigDFT,16 CP2K,17 SIESTA,18,19 the near-sightedness principle for insulating systems with DGDFT,20,21 FHI-aims,22 and QuantumWise ATK23 and has large gaps9,10 to truncate elements of the density matrix away been used for accelerating materials simulation with more than 10 000 atoms.24,25 a)[email protected] One challenge for the PEXSI method, and for FOE meth- b)[email protected] ods using rational approximations in general, is to determine 0021-9606/2017/147(14)/144107/10/$30.00 147, 144107-1 Published by AIP Publishing. 144107-2 W. Jia and L. Lin J. Chem. Phys. 147, 144107 (2017) the chemical potential µ so that the computed number of elec- In particular, when the SCF converges, the chemical potential trons at each SCF iteration is Ne within some given tolerance. converges as well and there is no loss of accuracy. The key This amounts to solving a scalar equation to achieve this goal is to maintain rigorous lower and upper bounds for the true chemical potential at each SCF step and to N (µ) = N . (1) β e dynamically update the interval along the progress of the SCF Here N β(µ) is the number of electrons evaluated using PEXSI iteration. Due to the availability of these rigorous bounds, the at a given chemical potential and β = 1/(kBT) is the inverse new method does not suffer from the over-correction problem temperature. as in Newton type methods. In the regime of full paralleliza- Note that N β(µ) is a monotonically non-decreasing func- tion, the wall clock time of the new method during each SCF tion with respect to µ, and the simplest strategy to solve iteration is always approximately the same as that for one Eq. (1) is the bisection method. However, starting from a rea- single evaluation of the Fermi operator, even when the ini- sonably large search interval, the bisection method can require tial guess of the chemical potential is far away from the true tens of iterations to converge. This makes it more difficult to solution. reach the crossover point compared to diagonalization type The simplicity provided by the rigorous bounds of the methods and hinders the effectiveness of the method. It also chemical potential also reduces the number of tunable param- introduces potentially large fluctuation in terms of the running eters in the practical implementation of the PEXSI method. time among different SCF iterations. One option to accelerate We find that the remaining parameters are much less sys- the convergence of the bisection method is to use Newton’s tem dependent, and the default values are already robust for method, which takes the derivative information into account both insulating and metallic systems. This facilitates the usage and is expected to converge within a few iterations. However, of the PEXSI package as a black box software package for the effectiveness of Newton’s method relies on the assumption general systems and is therefore more user-friendly. We also that the derivative of N β(µ) with respect to µ does not vanish. compare the pole expansion obtained by an contour integral This assumption fails whenever µ is inside a bandgap. A pos- approach12 and that obtained from an optimization proce- sible remedy is to use a regularized derivative, but this may dure by Moussa recently.26 We find that Moussa’s method instead reduce the convergence rate and increase the number can reduce the number of poles by a factor of 2 ∼ 3 com- of PEXSI evaluations per SCF iteration. Furthermore, when pared to the contour integral approach, and hence we adopt the initial guess is far away from the true chemical poten- this method as the default option for pole expansion. Our tial, the derivative information is not very useful in general. new method is implemented in the PEXSI software package.15 A robust algorithm needs to handle all cases efficiently and For electronic structure calculations, the PEXSI method can find the solution within at most a handful of evaluations start- be accessed more easily from the recently developed “Elec- ing from a possible wild initial guess. Hence the seemingly tronic Structure Infrastructure” (ELSI) software package.27 innocent scalar equation (1) turns out to be not so easy in We demonstrate the performance of the new method using practice. the discontinuous Galerkin DFT (DGDFT) software pack- In Ref. 18, we have proposed a hybrid Newton type age,20,21 using graphene and phospherene as examples for method for determining the chemical potential in the context metallic and insulating systems, respectively. Even though the of the PEXSI method. This method uses an inertia counting chemical potential is not fully accurate in each step of the strategy to rapidly reduce the size of the search interval for the SCF iteration in the new method, we find that the number chemical potential, starting from a large search interval.