DFT in practice - th.fhi-berlin.mpg.de

Post on 26-Oct-2021

7 views 0 download

Transcript of DFT in practice - th.fhi-berlin.mpg.de

DFT in practice

Sergey V. Levchenko

Fritz-Haber-Institutder MPG, Berlin, DE

Outline

• From fundamental theory to practical solutions

• General concepts:

- basis sets - integrals and grids, electrostatics, molecules and clusters versus periodic systems- scalar relativity- solution of the eigenvalue problem

Equations to be solved

Hohenberg-Kohn theorems

� � → �� → Ψ ��,��,…,��; {�} → �[�],…Electron density

� � = ��Ψ∗ �,��,…,��; {�} Ψ �,��,…,��; {�} ���� …����

�� �� � − � �� � ��� − � = 0 → � � ,�,�…

Variational principle:

� � −?

� = Ψ �� Ψ = −�

�∫Ψ∗ ��,��,… ∑

��

����

���� Ψ ��,��,… � � −

−∫Ψ∗ ��,��,… ∑��

������,� Ψ ��,��,… � � +

+∫Ψ∗ ��,��,… ∑�

������,� Ψ ��,��,… � � =

= −�

�∫

���� �,��

���������

��� − ∫� � ∑��

����� ��� + ∫

� �,��

����������′

Equations to be solved

with one- and two-particle density matrices:

�� �,�� = �Ψ∗ �,��,… Ψ �′,��,… ���� …����

� �,�� = �Ψ∗ �,�′,�� … Ψ �,�′,��,… ���� …����

Problem: kinetic energy and electron-electron interaction energy as a functional of �(�) -- ?

Equations to be solved

Kohn-Sham approach:

�������� + ���� = −�

�∑ �� ∫��

∗ � ���� � ���� +

∫� � �(��)

����������� + ���[�]

where functions �� represent the density: � � = ∑ �� �� � ��

�� �� � − � ∫� � ��� − � = 0 →

���∗ �

� � − ∑ �� �� �� − 1� = 0 →

(Generalized) Kohn-Sham equations:

−��

�+ ���� � + ∫

� ��

�������� �� � + ∫���,�[{�}] �,�� �� �� ���� =

= ���� �

Solving Kohn-Sham equations

−��

�+ ���� � + ∫

� ��

�������� �� � + ∫���,�[{�}] �,�� �� �� ���� =

= ���� �

Initial guess: e.g. density

Calculate potential

Construct Hamiltonian

Obtain new eigenvalues, eigenvectors, and density

Converged?Update density / density matrix

(mixer, preconditioner)

Update potential

Yes

No

n0

V0

n j

nj+1= nj+f(Δn)

V j+1

Self-consistent field method

When is the calculation finished?• Answer: When „property“ does not change

Convergence

Convergence threshold Very strictVery loose

Typical „properties“ to converge:

Change of the density n

Change of the sum of eigenvalues

Change of the total energy

Options differ between codes

Initial guess: e.g. density

Calculate potential

Construct Hamiltonian

Obtain new eigenvalues, eigenvectors, and density

Converged?Update density / density matrix

(mixer, preconditioner)

Update potential

Yes

No

n0

V0

n j

nj+1= nj+f(Δn)

V j+1

Self-consistent field method (SCF)

Importance of the initial guessElectronic structure exhibits multiple minima

• Qualitatively different behavior depending on guess

• Common issue for magnetic solids

1O2

3O2

Initial guess

Importance of the initial guessElectronic structure exhibits multiple minima

• Qualitatively different behavior depending on guess

• Common issue for magnetic solids

1O2

3O2

How do we find „the right“ initial guess?

Initial guess

Random initialization• Traditional approach (for bandstructure

codes)

Initial guess

Superposition of spheric atomicdensities

• Most common (for bandstructure codes)

Initial guess

Extended Hückel Model [1]

Semi-empirical method:

- Linear combination of atomic orbitals

- Hamiltonian parameterized:

- Density from orbitals:

Initial guess

[1] R. Hoffmann, J Chem. Phys (1963), 1397; [2] R. S. Mulliken, J. Chem. Phys. (1946) 497; [3] M. Wolfsberg and L. Helmholtz, J. Chem. Phys (1952), 837

Initial guess: e.g. density

Calculate potential

