Direct Energy Minimization Based on Exponential Transformation in Density Functional Calculations of Finite and Extended Systems - arXiv

Page created by Bradley Martinez
 
CONTINUE READING
Direct Energy Minimization Based on Exponential
                                                    Transformation in Density Functional Calculations of
arXiv:2101.12597v2 [physics.comp-ph] 17 May 2021

                                                               Finite and Extended Systems

                                                       Aleksei V. Ivanova,b , Elvar Ö. Jónssona , Tejs Veggec , Hannes Jónssona
                                                      a Science Institute and Faculty of Physical Sciences, University of Iceland VR-III,107
                                                                                          Reykjavı́k, Iceland
                                                                  b St. Petersburg State University, 199034, St. Petersburg, Russia
                                                      c   Department of Energy Conversion and Storage, Technical University of Denmark,
                                                                                   DK-2800 Kgs. Lyngby, Denmark

                                                   Abstract
                                                   The energy minimization involved in density functional calculations of electronic
                                                   systems can be carried out using an exponential transformation that preserves
                                                   the orthonormality of the orbitals. The energy of the system is then repre-
                                                   sented as a function of the elements of a skew-Hermitian matrix that can be
                                                   optimized directly using unconstrained minimization methods. An implementa-
                                                   tion based on the limited memory Broyden-Fletcher-Goldfarb-Shanno approach
                                                   with inexact line search and a preconditioner is presented and the performance
                                                   compared with that of the commonly used self-consistent field approach. Re-
                                                   sults are presented for the G2 set of 148 molecules, liquid water configurations
                                                   with up to 576 molecules and some insulating crystals. A general preconditioner
                                                   is presented that is applicable to systems with fractional orbital occupation as
                                                   is, for example, needed in the k-point sampling for periodic systems. This ex-
                                                   ponential transformation direct minimization approach is found to outperform
                                                   the standard implementation of the self-consistent field approach in that all the
                                                   calculations converge with the same set of parameter values and it requires less
                                                   computational effort on average. The formulation of the exponential transfor-
                                                   mation and the gradients of the energy presented here are quite general and
                                                   can be applied to energy functionals that are not unitary invariant such as
                                                   self-interaction corrected functionals.

                                                   1. Introduction

                                                       There are several different approaches for finding optimal orbitals corre-
                                                   sponding to the minimum of an energy functional in the context of Kohn–Sham
                                                   density functional theory (KS-DFT) [1, 2]. The most commonly used method
                                                   is based on a self-consistent field (SCF) algorithm consisting of two steps. In

                                                      Email addresses: alxvov@gmail.com (Aleksei V. Ivanov), hj@hi.is (Hannes Jónsson)

                                                   Preprint submitted to Computer Physics Communications                         May 18, 2021
the first step and for a given density, one finds eigenvalues and eigenfunctions
using an iterative algorithm such as the Davidson algorithm [3] or even direct
diagonalization of the full Hamiltonian matrix when the size of the basis set is
not too large. In the second step, the electron density or Hamiltonian matrix
is updated using, for example, direct inversion in the iterative subspace (DIIS)
method [4, 5]. The SCF approach is widely used and has proven to be efficient
for both finite (molecules/clusters) and extended systems, but can, neverthe-
less, suffer from convergence problems. Various density and Hamiltonian mixing
schemes have been introduced to address such cases [6, 7]. As a result, the user
of typical software developed for KS-DFT calculations is often presented with
the task of choosing values of various parameters and select between various
types of eigensolvers. Systems with similar chemical and physical properties
may even call for different choices. A further problem of the SCF method in
calculations of ground electronic states is that it may converge on a saddle point
of the energy surface rather than a minimum [8].
    Another approach to this optimization problem is based on direct minimiza-
tion of the energy with respect to the electronic degrees of freedom [9, 10, 11,
12, 13, 14, 15, 16, 17, 18]. The challenge then is to incorporate the constraint
of orthonormality of the orbitals (the single electron wave functions). One way
to approach this is to follow the energy gradient projected on the subspace tan-
gent to the orbitals [10, 11]. After such an adjustment of the orbitals within
this tangent space, the orthonormality constraints will be violated and, there-
fore, an explicit orthonormalization of the orbitals needs to be applied after
each iteration. This approach is often used in calculations with a plane wave
basis set. Alternatively, when the basis set is compact, as in calculations using
linear combination of atomic orbitals, a unitary transformation can be applied
to a set of orthonormal reference orbitals that includes all occupied and virtual
orbitals, and the energy is then minimized by optimizing the elements of the
transformation matrix. The orthonormality constraints will then be satisfied,
but, due to the constraints imposed by the unitary matrix, the energy is defined
on a curved space. As a result, minimization algorithms need to be modified
to take the curvature into account. This can be achieved by performing a line
search along geodesics [19]. Alternatively, the unitary matrix can be parame-
terized using an exponential transformation [9, 12, 14] in which case the energy
becomes a function of the elements of a skew-Hermitian matrix in linear space.
Well-established, unconstrained minimization strategies can then be applied in-
cluding inexact line searches that can give robust convergence. We will refer
to this approach as exponential transformation direct minimization (ETDM).
Furthermore, it has been used in calculations of molecules using KS-DFT [15]
and previously in the context of Hartree-Fock theory [9, 20, 21, 22]. There, the
occupation numbers for the orbitals have been restricted to integers so that uni-
tary invariance with respect to rotation within the space of occupied orbitals is
ensured. Preconditioners to accelerate convergence have been presented for such
systems and found to be important in order to achieve good performance [9, 15].
    In this article, a generalization and efficient implementation of the ETDM
