(14) Iterative Minimization of Energy Part 2

Embed Size (px)

Citation preview

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    1/20

    POSTECH

    Special Lecture on Density Functional Theory:

    (14) Iterative Minimization of Energy by theConjugate-Gradient (CG) Method

    by Prof. Hyun M. Jang Dept. of Materials Science and Engineering, and Division of Advanced

    Materials Science, Pohang University of Science and Technology(POSTECH), Republic of Korea.

    also at Dept. of Physics, Pohang University of Science and Technology(POSTECH), Republic of Korea.

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    2/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    Ab initio total-energy pseudo-potential calculations by conventionalmatrix diagonalization technique require significant amounts ofcomputer time, even for systems containing a few atoms in the unit

    cell. The Hamiltonian matrix for each of the kpoints in the IBZ mustbe constructed, as discussed in the Kohn-Sham (K-S) equation in aplane-wave basis, and diagonalized to obtain the K-S eigenstates.

    This procedure should be repeated until the charge density for of

    the (n-1)th iteration is self-consistent with that of the nth iteration.

    The cost of matrix diagonalization increases as the 3rd power of thenumber of plane-wave basis states. As a result, conventional matrix

    diagonalization techniques are restricted to the order of 10 atoms inthe unit cell (order of 1,000 plane-wave basis states).

    In this chapter, an efficient method is introduced that allows direct

    minimization of the Kohn-Sham energy functional based on the

    conjugate-gradient (CG) method.

    H

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    3/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    * Introduction to Conjugate-Gradient (CG) Method

    Two general methods are commonly used to locate the minimum of

    function F(x), where x is a vector in the mulltidimensional space: (i) the

    method of steepest descent and (ii) the conjugate-gradient (CG) method.

    In the absence of any information about

    the function F(x), the optimum direction to

    move from the point x1 to minimize the

    function is just the steepest-descent

    direction g1 given by

    where is the gradient operator acting on

    the vector x1

    to give the steepest-descentdirection g1. Although each iteration of the

    steepest-descent algorithm moves the trial

    vector towards the minimum of the

    function, there is no guarantee that the

    minimum will be reached in a finite numberof iterations (See the figure at rhs).

    G

    )1(.......... 1xx

    1x

    xg

    1G

    =

    =

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    4/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    In many cases a very large number of steepest-descent iterations isneeded to get close to the minimum.

    Although it may seem surprising, there is a faster way to reach theminimum than to follow the downhill steepest-descent direction.

    Let d1be the minimization direction ofF(x) at x1 and d2be the

    subsequent minimization direction at x2, where x2 = x1+b1d1. Then, it

    can be shown that the following relationship should be hold if d

    1

    andd2 are to be independent (because each minimization step is indepen-

    dent of the previous steps):

    This is the minimization condition that the directions d1 and d2be

    conjugate to each other and can be generalized to

    The conjugate-gradient (CG) technique provides a simple and

    effective procedure for implementation of such a minimization app-

    )2(...................0 12 == dddd 21 GG

    )3(..............................0 mnforG = mn dd

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    5/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    roach. The initial direction is taken to be the negative of the gradient(steepest-descent direction) at the starting point. A subsequentconjugate direction is then constructed from a linear combination

    of the new gradient and the previous direction that minimizedF(x). In a two-dimensionalproblem, it is clear that one would needonly two conjugate directions, and this would be sufficient to span the

    space and arrive at the minimum in just two steps, as described in the

    figure of Page 2.

    The above descriptions can be generalized by the followingalgorithm:

    In Eq. (4), dm is the (search) conjugate direction in the mth iterationand gm is the steepest-descent vector or direction in the mth iteration.

    (Ref.) Appendix L of R. M. Martins book.

    )5(................0

    )4(.............................................

    1

    =

    +=

    withwhere m

    m

    1m1m

    mm

    1mmm

    gggg

    dgd

    1221222 ggdgd +=+=

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    6/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    * Orthogonality Constraints in the Conjugate-Gradient Method

    In this section, a computational technique that can overcome the

    problem associated with large supercell sizes and large plane-wavekinetic-energy cutoffs is introduced. This technique adopts the

    conjugate-gradient (CG) approach, with the proper preconditioning, tominimize directly the Kohn-Sham energy functional.

    In the case of total energy calculations, the Kohn-Sham energyfunctionalEtakes the place of the functionF, the wavefunctionstake the place of the vector x, and the Kohn-Sham Hamiltonian isthe relevant gradient operator

    The steepest-descent direction which satisfies the orthogonalityconstraints of is given by

    where the superscript m labels the iteration number and the super-

    i

    .G

    )mi

    { }i

    )6(..............................j

    m

    i

    ij

    j

    m

    i

    m

    i =

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    7/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    script i is the band index. There is no iteration index on the wave-

    functions in Eq. (6) because do not vary during iterations for bandi. is the steepest-descent direction obtained without considering

    the orthogonality constraints with the definition

    Eq. (6) can be obtained by requiring the following orthogonality:

    If the search direction for band iwere not orthogonal to the wave-functions of all the other bands, all

    of the wave-functions would have to change during each iteration inorder to maintain the constraints of orthogonality.

    (Ref.) (i) M. P. Teter, M. C. Payne, and D. C. Allan, Solution of Schrdingerequation for large systems, Phys. Rev. B 40, 12255-12263 (1989). (ii) M. C. Payne,M. P. Teter, D. C. Allan, T. A. Arias, and J. D. Joannopoulos, Iterative minimization

    technique for ab initio total-energy calculations: molecular dynamics and conjugategradients, Reviews of Modern Physics 64, 1045-1097 (1992).

    m

    i

    j

    )7(..... mi

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i HHHH ==

    )8(.....0===

    m

    il

    m

    iljlj

    m

    ij

    m

    il

    m

    il .0,0 == m

    ilji thenif

    .im

    i

    m

    i =

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    8/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    * Preconditioning Vector

    The relation between the error in the wavefunction, , and thesteepestdescent direction is obtained by expanding in terms

    of the eigen-states of the Kohn-Sham Hamiltonian, namely,

    The steepest-descent vector is obtained by substituting Eq. (9) into

    Eq. (7).

    where is the eigenvalue associated with the eigen-state

    The Kohn-Sham Hamiltonian has a broad spectrum of eigenvalues(i.e., a broad spectrum of the steepest descent vectors). This leads to

    poor convergence in a conjugate-gradient calculation. The techniqueof preconditioning is proposed to improve the rate of convergence.

    The preconditioning technique involves multiplying the steepest-descent vector by a preconditioning matrixK to produce a precondi-

    i

    i

    i

    )9(...........................................==

    iii c

    ( ) )10(.................

    == iiiii ccH

    (e.g., plane wave)

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    9/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    tioned steepest-descent vector that more accurately represents the

    error vector, as illustrated in the figure presented below. Thus, onecan obtain an essentially eigenvalue-independent steepest-descent

    vector by exploiting this technique.

    The preconditioned steepest-descent

    vectors that accurately represent

    can be obtained by multiplying thesteepest-descent vectors by an ortho-

    gonalized preconditioning matrix,

    namely,

    where the matrix element of the

    preconditioning matrixKis

    expressed by the following equation:

    )11(....................mimi K =

    i

    ( ) ., iii as

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    10/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    in Eq. (12) is defined by

    where is the kinetic energy of the stateThe matrix elements asymptotically approach 1/{2(+1)}.

    This factor (i.e., ) thus causes all of the large wave-vector

    (i.e., large ) to converge at nearly the same rate, as shown in thefigure presented in the previous page.

    The preconditioned steepest-descent vector as presented in Eq. (11)

    is not orthogonal to all the bands. On the analogy of Eq. (6), thepreconditioned steepest-allowed-descent vector that is orthogonalto all the bands is calculated as

    where a prime signifies a descent vector orthogonal to all the bands.

    ( ))12(.............

    168121827

    8121827432

    32

    ++++

    +++= GG,GG,K

    )13(................1

    2

    22

    m

    iTm

    Gk+h

    m

    i

    m

    i

    m

    im

    T

    = 2

    2

    2

    h .mi

    GG,

    1GG,

    )14(................................j

    j

    m

    ij

    m

    i

    m

    i =

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    11/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    * Conjugate Directions

    The conjugate-gradient direction can be constructed out of steepest-descent vectors according to

    where is the preconditioned steepest-descent direction. Eq. (15) isbased on Eq. (4), namely, where gm is the steepest-

    descent vector in the mth iteration. is given by

    where The conjugate direction generated by Eq. (15) will notbe orthogonal to wave-function of the present band. A furtherorthogonalization to the present band can be done by

    )15(...........,. 12221iiii

    m

    i

    m

    i

    m

    i

    m

    i ge +=+=

    m

    i

    ,1mmm dgd += mmi

    )16(...............................1111

    =

    =

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    im

    i

    .0

    1 =i m

    i

    )17(.................................mi

    m

    i

    m

    i

    m

    i

    m

    i =

    0== m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    12/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    Then, a normalized conjugate direction can be computed by

    is then orthogonal to all the bands, because of Eq. (17).

    * Search for the Energy Minimum

    Define the following linear combination as a trial eigenvector(wave-function) for the (m+1)th iteration:

    According to Eq. (19), is a measure of the deviation from thenormalized conjugate direction, Thus, Eq. (19) is orthogonal to

    all the other bands satisfying the orthogonality constraints.Teteret al. [Phys. Rev. B 40, 12255-12263 (1989)]proposed the following

    -dependent Kohn-Sham energy expression to locate the minimum of

    m

    i

    m

    i

    )18(...................................2/1m

    i

    m

    i

    m

    im

    i

    =

    )19(............)(sincos1

    realism

    i

    m

    i

    m

    i +=+

    2/ .mi

    ),( i

    j

    jThe minimum will occur at xm+1 along

    the conjugate direction dm according

    to xm+1 = xm + bmdm.

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    13/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    the K-S energy functional:

    WritingEKSas a function of

    is equivalent to writingEKS as afunction of Three pieces of information are required to evaluate

    the three unknowns in Eq. (20), namely,Eavg,A1, andB1.

    The conjugate-gradient technique requires that the value of that

    minimizes the Kohn-Sham energy functional be found. To do this, letus considerE() in details.

    where

    .m

    i

    )20(.......)2sin()2cos()(11

    avg

    ++=

    )21(......................)()(

    )()()()(21

    )()()(

    1

    1

    1

    333

    1

    1

    *1

    rrr,

    rrrrrr

    xcH

    m

    i

    m

    i

    xc

    m

    i

    m

    i

    EEH

    rdnrdrdnn

    dHE

    ++=

    +

    +=

    ++

    ++

    ).22(............................1 ext

    VTH +=

    The 2nd and 3rd terms of

    Eq. (20) reflect the

    variation of E during the

    iteration of i.

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    14/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    According to Eq. (21), we also have to evaluate term.

    { } { }

    { } { }

    { } { }

    { } )24(...cossinsincos

    sincoscossin)(

    ,

    )23(............sincossincos

    )(

    111*

    1*

    1

    **

    1

    **

    0

    1

    1

    **

    )19.(

    1

    1

    1

    1

    mi

    mi

    mi

    mi

    mi

    mi

    mi

    mi

    o

    m

    i

    m

    io

    m

    i

    m

    i

    o

    m

    i

    m

    io

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    Eq

    m

    i

    m

    i

    HHdHH

    dH

    dHE

    Then

    dH

    HELet

    += +=

    + ++

    + +=

    + +

    =

    =

    ++

    0=

    +

    xcH

    EE

    { }

    )26(.....sincossincos)(

    )25(.....)()()()( 000

    m

    i

    m

    i

    m

    i

    m

    i

    xcH

    xcHxcH

    nand

    nVVnnE

    nEEE

    ++=

    +=

    +

    =

    +

    =

    r

    rrrr

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    15/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    has been computed to determine the steepest-descent vector

    [Eq. (7)]. Thus, the value of Eq. (29) can be computed readily.B1 can be determined.

    { } )29(...............................2Re2

    )28(..........

    1)20.(

    11

    000

    1

    0

    0

    BH

    VVHVVH

    EEEE

    VVVVEE

    Eq

    m

    i

    m

    i

    m

    ixcH

    m

    i

    m

    ixcH

    m

    i

    xcH

    m

    ixcH

    m

    i

    m

    ixcH

    m

    i

    xcH

    ==

    +++++=

    +

    +

    =

    +++=

    +

    ====

    =

    { }{ }

    { }{ }

    { } )27(...............0cos0sin0sin0cos

    0sin0cos0cos0sin)(

    **

    **

    **

    0

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    d

    d

    dn

    +=+=

    + ++

    + +=

    =

    r

    m

    iH

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    16/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    To determine the two other parameters (Eavg,A1), Teteret al.proposed analytic method that utilizes the K-S energy at a secondvalue of The sampling point of the second point should

    be far enough from to avoid rounding errors but not so far fromthe origin. It has been found that computing the K-S energy at thepoint gives reliable results.

    From Eq. (20), one can obtain the following expression ofEavg

    for = /300.

    As shown in Eq. (29), B1 is given by

    ( ).0

    0=

    300/=

    )31(........)300/2cos(1

    )300/2sin(21)300/()0(

    4

    1

    )30(.....)300/2cos(1

    )300/2cos()0()300/2sin(2

    1)300/(

    0

    0

    2

    2

    1

    0

    +

    =

    =

    =

    =

    =

    EEEE

    Aand

    EEE

    avg

    .2

    101 =

    = B

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    17/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    Once the three parameters (Eavg,A1, andB1) have been determined,

    the value of that minimizes the Kohn-Sham energy functional atthe mth iteration can be evaluated. Then, the following relation should

    be hold for the minimum K-S energy.

    The value of that lies in the range is the required

    value.

    According to Eq. (32), one has to evaluate the second derivative of

    Eto correctly locate

    )32(.....

    2

    1tan

    2

    1tan

    2

    12tan0

    02

    2

    01

    1

    11

    min

    1

    1

    min)20.(

    =

    ===

    =

    =

    E

    E

    A

    B

    A

    BEEq

    min 2/0

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    18/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    The required value of is then determined using Eq. (32). Thewave-function used to start the next iteration of the conjugate-gradient

    procedure, , is given by [See Eq. (19)].

    The new generates a different charge density from the density

    generated by previous , and so the electronic potentials in the K-SHamiltonian must be updated before commencing the next iteration.

    min

    { }

    { }

    { }

    { }[ ] )33(......................)(

    )()(Re2

    )()(Re2*1

    2

    2

    32*

    2

    2

    0

    3*

    2

    2

    02

    2

    rdn

    Vf

    rdeG

    ef

    HH

    termsXCHartreeHHE

    xcm

    i

    m

    i

    m

    i

    m

    i

    i

    o

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i

    rrr

    rrG

    rG

    +

    +

    =

    =++=

    =

    )34(................................sincosminmin

    1 mi

    m

    i

    m

    i +=+

    1+m

    i

    1+m

    i

    m

    i

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    19/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method

    Trial Wavefunction for a particular band,m

    i

    Calculate the steepest-descent vector,

    * Computational Procedure of the CG Method

    m

    i

    m

    i

    m

    i H =

    Orthogonalize to all bands, jm

    iij

    j

    m

    i

    m

    i =

    Compute the preconditioning steepest-descent vector, mi

    m

    i K =

    Orthogonalize to all bands, jij

    m

    ij

    m

    i

    m

    i

    m

    i

    m

    i

    m

    i =

    Determine the conjugate direction,

    Orthogonalize to the present band and normalize,

    Calculate the K-S energy at initial value of ,

    Calculate the value of that minimizes the K-S energy functional.

    Construct a new trial wavefunction,

    1+= mi

    m

    i

    m

    i

    m

    i

    m

    i

    )2sin()2cos()(11

    avg

    ++=

    minmin

    1 sincos mi

    m

    i

    m

    i +=+

    Repeat

    until

    converged.

  • 8/12/2019 (14) Iterative Minimization of Energy Part 2

    20/20

    Iterative Minimization of the Kohn-Sham Energyby the Conjugate-Gradient Method