Construct Hamiltonian

Obtain new eigenvalues, eigenvectors, and density

Converged?Update density / density matrix

(mixer, preconditioner)

Update potential

Yes

No

n0

V0

n j

nj+1= nj+f(Δn)

V j+1

Self-consistent field method (SCF)

Calculate new density from Kohn-Sham orbitals

Replace old density by new density

nnn jj =1

Example: H2, d=1.5Å, projected in 1 dimension

Density Update

Naive Mixing

Calculate new density from Kohn-Sham orbitals

Replace old density by new density

nnn jj =1

Example: H2, d=1.5Å, projected in 1 dimension

Density Update

Naive Mixing

Typically does not work

- Best case: Osciallating, non-converging results- Worst case: Bistable, apparently converged

solution

Calculate new density from Kohn-Sham orbitals

Replace old density by new density

Example: H2, d=1.5Å, projected in 1 dimension

Density Update

Linear Mixing

nnn jj = a1

Calculate new density from Kohn-Sham orbitals

Replace old density by new density

Example: H2, d=1.5Å, projected in 1 dimension

Density Update

Linear Mixing

nnn jj = a1

Calculate new density from Kohn-Sham orbitals

Replace old density by new density

Example: H2, d=1.5Å, projected in 1 dimension

Density Update

Linear Mixing

nnn jj = a1

Calculate new density from Kohn-Sham orbitals

Replace old density by new density

Example: H2, d=1.5Å, projected in 1 dimension

Density Update

Linear Mixing

nnn jj = a1

system dependent

No clear recipe to choose ideal α

Guaranteed convergence

[1] P. Pulay, Chem. Phys. Lett. 73 , 393 (1980).

Density Update

Define residual:

Change between input and output density

Predict residual of next step from previous steps

Idea: obtain b minimizing norm ∫���� � � ����

Pitfall: Only use limited number of previous steps

Pulay Mixing [1](Direct Inversion of Iterative Subspace)

[1] P. Pulay, Chem. Phys. Lett. 73 , 393 (1980).

Density Update

Construct „optimal density“ minimizing residual norm, form new density

Learning from previous steps

Ideal case: convergence independent of a

Rules of thumb:

- a = 0.2 .. 0.6 for insulators

- a = 0.05 for metals

Pulay Mixing [1](Direct Inversion of Iterative Subspace)

[1] P. Pulay, Chem. Phys. Lett. 73 , 393 (1980).

Density Update

Construct „optimal density“ minimizing residual norm, form new density

Learning from previous steps

Ideal case: convergence independent of a

Rules of thumb:

- a = 0.2 .. 0.6 for insulators

- a = 0.05 for metals

Pulay Mixing [1](Direct Inversion of Iterative Subspace)

Much faster than linear mixing

No guarantee for congerence

Kerker (charge) preconditioning

Problem: Charge Sloshing

Charge „bounces“ back and forth

(Lack of) balance between long-range and short-range charge re-distribution

Typical for metals

Often encountered in „defective“ systems Localized defects (vacancies, interstitials)

Surfaces, Slabs, Thin Films

Density Update

Charge preconditioning

Solution: Make α depend on ��(�)

Concept:

Treat density change in Fourier space:

Damp long-range oscillations:

Density Update

���� � = �� � + �Δ� � → ����� � = ��� � + �Δ�� �

�� � =1

�� � ��������

q0: Screening parameter

q >> q0: G ≈ a

Normal mixing

q << q0: G ≈ aq2/q02

Damping

� = ���

�� + ���

Charge preconditioning

Density Update

8 layer Al slab, PBE calculation

no a priori known ideal choice for q0

Reasonable guess fromThomas-Fermi:

q0: Screening parameter� = ���

�� + ���

A special problem: Metallic systems

Density Update

http://www.phys.ufl.edu/fermisurface/periodic_table.html

Metallic properties determined by Fermi surface

Fermi-surface: Collection of k-points at which e = eFermi

At eFermi occupation changes from 1 to 0

Problem: Frequent „level switching“ during SCF

A special problem: Metallic systems

Density Update

Solution: Replace step function by a more smooth function

Methfessel-Paxton [3]