approach is presented as well as applications to both finite and extended sys-

                                        2
tems. The method can be applied to systems with fractional occupation, for
example, where k-point sampling of the Brillouine zone (BZ) is carried out. The
formulation presented here is also applicable to energy functionals that are not
unitary invariant, such as self-interaction corrected functionals [23]. Tests of
the performance of this ETDM implementation and comparison with the SCF
method including density mixing are carried out for the G2 set (a total of 148
molecules), liquid configurations consisting of up to 576 water molecules and
several insulating crystals.
    The article is organised as follows. In section 2, the ETDM method is for-
mulated in a general way and equations provided for the derivative of the en-
ergy with respect to the matrix elements in the exponential transformation. In
section 3, an efficient preconditioner is presented, applicable to systems with
non-integer occupation numbers, as well as methods for evaluating the gradient
of the energy and ways to choose the search direction as well as step-length
in an inexact line-search procedure. In section 4, performance tests are pre-
sented with comparison to conventional SCF calculations. Finally, discussion
and conclusions are presented in section 5.

2. General formulation

   In KS-DFT, the energy functional is
                                           2
                              3 |∇φik (r)|
                X         Z                      Z
           E=       fi (k) d r                + d3 rρ(r)vext (r)+
                                    2
                i,k
                             1               ρ(r)ρ(r′ )
                               ZZ
                           +      d3 r d3 r′            + Exc [ρ(r)].        (1)
                             2                |r − r′ |

where the φ are orbitals of the non-interacting electron system that has total
electron density                  X
                           ρ(r) =    fi (k)|φik (r)|2 ,                    (2)
                                      i,k

equal to that of the interacting electron system, the fi (k) are orbital occupa-
tion numbers for the k-th point of the BZ with 0 ≤ fi (k) ≤ 1, vext (r) is the
external potential corresponding to electron-nuclei interaction, and Exc is the
exchange-correlation energy. The orbitals are expanded in terms of a possibly
non-orthogonal basis set consisting of M basis functions
                                      M
                                      X
                          φik (r) =         Oµi (k)χµk (r),                  (3)
                                      µ=1

and the task is to find optimal values of the coefficients Oµi (k) that minimize
the energy E[{O(k)}k ] subject to the orthonormality constraints:

                         O† (k)S(k)O(k) = I         k ∈ BZ,                  (4)

                                            3
with Sµν (k) = χ∗µk (r)χνk (r) dr being the overlap matrix.
               R

   The basis functions for periodic systems are Bloch states and in a localised
basis set approach they can be written as
                             1 X
                  χµk (r) = √    exp(ik · R)ηµ (r − R − dµ )                         (5)
                             N R

where ηµ (r − R − dµ ) is an atomic orbital centered on an atom in the simulated
cell. The subscript µ enumerates the atomic orbitals and R belongs to the Bra-
vais lattice. An initial guess for the orbitals is expressed as a linear combination
of the basis functions
                                       X
                          ψmk (r) =         Cµm (k)χµk (r).                      (6)
                                        µ=1..M

    Given an initial guess for the orbitals, Cµm (k), which we will refer to as the
reference orbitals, the optimal orbital coefficients Oµm (k) that provide minimal
energy can be found through a unitary transformation as

                                    O(k) = C(k)eA(k)                                 (7)

where A(k) is a skew-Hermitian matrix, A(k)† = −A(k). For a set of Nk vectors
used to represent the BZ, a set of matrices {A(k)}k is needed. For a given set
of reference orbitals, a set of unitary matrices, U (k) = exp(A(k)), exists so
that the reference orbitals are transformed to the optimal orbitals. Thus, the
ground-state energy of the system is a function of the upper triangular elements
of a set of matrices A(k),

               E[n] = E[{a11 , . . . , a1M , a22 , . . . , a2M , . . . , aMM }k ]    (8)

where aij = (A)ij and k denotes the set of Nk vectors. The real part of the
diagonal elements of the matrices are zeros and therefore, the energy is a function
of Nk M 2 variables. There are M (M − 1)/2 real elements and M (M + 1)/2
imaginary elements for every k-point. The energy needs to be minimized with
respect to the real and imaginary parts of the matrix elements {aij (k)}i≤j .
Introducing the derivative
                                                              
                     ∂      1          ∂               ∂
                          =                   −i                                (9)
                 ∂aij (k)   2 ∂Re(aij (k))        ∂Im(aij (k))

the gradient of the energy can be evaluated as
                              ∂E       X          ∂ρµν (k)
                                     =    Hµν (k)                                   (10)
                            ∂aij (k)   µν
                                                  ∂aij (k)

where the Hamiltonian matrix is
                                            
                                    1 2
                        Z
                                ∗
              Hµν (k) = dr χµk (r) − ∇ + v(r) χνk (r).                              (11)
                                    2

                                               4
Here, v(r) is the single electron Kohn-Sham potential, and the density matrix
is given in terms of the optimal coefficient matrix as
                                 X
                       ρµν (k) =    fm (k)Oµm (k)O νm (k).               (12)
                                            m

By defining the commutator

                                 Lmk (k) = [F (k), H(k)]mk ,                            (13)

where H(k) is the Hamiltonian matrix represented in terms of the optimal
orbitals                    X
                  H(k)mk =     Oµm (k)Hµν (k)Oνk (k),
                                            µν

and F (k) is a diagonal matrix with occupation numbers fm (k) as diagonal
elements, the derivatives in Eq. (10) can be written as
                                   Z 1                       
                  ∂E       2 − δij
                        =               etA(k) L(k)e−tA(k) dt     .  (14)
               ∂aij (k)       2       0                        ji

For the optimal orbitals, the gradient ∂E/∂aij (k) must be zero so
                   Z 1
                       etA(k) L(k)e−tA(k) dt = 0, k ∈ BZ.                               (15)
                         0

These non-linear equations can be used to find the skew-Hermitian matrix that
provides the energy minimum. For the remainder of this article, the k-point
index k is omitted for simplicity.
    Eq. (14) is general and can be applied to an objective function that depends
explicitly on the orbitals as well as the total density, but then the definition of
L needs to be be changed accordingly. For example, for the Perdew-Zunger self-
interaction correction (PZ-SIC) [23], the matrix L for a single k-point calculation
is
                       Lmk = [F, H]mk + fk V km − fm Vmk ,                     (16)
where Vkm is a matrix element of the SIC potential:
                  X
                             k
            Vmk =      O µm Vµν Oνk ,                                                   (17)
                     µν

                                                     ρk (r′ )
                     Z                 Z                                 
              k
             Vµν =           χ∗µ (r)        d3 r′             + v  (ρ
                                                                 xc k (r))  χν (r)dr.   (18)
                                                    |r − r′ |
   Equation (15) can be expanded in a series as
            Z 1
                                   1           1
                etA Le−tA dt = L + [A, L] + [A, [A, L]] + . . .                         (19)
              0                   2!          3!

If kLk ≫ 12 k [A, L] k, then the first term on the right hand side can be used
to estimate the gradient. This limit of ‘small rotations’ corresponds to the

                                                       5
geometric approach used by Van Voorhis and Head-Gordon [15] and has also
been used in the context of orbital-density dependent functionals [24, 25, 26].
The higher order terms can also be included to increase the accuracy of the
gradient estimate, but each iteration then requires more computational effort.
   The minimization procedure is performed with respect to the real and imag-
inary parts of matrix elements using the energy gradient given by Eq. (14)
                                                  
                               ∂E             ∂E
                                     = 2Re                                 (20)
                           ∂Re(aij )          ∂aij
and                                                         
                              ∂E                      ∂E
                                      = −2Im                     .              (21)
                            ∂Im(aij )                 ∂aij
Computational algorithms for the evaluation of the the matrix exponential and
gradient of the energy are presented in Sec. 3.4

3. Algorithms and Computational Parameters
   In order to find the optimal orbitals, O, corresponding to minimal energy,
the appropriate exponential transformation of the reference orbitals, C,
                                       O = CeA                                  (22)
needs to be determined. The reference orbitals can be chosen to be any set of
orthonormal orbitals spanned by the basis set and they are held fixed during the
minimization of the energy for a given number of steps while only the matrix A
is varied. The closer the reference orbitals are to the optimal orbitals, the faster
the iterative procedure will converge.
    A line search method has been implemented where the (k + 1)th iteration
step is
                            ~a (k+1) = ~a (k) + α (k) ~p (k) .                  (23)
Here, ~a (k+1) is a vector consisting of the real and imaginary part of the upper
triangular elements of matrix A at the kth step of the minimization algorithm,
             ~a = (Re(a12 ), . . . , Re(a1M ),
                   Re(a23 ), . . . , Re(a2M ), . . . , Re(aM−1M ),
                                                                                (24)
                   Im(a11 ), Im(a12 ), . . . , Im(a1M ),
                   Im(a22 ), Im(a23 ), . . . , Im(a2M ), . . . , Im(aMM ))T ,

and p~ (k) is the search direction while α(k) is the step length.

3.1. Choice of search direction
    The search direction can be chosen according to the steepest descent method,
various Quasi-Newton methods, or nonlinear conjugate gradient (CG) meth-
ods. The calculation of the search direction involves algebraic operations asso-
ciated with the particular method plus the evaluation of the energy and gra-
dient for the given energy functional. The dimensionality of the minimization

                                            6
problem scales as N M , where N is the number of occupied orbitals and M
is the number of basis functions. While Quasi-Newton methods such as the
Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm require fewer iterations
than limited-memory BFGS (L-BFGS) or CG, the algebraic operations become
a bottleneck even for systems of moderate size (the BFGS algorithm scales as
O(N 2 M 2 ) [27]). However, every iteration of the L-BFGS algorithm, in which
the approximate inverse Hessian matrix is updated, can be computed with the
cost of O(mN M ) operations, where m is the number of previous steps stored
in memory. In the present implementation, the L-BFGS algorithm as described
in Ref. [27] is used and m = 3 in the benchmark calculations.

3.2. Choice of step length
    The step length α(k) is chosen in such a way that it satisfies the strong Wolfe
conditions [28, 29, 27]

              E(~a (k) + α (k) p~ (k) ) ≤ E(~a (k) ) + c1 α (k) ∇~a E(~a (k) ) · ~p (k)       (25)

and

                 |∇E(~a (k) + α (k) ~p (k) ) · p~ (k) | ≤ c2 |∇~a E(~a (k) ) · p~ (k) |       (26)

with 0 < c1 < c2 < 1. A trial step of α (k) = 1 is always used first to test
the conditions. After several iterations, a step length of 1 guarantees that the
strong Wolfe conditions are satisfied in the L-BFGS algorithm [27]. This is ap-
pealing since it reduces the number of energy and gradient calculations which
are computationally most intensive in KS-DFT calculations. If α (k) = 1 is not
satisfied by the strong Wolfe conditions, then the inexact line search based on
the interpolation of the energy along the search direction is used [27]. When the
energy of the system is evaluated, the KS-DFT potential needs to be obtained
and, as a result, there is little additional effort involved in evaluating the gra-
dient. Therefore, the energy along the search direction is always interpolated
by a cubic function using information about the energy values and gradient at
the boundaries of the search interval [a, b]. Alongside the strong Wolfe condi-
tions, approximate Wolfe conditions are also checked [30] at the minimum of
the interpolated cubic function

 (2δ − 1)∇~a E(~a (k) )T ~
                         p (k) ≥ ∇~a E(~a (k) + α (k) p~ (k) ) · ~p (k) ≥ σ∇~a E(~a (k) ) · ~p (k) ,
                                                                                               (27)