[1] N. Mermin, Phys. Rev.137 , A1441 (1965).[2] C.-L. Fu, K.-H. Ho, Phys. Rev. B 28 , 5480 (1983). [3] M. Methfessel, A. Paxton, Phys. Rev. B 40 , 3616 (1989).

Gaussian [2]

Fermi [1]

A special problem: Metallic systems

Density Update

Physical implications:

• States become fractionally occupied

• In DFT, well defined as ensemble average

• Broadening is not electron temperature (except: Fermi)

Numerical Implications

• Level switching is damped

• Much faster convergence

• Total energy now dependson σ, no longer variational

• Back-extrapolation possible

Cu (111), 5 layer slab, Gaussiansmearing, PBE calculation, 12x12x1 k-points

Pitfall: Adsorption of molecules

Summary SCF

Ground state electron density determined iteratively

Initial guess needs initial thought, can change results qualiatively

Density update by– Linear mixing (slow)

– Pulay mixing

Convergence acceleration by – Preconditioner

– Broadening of states

Representing KS states: Basis sets

The tool for this workshop: FHI-aims (NAOs)

Our choice: Numeric atom-centered basis functions

Our choice: Numeric atom-centered basis functions

Constructing a basis-set library

Iterative selection of NAO basis functions

Result: Hierarchical basis set library for all elements

Accuracy: (H2O)2 hydrogen bond energy

Basis-set superposition error (BSSE)

By construction, our NAO basis sets are close to completeness for very small BSSE for atomic dimers

Basis-set superposition error (BSSE)

Using numeric atom-centered basis functions

Numeric atom-centered basis functions: Integration

Overlapping atom-centered grids: “Partitioning of unity”

Integration in practice: Large systems - small errors!

Hartree potential (electrostatics): Overlapping multipoles

Electrostatics: convergence with ����

Periodic systems

Structure optimization

Global structure search

Born-Oppenheimer energy surface can contain several minima– Constitution isomery

– Configuration isomery

– Conformation isomery

– Polymorphism

50

• System in equilibrium is given by ensemble average over all minima

• Often dominated by global minimum (but watch out for tautomers)

Global structure search

Methods to find the global minimum:

o Basin Hopping

o Molecular dynamics: o Simulated annealing

o Minima Hopping

o Metadynamics

o Cluster expansion

o Genetic algorithm

o Diffusion methods

Local structure optimization

Once we have a reasonable guess, find closest minimum

Different approaches possible:– Mapping of the potential energy surface

• Requires a lot of calculations

• Typically only for dynamics

52

dCC

aCCO

Local structure optimization

Once we have a reasonable guess, find closest minimum

Different approaches possible:– Mapping of the whole potential energy surface

– Gradient free method: e.g., simplex

– Gradient-based methods

• Calculate gradient (a.k.a. „forces“)

� = −��

��

Total energy gradient

Search for minimum by following the gradient

��

��= �

���

��� +

���

���� � + � ��

���

��

������������������

= �� ∑�� �����

������� + �� ∫

� � ����

���� � ���

��=

��

��

��+

��

��

��• First term vanishes

• Second term survives foratom-centered basis functions Pulay forces

(vanish when basis set approaches completeness)

Total energy gradient

Search for minimum by following the gradient

Additional contributions from atom-centeredapproximations– Multipole expansion

– Relativistic corrections

– (Integration grids)

All straightforward but lengthy

Once we have the Force, how do we find the minimum?

��

��= �

���

��� +

���

���� � + � ��

���

��

Geometry update – Steepest descent

Follow negative gradient to find minimum

Step-length α variable

Guaranteed but slow convergence

Oscillates near minimum

Not suitable for saddle points

Improved versions exists– Line minimization

(optimal step length)

– Conjugated gradient [1]

[1] M. Hestenes, E. Stiefel (1952). "Methods of Conjugate Gradients for Solving Linear Systems"

Geometry update – (Quasi)Newton Methods

Approximate PES by quadratic function

Find minimum:

Newton: calculate exact HExpensive! Cheaper method needed

... Hessian

[1] J. Nocedal and S. J. Wright, “Numerical optimization” (Springer, 2006)

� Δ� ≈ � �� +��

�������

Δ� +�

�∑

���

�����������

������

−� ��

Geometry update – (Quasi)Newton Methods

Approximate PES by quadratic function

Find minimum:– Newton: calculate exact H

– Quasi-Newton: approximate H