and the condition

                       E(~a (k) + α (k) ~p (k) ) ≤ E(~a (k) ) + ǫ|E(~a (k) )|                 (28)

where δ < min{0.5, σ}, 0 < σ < 1 and ǫ is a small fixed number. Thus, the
line search algorithm is terminated when either the strong Wolfe conditions of
Eqs. (25)-(26) or the approximate Wolfe conditions of Eq. (27) along with the
condition in Eq (28) holds. The parameter values are set to [27, 30]

                     c1 = 10−4 , c2 = 0.9, δ = 0.1, σ = 0.9, ǫ = 10−6 .                       (29)

                                                   7
3.3. Preconditioning
    A preconditioner speeds up convergence of this iterative algorithm. It is con-
structed as the inverse of an approximate Hessian matrix that can be obtained
by taking the derivative of a linear expansion of the gradient (Eq. (14)) with re-
spect to the skew-Hermitian matrix, and neglecting first order derivatives of the
effective potential. Neglecting the first order derivatives of the effective poten-
tial means that all explicit contributions from the Hartree-Exchange-Correlation
kernel are neglected. For the real valued case, the Hessian can be approximated
as
                         ∂2E
                                 ≈ δil Hjm (fl + fi − fj − fm )
                       ∂aij ∂alm
                                     +δjl Him (fm + fi − fl − fj )
                                     +δjm Hli (fm − fi − fl + fj )
                                     +δim Hlj (fl − fm − fi + fj )
                                     +βij δil δjm                                     (30)

where the matrix βij must be chosen according to the following two principles:
(1) the approximate Hessian must be positive definite, and (2) it must provide
a good estimate of the true Hessian along the search direction such that a step
size of 1 satisfies the strong Wolfe conditions.
    If the orbitals are chosen as eigenvectors of the Hamiltonian then the ap-
proximate Hessian is diagonal
                         ∂2E
                                 = −2(ǫii − ǫjj )(fi − fj ) + βij .                   (31)
                         ∂ 2 aij
If one keeps contributions from the Hartree-Exchange-Correlation kernel then
the Hessian matrix is not diagonal and the inversion of this matrix will require
considerable computational effort.
    The first term on the right hand side coincides with the preconditioner that
has previously been used for molecular systems with integer occupation num-
bers [9]. There, an extra term was added in cases of degeneracy, ǫii = ǫjj , but
here the initial approximation of the Hessian in the L-BFGS algorithm [27] βij
is used. Since the approximate Hessian is diagonal, the preconditioner is simply
                                                1
                          Pij =                                  .                    (32)
                                  −2(ǫii − ǫjj )(fi − fj ) + βij
In the present implementation, the preconditioner is updated iteratively and for
iteration k it is
                   (k)                              1
                 Pij =                                                      ,         (33)
                             −2(1 − γ)(ǫii − ǫjj )(fi − fj ) + γβ (k)
where
                                 k∇~a E(~a (k) ) − ∇~a E(~a (k−1) )k2
             β (k) =                                                              .   (34)
                       (~a (k) − ~a (k−1) ) · (∇~a E(~a (k) ) − ∇~a E(~a (k−1) ))

                                               8
The parameter γ in Eq.(33) is a number that determines the mixing of the
two approximate Hessians: the one obtained from a linear expansion of the
gradient, Eq.(19), and the one based on the LBFGS estimate, Eq.(34). In the
calculations presented here, γ = 0.25 was found empirically to give a good
compromise between the rate of convergence and robustness. When k-point
sampling is included for the periodic systems, β (k) , needs to be multiplied by
the numerical weight of the corresponding k-point. Eq. (33) is used as an initial
inverse Hessian at each iteration of the L-BFGS algorithm.
    With this preconditioner, a step length of 1 is almost always accepted and it
works well for both finite and extended systems. It is used for both the real and
imaginary parts of the skew-Hermitian matrix. We note that the eigenvalues
in Eq. (33) are not updated at every iteration of the minimization algorithm
but only at the beginning, thereby avoiding the costly diagonalization of the
Hamiltonian matrix at each step.

3.4. Evaluation of the matrix exponential and energy gradient
   The evaluation of the exponential of the skew-Hermitian matrix, exp(A), is
carried out using eigendecomposition of iA. Let Ω be a diagonal, real-valued
matrix with elements corresponding to the eigenvalues of the matrix iA and let
U be a column matrix of the eigenvectors of iA. Then the matrix exponential
of A is
                          exp(A) = U exp(−iΩ)U † .                       (35)
This computation requires diagonalization of a M × M matrix and becomes
a computational bottleneck for large systems. However, for unitary invariant
energy functionals (such as Kohn-Sham functionals), Hutter et.al. [12] have
shown that A can be parametrised without loss of generality as
                                             
                                     0    Aov
                            A=                  ,                       (36)
                                  −A†ov    0

where Aov is a N × (M − N ) matrix (N - number of occupied states) and the
matrix exponential can be calculated as

                                              P −1/2 sin(P 1/2 )Aov
                                                                             
                      cos(P )
  exp(A) =                                                                      ,
              −A†ov P −1/2 sin(P 1/2 ) IM−N + A†ov cos(P 1/2 − IN )P −1 Aov )
                                                                               (37)
where P = Aov A†ov . In this case the computational effort scales as O(N 2 M ).
   An alternative and more general approach is provided by the scaling and
squaring algorithm based on the equation
                                                    m
                             exp(A) = exp(A/2m )2                             (38)

and on [q, q] Páde approximant to the matrix exp(A/2m ), where m and q are
positive integer constants [31]. The algorithm of Al-Mohy and Higham is used
here [32, 33]. The two approaches are compared in the benchmark calculations
presented below.

                                        9
If the matrix exponential is evaluated using the eigendecomposition of iA,
then one can calculate the gradient of the energy using the matrices U and Ω
as
                         GT = U U † LU ⊗ D U † ,
                                               
                                                                         (39)
where the matrix D is
                                      e−i(Ωii −Ωjj ) − 1
                             Dij =                                           (40)
                                        i(Ωii − Ωjj )
and the matrix G is
                                       ∂E       2
                              Gij =                    .                     (41)
                                       ∂aij (2 − δij )
    However, due to the sparsity of the matrix A and if the norm is kAk ≪ 1,
the gradients can be evaluated more efficiently using only the first term on the
right hand side of Eq. (19)
                                   G ≈ LT .                              (42)
If the norm of the matrix A is larger than 1, then the reference orbitals can be
updated C ← C exp(A) in which case A ← 0 and then Eq. (42) can be used.
Namely, during the iterative process,

                                O(k) = C exp(A(k) )                           (43)

check if kL(k) k ≥ ǫk A(k) , L(k) k then set C ′ = C exp(A(k) ), and continue with
                                

                           O(k+1) = C ′ exp(A(k+1) ).                        (44)

It is found that ǫ = 3 provides a reasonable estimate. However, in order to avoid
an additional calculation of a commutator between A and L, one can update the
reference orbitals at a regular interval (for example, at every 20th. iteration).
The change of the reference orbitals should be followed by a transformation of
the gradient vectors, as stored in memory for quasi-Newton algorithms, if they
are to be used in following steps. However, in the implementation used for the
numerical tests in this work, the memory of the L-BFGS algorithm is instead
erased after an update of the reference orbitals. This can be beneficial in cases
where the orbitals are near stationary points which are not the minimum.
     For small systems, the performance is similar for the various methods for
evaluating the matrix exponential and energy gradient since the calculation of
the effective Kohn-Sham potential and the total energy then dominates the
computational effort. For larger systems, a difference in performance becomes
evident, as illustrated below for configurations of liquid water with up to 576
molecules.

3.5. Implementation and parameter values
    We have implemented the ETDM algorithm using a numerical localized
atomic basis set and the projector augmented-wave formalism (PAW) [34] to
take into account the frozen, inner electrons of the atoms within the open-source
GPAW software [35]. An SCF algorithm based on the eigendecomposition of the

                                         10
Hamiltonian in a localised atomic basis set representation is already available
there and is frequently used in KS-DFT calculations [36]. To compare the effi-
ciency of the two approaches, single-point ground-state energy calculations are
performed for the G2 [37] data set of small molecules, five ionic solids, as well
as liquid water configurations including 32, 64, 128, 256, 384 and 576 molecules
subject to periodic boundary conditions. The double-zeta polarized basis set
(which is the default basis set in GPAW) and the generalized gradient approxi-
mation (GGA) parametrized by Perdew-Burke-Ernzerhof [38] is used. An initial
guess for the orbitals is taken to be the eigenvectors of the Hamiltonian obtained
from a superposition of atomic densities.
    Convergence is considered achieved for both the SCF and the ETDM meth-
ods when the inequality
               Nb Z                       Nb
           1 X                           X
                    d rfi |ĤKS ψi (r) −     λij ψj (r)|2 < 10−10 eV2        (45)
           Ne i=1                        j=1

is satisfied. In the equation above, the λij are Lagrange multipliers and for an
SCF algorithm this is a diagonal matrix. Nb is the number of occupied orbitals.
Default values in GPAW are used, for example the Pulay density mixing param-
eters. We note that in cases where the SCF method fails to converge, it could in
principle be made to converge by using, for example, other, non-default values
of the density mixing parameter. Failure to reach convergence here means that
convergence is not obtained in the default maximum number of iteration steps,
which is 333.

4. Results

4.1. Molecules
    The average number of energy and gradient evaluations for the ETDM
method and the average number of energy and diagonalization calculations for
the SCF method are presented in Table 1 and Fig. 1. The ETDM method
converges for all the 148 molecules in the G2 set using the parameter values
specified in Sec. 3. The SCF method, however, fails to converge for five of the
molecules: CH, SH, ClO, NO, and OH. These five molecules are also challenging
for the ETDM method as it requires more iterations to reach convergence there
than the average for the whole G2 set (see Fig. 1). For the molecules where SCF
converges, it requires a similar number of iterations as ETDM. On average 18
and 17 iterations are required by the SCF and ETDM methods, respectively.
    The reason for the lack of convergence for SCF and slow convergence of
ETDM in the five problematic cases could be the presence of nearby saddle
points or near-degenerate higher energy states. In the SCF calculations, the
orbitals obtained from the diagonalization of the Hamiltonian matrix at subse-
quent iterations can ‘jump’ between different energy surfaces or oscillate around
a saddle point. Analogous convergence issues for the DIIS method have been
reported for the G2 molecular set and transition metal complexes [15].

                                       11