• Update as search progresses [1]

[1] J. Nocedal and S. J. Wright, “Numerical optimization” (Springer, 2006)

... Hessian

� Δ� ≈ � �� +��

�������

Δ� +�

�∑

���

�����������

������

−� ��

Geometry update – (Quasi)Newton Methods

Guess initial Hessian

Simple choice: Scaled unit matrix

Chemically motivated choice (e.g.: Lindh [1])

[1] R. Lindh et al. , Chem. Phys. Lett. 241 , 423 (1995).

streching

bending

torsion

k parameterized [1]

Update as search progresses [2]

[2] J. Nocedal and S. J. Wright, “Numerical optimization” (Springer, 2006)

Geometry update – (Quasi)Newton Methods

Initial Hessian is critical for performance

May even influence result

(combination with convergence thresholds)

Courtesy of Elisabeth Wruss

Diagonal Hessian Model Hessian (Fischer)

Lower in energy

Challenges of Quasi-Newton Methods

Soft degrees of freedom can cause large ΔR

Step control needed:– Line search method: If new point is worse than old, interpolate

– Trust radius method

• Enforce upper limit for ΔR

• Evaluate quality of quadratic model

• Adjust ΔRmax based on q

Conclusions

(Global optimization: PES feature-rich, methods to find global minima exist)

Local geometry optimization: Follow gradient– Hellman-Feynman from moving potentials

– Pulay from moving basis functions

– + additional terms

Quasi-Newton method de-facto standard– Requires approximation and update of Hessian

– Step control by line search or trust radius method

Vibrations in the harmonic approximation

Why calculating vibrations?

Vibrations give important information about the system:– Classification of stationary points (minimum / saddle point)

– If saddle-point: Provides search direction

– Thermodynamic data

• Zero-point energy

• Partition sum

• Finite-temperature effects

– Connection to experiment:

• Infrared intensities: derivative of dipole moment

• Raman intensities: derivative of polarizabilty

How good is the harmonic approximatino?

Morse-potential:

Morse:

Harmonic oscillator:

Harmonic osc.

How good is the harmonic approximation?

Morse-potential:

Morse:

Harmonic oscillator:

Harmonic osc.

Morse:

Harmonic osc.

Reasonable modelfor small displacements(~10% of bond length)

Maximum displacement:

About 0.1Å at roomtemperature

Vibrations

Expand Energy in Taylor series:

Hessian H

Interpretation of results:

• Single negative ω: Transition state

Calculating Vibrations

Solve Newton‘s equations of motion:– Exponential ansatz:

– Leads to generalized eigenvalue problem:

�~���/���

From vibrations to thermodynamics

Partition function

Free energy for finite temperature

Hessian from geometry optimization is not sufficent– Analytic second derivative using perturbation theory [1]

– Numerical differentiation

• Computationally very expensive

• Contains parameter (displacement), needs to be checked carefully

• Often single displacement is not sensible to sample all vibrations

[1] S. Baroni et al. , Rev. Mod. Phys. 73 , 515 (2001).

Conclusions

Often calculated in harmonic approximation

Yield information about stability of geometry

Required for temperature effects

Anharmonic effects via molecular dynamics

Relativity

Simple approximation to scalar relativity

Simple approximation to scalar relativity

Fixing ZORA

Atomic ZORA and scaled ZORA in practice

Computational scaling: two subproblems

CPU time versus system size

CPU time versus system size

Parallel eigenvalue solvers - the problem

Parallel eigenvalue solvers - the problem

A massively-parallel dense eigensolver: ELPA

The key improvement: two-step trigonalization

The key improvement: Two-step trigonalization

ELPA: Performance

ELPA: Performance (Cray XC30, 2013)

Generalized Kohn-Sham DFT: Exact exchange

Resolution of identity (RI)

Hybrid functionals -- scaling with system size

Periodic GaAs, HSE06 hybrid functional

Hybrid functionals -- CPU scaling

Periodic GaAs, HSE06 hybrid functional

Summary

Our approach to all-electron simulations: FHI-aims

Volker Blum(Duke Univ.)

Igor Ying Zhang (FHI)

Karsten Reuter (TU Munich)

Patrick Rinke (Aalto Univ., Finland)

Ville Havu (Aalto Univ., Finland)