(a)                                                                                                  (b)

      Number of iterations (energy and gradients calls)
                                                                    SCF                                    70                             ETDM
                                                          20        ETDM

                                                          18                                               60
                                                          16
                                                                                                           50
                                                          14
                                                                                                           40
                                                          12

                                                          10                                               30

                                                          8
                                                               3
                                                                    P2

                                                                             HO

                                                                               H
                                                                             CS

                                                                                              HO

                                                                                                C

                                                                                               OF

                                                                                          HC H3
                                                                                                H

                                                                                                                NO

                                                                                                                     CH

                                                                                                                               OH

                                                                                                                                    ClO

                                                                                                                                           SH
                                                               PH

                                                                                             H9
                                                                            CO

                                                                                             OO
                                                                                            3C

                                                                                            OC
                                                                          3C

                                                                                           HC
                                                                                          C3
                                                                         H2

                                                                                         CH
                                                                     CH

                                                                                         H2
                                                                                OC

                                                                                      3C
                                                                                   CH

Figure 1: (a) Number of SCF iterations and energy/gradient evaluations in the exponential
transform direct minimization needed to reach convergence according to criterion Eq. (45) for
a representative set of 10 molecules from the G2 set. (b) Energy/gradient evaluations in the
exponential transform direct minimization for the molecules for which the SCF method failed
to converge.

Table 1: Comparison of the performance of the exponential transform direct minimization,
ETDM, and self-consistent field, SCF, methods for the G2 set of molecules (a total of 148
molecules). The average number of energy and gradient evaluations is reported for the former
method, but the average number of energy and diagonalization calculations for the latter (in
both cases denoted e/g(d)). In the column labeled ETDM∗ , the five molecules for which the
SCF calculations did not converge are excluded.

                                                                                               SCF         ETDM      ETDM∗

                                                                            average e/g(d)     18               17        16
                                                                            min e/g(d)         12               6         6
                                                                            max e/g(d)         26               72        25
                                                                            did not converge   5                 -         -

   For these small molecules, the evaluation of the matrix exponential and
energy gradient, i.e. the diagonalization of the Hamiltonian matrix, is not the
dominant computational effort. The various algorithms presented in Sec 3.4
therefore involve similar computational effort.

4.2. Periodic Systems
    As examples of extended systems subject to periodic boundary conditions,
calculations have been carried out for five crystalline solids: NaCl, NaF, LiCl,
LiF and MgO. A cubic unit cell is chosen consisting of 8 atoms and Γ-centered
3 × 3 × 3 Monkhorst-Pack meshes are used for the BZ sampling. The lattice
constants are set to the optimal values obtained from PBE calculations [39].

                                                                                                12
Number of iterations (energy and gradients calls)
                                                                  15          SCF
                                                                              ETDM

                                                                  13

                                                                  11

                                                                  9

                                                                  7
                                                                         Cl

                                                                                       F

                                                                                                l

                                                                                                    LiF

                                                                                                            O
                                                                                           LiC
                                                                                     Na

                                                                                                          Mg
                                                                       Na

Figure 2: Number of SCF iterations and energy/gradient evaluations in the exponential trans-
form direct minimization needed to reach convergence according to criterion Eq. (45) for NaCl,
NaF, LiCl, LiF and MgO crystals.

The number of iterations required to reach convergence is presented in Fig. 2.
The results show that the ETDM and the SCF algorithms have similar rate of
convergence for these systems. This is an important test of the preconditioner
given in equation (33) and shows that it is suitable for solids as well as molecules.
    Tests were also carried out for another set of extended systems representing
snapshots of liquid water. The systems contain 32, 64, 128, 256, 384 and 576
water molecules subject to periodic boundary conditions. The efficiency of the
two approaches for evaluating the matrix exponential in the ETDM method
discussed in Sec 3.4 is compared, also in relation to SFC, and reported in Fig.3.
One of the approaches is based on Eq. (37) and makes use of the fact that the
energy is invariant with respect to unitary rotations of the occupied orbitals. In
this case, the computation of the matrix exponential requires diagonalization of
an N × N matrix and involves less computational time as compared to the SCF
algorithm where the first N eigenvectors of a M ×M Hamiltonian matrix need to
be calculated. The other approach, the scaling and squaring algorithm Eq.(38),
is more general and does not rely on the parameterization of the skew-Hermitian
matrix based on Eq. (38). For dense matrices, this approach is generally slower
than the one based on eigendecomposion of the skew-Hermitian matrix Eq. (35),
but for sparse matrices this algorithm can outperform the eigendecomposion
approach. The energy gradient is calculated according to Eq. (42).
    The ratio of the CPU time required by calculations using the SCF method
and the ETDM method is shown as a function of the number of water molecules
in Fig. 3. When the matrix exponential is evaluated using Eq. (37) the ETDM
method outperforms SCF by a factor of two if more than 200 water molecules are
included in the system. Also, the more general implementation of ETDM using

                                                                                           13
2.0   ETDM, ss
                     ETDM, uinv

               1.8
Tscf / Tetdm

               1.6

               1.4

               1.2

               1.0
                      100         200       300       400                  500           600
                                  Number of water molecules

Figure 3: Ratio of the CPU time used by the SCF method and the exponential transform direct
minimization, ETDM, method based on either the scaling and squaring algorithm, Eq. (38)
(ss, red curve) or the evaluation of the matrix exponential by diagonalization, Eq. (35), (uinv,
blue curve), as a function of the number of water molecules in liquid configurations subject to
periodic boundary conditions. For the largest system, the direct minimization based on matrix
diagonalization outperforms the SFC method by a factor of two while the implementation
based on the scaling and squaring algorithm is 20% faster than SCF.

                                              14
scaling and squaring, Eq. (38), is faster than SCF by 20% for these relatively
large systems. It has the advantage of being applicable to energy functionals
lacking unitary invariance, unlike the SCF algorithm.

5. Discussion and Conclusion

    The main advantage of the ETDM implementation presented here, based on
a general preconditioner, L-BFGS algorithm and inexact line search is robust-
ness. For small molecules the computational effort is similar to the standard
SCF approach when the latter converges, but the ETDM is found to converge
for all the molecules in the G2 set with the same set of parameter values, a set
that also works for extended liquid configurations and insulating solids. This
demonstrates the transferability of the ETDM algorithm as implemented here.
For the large systems considered here, liquid water configurations with 200 and
up to 576 molecules, the ETDM outperforms the direct SCF method up to by
a factor of two when special parametrization of skew-Hermitian matrix is used
and by around 20% when the more general scaling and squaring method is used.
The latter is more general and can be applied to any type of orbital dependent
energy functional such as self-interaction corrected functionals [23].
    The ETDM method involves minimization of the energy with respect to the
elements of a skew-Hermitian matrix and, therefore, the number of degrees of
freedom scales as M 2 , where M is the number of basis functions. However,
for energy functionals that are unitary invariant with respect to the occupied
orbitals, the skew-Hermitian matrices can be parametrized using N × (M − N )
degrees of freedom,[12] where N is the number of occupied orbitals. There-
fore, taking into account the sparsity of the matrices, the algorithm can be
implemented in such a way that the computational effort scales as O(N 2 M ).
The scaling and squaring algorithm for evaluating the matrix exponential is not
as efficient but is more generally applicable and can still outperform the SCF
method as was found for the large liquid water configurations.
    Future work will involve generalization of the ETDM method to finite tem-
perature KS-DFT, i.e. thermal smearing, where an additional inner loop for
variational optimization of the occupation numbers is included [40], analogous
to the direct minimization method used in ensemble DFT [13]. This is needed
for calculations of metallic systems. A more efficient preconditioner could also
likely be developed, especially for orbital density dependent functionals. Finally,
we point out that the ETDM method is also useful in other types of electronic
structure calculations, such as studies of excited states [41, 42].

6. Acknowledgement

   The authors thank Gianluca Levi for fruitful discussion and valuable com-
ments on the manuscript. This work was supported by the University of Iceland
Research Fund and the Icelandic Research Fund (grant no. 174082-053). AVI is
supported by a doctoral fellowship from the University of Iceland. HJ, AVI and

                                        15
EÖJ thank the Department of Energy Conversion and Storage at the Technical
University of Denmark for hospitality during an extended visit and access to
computational resources.

References

 [1] P. Hohenberg, W. Kohn, Inhomogeneous electron gas, Phys. Rev. 136
     (1964) B864.
 [2] W. Kohn, L. J. Sham, Self-consistent equations including exchange and
     correlation effects, Phys. Rev. 140 (1965) 1133.
 [3] E. Davidson, The iterative calculation of a few of the lowest eigenvalues and
     corresponding eigenvectors of large real-symmetric matrices, J. Comput.
     Phys. 17 (1975) 87.
 [4] P. Pulay, Convergence acceleration of iterative sequences. the case of scf
     iteration, Chem. Phys. Lett. 73 (1980) 393.
 [5] P. Pulay, Improved scf convergence acceleration, J. Comput. Chem. 3
     (1982) 556.
 [6] G. Kresse, J. Furthmüller, Efficient iterative schemes for ab initio total-
     energy calculations using a plane-wave basis set, Phys. Rev. B 54 (1996)
     11169.
 [7] A. J. Garza, G. E. Scuseria, Comparison of self-consistent field convergence
     acceleration techniques, J. Chem. Phys. 137 (2012) 054110.
 [8] A. C. Vaucher, M. Reiher, Steering orbital optimization out of local minima
     and saddle points toward lower energy, J. Chem. Theory Comput. 13 (2017)
     1219.
 [9] M. Head-Gordon, J. Pople, Optimization of wave function and geometry
     in the finite basis hartree-fock method, J. Phys. Chem. 92 (1988) 3063.
[10] M. J. Gillan, Calculation of the vacancy formation energy in aluminium,
     J. Phys. Condens. Matter 1 (1989) 689.
[11] M. Payne, M. Teter, D. Allan, T. Arias, J. Joannopoulos, Iterative mini-
     mization techniques for ab initio total-energy calculations: Molecular dy-
     namics and conjugate gradients, Rev. Mod. Phys. 64 (1992) 1045.
[12] J. Hutter, M. Parrinello, S. Vogel, Exponential transformation of molecular
     orbitals, J. Chem. Phys 101 (1994) 3862.
[13] N. Marzari, D. Vanderbilt, M. C. Payne, Ensemble density-functional the-
     ory for ab initio molecular dynamics of metals and finite-temperature in-
     sulators, Phys. Rev. Lett. 79 (1997) 1337.

                                       16
[14] S. Ismail-Beigi, T. Arias, New algebraic formulation of density functional
     calculation, Comput. Phys. Commun 128 (2000) 1.
[15] T. Van Voorhis, M. Head-Gordon, A geometric approach to direct mini-
     mization, Molecular Physics 100 (2002) 1713.
[16] J. VandeVondele, J. Hutter, An efficient orbital transformation method for
     electronic structure calculations, J. Chem. Phys. 118 (2003) 4365.
[17] V. Weber, J. Vandevondele, J. Hutter, A. Niklasson, Direct energy func-
     tional minimization under orthogonality constraints, J. Chem. Phys. 128
     (2008) 084113.
[18] C. Freysoldt, S. Boeck, J. Neugebauer, Direct minimization technique for
     metals in density functional theory, Phys. Rev. B 79 (2009) 241103.
[19] A. Edelman, T. Arias, S. Smith, The geometry of algorithms with orthog-
     onality constraints, SIAM J. Matrix Anal. Appl. 20 (1998) 303.
[20] J. F. Rico, J. M. G. De La Vega, J. I. F. Alonso, P. Fantucci, Restricted
     Hartree–Fock approximation. I. Techniques for the energy minimization, J.
     Comput. Chem. 4 (1983) 33.
[21] J. Á. Fern Rico, M. Paniagua, J. I. Fern Alonso, P. Fantucci, Restricted
     Hartree–Fock approximation. II. Computational aspects of the direct min-
     imization procedure, J. Comput. Chem. 4 (1983) 41.
[22] J. Douady, Y. Ellinger, R. Subra, B. Levy, Exponential transformation of
     molecular orbitals: A quadratically convergent SCF procedure. I. General
     formulation and application to closed-shell ground states, J. Chem. Phys.
     72 (1980) 1452.
[23] J. P. Perdew, A. Zunger, Self-interaction correction to density-functional
     approximations for many-electron systems, Phys. Rev. B 23 (1981) 5048.
[24] S. Lehtola, H. Jónsson, Variational, Self-Consistent Implementation of
     the Perdew–Zunger Self-Interaction Correction with Complex Optimal Or-
     bitals, J. Chem. Theory Comput. 10 (12) (2014) 5324.
[25] G. Borghi, C.-H. Park, N. Nguyen, A. Ferretti, N. Marzari, Variational min-
     imization of orbital-density-dependent functionals, Phys. Rev. B 91 (2015)
     155112.
[26] S. Lehtola, M. Head-Gordon, H. Jónsson, Complex orbitals, multiple lo-
     cal minima, and symmetry breaking in perdew-zunger self-interaction cor-
     rected density functional theory calculations, J. Chem. Theory Comput. 12
     (2016) 3195.
[27] J. Nocedal, S. J. Wright, Numerical Optimization, 2nd Edition, Springer,
     New York, NY, USA, 2006.

                                      17
[28] P. Wolfe, Convergence conditions for ascent methods, SIAM Review 11
     (1969) 226.
[29] P. Wolfe, Convergence conditions for ascent methods. ii: Some corrections,
     SIAM Review 13 (1971) 185.
[30] W. Hager, H. Zhang, A new conjugate gradient method with guaranteed
     descent and an efficient line search, SIAM J. Optim 16 (2006) 170.
[31] C. Moler, C. Van Loan, Nineteen dubious ways to compute the exponential
     of a matrix, twenty-five years later, SIAM Review 45 (2003) 3.
[32] A. Al-Mohy, N. Higham, A new scaling and squaring algorithm for the
     matrix exponential, SIAM J. Matrix Anal. Appl. 31 (2009) 970.
[33] E. Jones, T. Oliphant, P. Peterson, et al., SciPy: Open source scientific
     tools for Python (2001–).
[34] P. E. Blöchl, Projector augmented-wave method, Phys. Rev. B 50 (1994)
     17953.
[35] J. Enkovaara, C. Rostgaard, J. J. Mortensen, J. Chen, M. Dulak, L. Fer-
     righi, J. Gavnholt, C. Glinsvad, V. Haikola, H. A. Hansen, H. H. Kristof-
     fersen, M. Kuisma, A. H. Larsen, L. Lehtovaara, M. Ljungberg, O. Lopez-
     Acevedo, P. G. Moses, J. Ojanen, T. Olsen, V. Petzold, N. A. Romero,
     J. Stausholm-Møller, M. Strange, G. A. Tritsaris, M. Vanin, M. Walter,
     B. Hammer, H. Häkkinen, G. K. H. Madsen, R. M. Nieminen, J. K.
     Nørskov, M. Puska, T. T. Rantala, J. Schiøtz, K. S. Thygesen, K. W.
     Jacobsen, Electronic structure calculations with GPAW: a real-space im-
     plementation of the projector augmented-wave method, J. Phys. Condens.
     Matter 22 (2010) 253202.
[36] A. H. Larsen, M. Vanin, J. J. Mortensen, K. S. Thygesen, K. W. Jacobsen,
     Localized atomic basis set in the projector augmented wave method, Phys.
     Rev. B 80 (2009) 195112.
[37] L. Curtiss, K. Raghavachari, P. Redfern, J. Pople, Assessment of gaussian-2
     and density functional theories for the computation of enthalpies of forma-
     tion, J. Chem. Phys. 106 (1997) 1063.
[38] J. P. Perdew, K. Burke, M. Ernzerhof, Generalized gradient approximation
     made simple, Phys. Rev. Lett. 77 (1996) 3865.
[39] V. N. Staroverov, G. E. Scuseria, J. Tao, J. P. Perdew, Tests of a ladder
     of density functionals for bulk solids and surfaces, Phys. Rev. B 69 (2004)
     075102.
[40] Á. Ruiz-Serrano, C.-K. Skylaris, A variational method for density func-
     tional theory calculations on metallic systems with thousands of atoms, J.
     Chem. Phys. 139 (2013) 054107.

                                      18
[41] G. Levi, A. V. Ivanov, H. Jónsson, Variational calculations of excited states
     via direct optimization of the orbitals in DFT, Faraday Discuss. 224 (2020)
     448.
[42] G. Levi, A. V. Ivanov, H. Jónsson, Variational Density Functional Calcula-
     tions of Excited States via Direct Optimization, J. Chem. Theory Comput.
     16 (2020) 6968.

                                        19
You can also read