First Principles with DFT

Yosuke Kanai UNC Chapel Hill First Principles (ab Initio) Molecular Dynamics (some books call it “Quantum MD”)

Molecular Dynamics (MD) simulation in which nuclei (i.e. atoms-electrons) move according to forces that are obtained from DFT calculation.

• Born Oppenheimer Molecular Dynamics (BOMD)

• Car Parrinello (extended Lagrangian) Molecular Dynamics (CPMD) dA d 2 A Recall Classical Mechanics formulations A! ≡ A!! ≡ dt dt 2

Newton (1643-1727): Equation of Motion N U =U (R ) F = −∇ U = M R!! I RI I I Atom positions

Lagrange (1736-1813):

N M R! 2 ! I I d ∂L ∂L L(R,R) = ∑ −U = I=1 2 ! dt ∂RI ∂RI

Hamilton (1805-1865):

N H(P, R) = P ⋅R! − L ∂H P ∂H ∑ I I R! = = I P! = = F I=1 I I I ∂PI M I ∂RI N P 2 = ∑ I +U I=1 2M I

Principle of Least Action is omitted here. Modern Molecular Dynamics formulation

Lagrange (1736-1813):

N M R! 2 d ∂L ∂L L(R,R!) = I I −U = ∑ dt ∂R! ∂R I=1 2 I I

M R!! = F = −∇ U (R) I I I RI

�(�) : Potential Energy - a mathematical function of 3 Natom variables.

“Classical” MD - a set of analytical functions with empirical parameters are used to model U(R) approximately.

First-Principles MD - U(R) is obtained by approximately solving electronic Schrödinger Eq. for a particular R from first principles (e.g. using DFT). Potential Energy Curve for O-O Potential Energy Surface for F-H-Cl Potential Energy

Molecular Dynamics simulation M R!! = F = −∇ U (R) I I I RI

Various properties can be obtained as a function of Volume, Pressure, and Temperature.

0 Classical ensemble average 1 � = , �- �̇ - 3 �̇ - 3��+ -./ 0 1 � = , � �̇ 3 �̇ − � 3 ∇ �(�)) 3� - - - - �8 -./ Example. Simulation of Liquid Water at Silicon Surface

By Donghwa Lee

Dependence of Water Dynamics on Molecular Adsorbates near Hydrophobic Surfaces: First- Principles Molecular Dynamics Study D. Lee, E. Schwegler, Y. Kanai. J. Phys. Chem. C, 118, 8508 (2014) How is the interface modeled?

Simulation cell

Periodic Boundary Conditions (PBC) is used. Surface (~4Å)

Bulk-like (~15Å)

Surface (~4Å) One needs to make sure the water region as well as silicon part is large enough such that calculated properties are converged.

“Finite size error” needs to be minimized. Molecular Dynamics Simulation Step

For a given {RI(t)}, calculate U({R}) or equivalently the force on atoms (F=-▽RU).

Move the atoms using a numerical integrator (e.g. Verlet algorithm)

!! * Approximately solve M I R I = F I = − ∇ R U ( R ) on a computer with a finite Δt. I 2 e.g. RI(t+Δt)=2RI(t)-RI(t-Δt)+Δt FI(t)/MI

* T and P can be controlled by using so-called “thermostats”. e.g. Velocity scaling thermostat

Update atomic positions: Ri(t)=Ri(t+Δt) Molecular Dynamics details omitted

Numerical Integrator for Computational Simulation Many numerical approaches exist. Velocity Verlet is probably the most widely used integrator.

Calculating Ensemble-averaged quantities from Time-averages: Ergodicity 1 @EF@ � = : �(�, �̇ )� �, �̇ ����̇ = lim D �(�(�G), �̇ (�G))��′ @→B � @E

̇ ̇ � �, �̇ = �J/�JL �,� /NOP � = : �JL �,� /NOP ����̇

NVE – microcanonical ensemble vs. NVT – canonical ensemble

Thermostats

∗ Velocity scaling approaches �-�̈ - = � � -(�-/�)(� /� − 1) �̇ - e.g. Berendesen

Extended Lagrangian approaches [ \ _ e.g. Nose � = ∑ 8 �\�̇ − � � + �̇ \ − �� �∗ ln � 0WXY - \ - \ + A typical mathematical expression for Pottential Energgy, U, in classical MD

U({Ri})

Empirical parameters are determined by fitting to experiments and calculations. First Principles (Born Oppenheimer) Molecular Dynamics

M R!! = F = −∇ U (R) I I I RI

U (R) = E Ψ (R) , R 0 ( 0 )

!! ˆ M I RI = −∇R E Ψ0 (R) , R = −∇R min Ψ (R) H Ψ(R) I ( ) I Ψ

Note : Atom → Nucleus (RI) + Electrons (ri)

2 2 2 ! 2 1 e Z e 1 Z Z e Hˆ I I I ' = ∑− ∇i + ∑ −∑ + ∑ i 2me 2 i≠i' ri - ri' iI ri − R I 2 I≠I R I − R I'

Classical nuclear-nuclear repulsion

Where does DFT come in? Hellmann-Feynman Theorem Ψ(rn ;R) Parametric dependence on nuclear positions Force on nucleus that is indexed with I (i.e. not explicit function of nuclear positions)

ˆ ˆ FI = −∇R min Ψ (R) H Ψ(R) = −∇R Ψ0 (R) H Ψ0 (R) I Ψ I

= − Ψ (R) ∇ Hˆ Ψ (R) − ∇ Ψ (R) Hˆ Ψ (R) − Ψ (R) Hˆ ∇ Ψ (R) 0 RI 0 RI 0 0 0 RI 0

= − Ψ (R) ∇ Hˆ Ψ (R) − E ∇ Ψ (R) Ψ (R) − E Ψ (R) ∇ Ψ (R) 0 RI 0 0 RI 0 0 0 0 RI 0

= − Ψ (R) ∇ Hˆ Ψ (R) − E ∇ Ψ (R) Ψ (R) 0 RI 0 0 RI 0 0

= − Ψ (R) ∇ Hˆ Ψ (R) 0 RI 0 Recall the expression for the Hamiltonian

2 2 2 ! 2 1 e Z e 1 Z Z e Hˆ I I I ' = ∑− ∇i + ∑ −∑ + ∑ i 2me 2 i≠i' ri - ri' iI ri − R I 2 I≠I R I − R I'

Classical nuclei repulsion Its derivative with respect to RI is

Z e2 Z Z e2 ∇ Hˆ = − ∇ I + ∇ I I ' RI ∑ RI ∑ RI i ri − RI I ' RI − RI' Force on a nucleus, I, is then given by

F = − Ψ (R) ∇ Hˆ Ψ (R) I 0 RI 0

Z Z e2 Z e2 = − ∇ I I ' + Ψ* (r ...r ;R)∇ I Ψ (r ...r ;R)dr ...dr ∑ RI ∑ ∫ 0 1 n RI 0 1 n 1 n I ' RI − RI' i ri − RI

Electron density ∗ � �; � ≡ � ∫ Ψi �, �\…�k; � Ψi �, �\…�k; � ��\…��k

Z Z e2 Z e2 = − ∇ I I ' + ρ(r;R)∇ I dr ∑ RI ∫ RI I ' RI − RI' r − RI

* DFT naturally gives the essential ingredient for performing MD simulations. m 1 First-Principles Molecular Dynamics based on DFT e = ! =1

1. For positions of nuclei, {R1…RN}, and solve DFT-KS equations self-consistently

2 1 2 Z e ρ(r') [ I dr'+ v (r)] (r) = (r) − ∇ −∑ + ∫ XC ψi εiψi 2 I r − RI r − r' occ 2 (r) = 2 (r) ρ ∑ ψi i 2. Calculate force on each nucleus/ion: MD Simulation MD Z Z e2 Z e2 F = − ∇ I I ' + ρ(r;R)∇ I dr I ∑ RI ∫ RI I ' RI − RI' r − RI

3. Integrate equation of motion for the nuclei: perform a time step (Δt) and find new positions for the nuclei !! M I RI (t) = FI (R(t)) What about Hellmann-Feynman (HF) force in practice ? ˆ ˆ FI = −∇R min Ψ (R) H Ψ(R) = −∇R Ψ0 (R) H Ψ0 (R) I Ψ I

= − Ψ (R) ∇ Hˆ Ψ (R) − ∇ Ψ (R) Hˆ Ψ (R) − Ψ (R) Hˆ ∇ Ψ (R) 0 RI 0 RI 0 0 0 RI 0

= − Ψ (R) ∇ Hˆ Ψ (R) − E ∇ Ψ (R) Ψ (R) − E Ψ (R) ∇ Ψ (R) 0 RI 0 0 RI 0 0 0 0 RI 0

ˆ ˆ = − Ψ0 (R) ∇R H Ψ0 (R) − E0∇R Ψ0 (R) Ψ0 (R) = − Ψ (R) ∇ H Ψ (R) I I 0 RI 0

Only if the wave function is the exact G.S. solution of the Schrodinger equation. * completeness In the DFT language (in terms of electron density)

Z Z e2 F = − ∇ I I ' − ∇ E DFT [ρ;R] I ∑ RI RI I ' RI − RI' Z Z e2 Z e2 δE DFT = − ∇ I I ' + ρ(r;R)∇ I dr − ∇ ρ(r;R)dr ∑ RI ∫ RI ∫ RI I ' RI − RI' r − RI δρ(r;R) F! Nuclei repulsion HF force I Z Z e2 Z e2 F = − ∇ I I ' + ρ(r;R)∇ I dr + F! I ∑ RI ∫ RI I I ' RI − RI' r − RI

E KS−DFT " ,R$ Forces in Kohn-Sham DFT: #{ψi } %

! $ * δE δE F! = #∇ ψ (r;R) + ∇ ψ (r;R) &dr I ∑ ∫ # RI i * RI i & i " δψi (r;R) δψi (r;R)%

* ˆ ˆ * = ∇R ψk (r;R)(H KS −εi )ψi (r;R) + ∇R ψi (r;R)(H KS −εi )ψi (r;R) dr ∑ ∫ ( I I ) i Vanishes only for exact KS eigenfunctions.

Forces in Kohn-Sham DFT numerical calculations: (r;R) = c(i) (r;R) ψi ∑ m χ m m ˆ Hmg = χ m H KS χ g *Basis set completeness F! = ∇ c(i) (H −ε )c(i) + c(i)c(i) ∇ χ * (r;R)(Hˆ −ε )χ (r;R)dr + c.c. I ∑∑ RI m mg i g ∑ m g ∫ RI m KS i g i g,m g,m Vanishes for exact KS eigenfunc. Vanishes if basis set is R-independent. (H )c(i) 0 ∑ mg −εi g = g Remark about Basis Set

Numerical Atom-Centered Orbitals (NAO): discussed by V. Blum

Codes : FHI-aims, etc

Gaussians Type Orbitals (GTO) : Gaussian functions centered on atomic nuclei are used as basis set functions. Many integrals can be calculated analytically.

Codes : GAUSSIAN, Q-Chem

Planewaves (PW) : Planewaves are used as basis set functions, convenient when the periodic boundary conditions is used. It is often used with to replace core electrons.

Codes: Quantum-Espresso, Qbox/Qb@ll

Popular for FPMD because the basis set does not depend on the nuclear positions (no Pulay force to implement in codes). Car Parrinello (extended Lagrangian) Molecular Dynamics: “CPMD”

Review : Car-Parrinello Molecular Dynamics Jurg Hutter, Wires – Computational Molecular Science, 2, 513 (2012)

Popular codes for performing CPMD CPMD, CP code (Q-Espresso), Qbox, Qb@ll, etc.

*CP2K does not have CPMD!

By Thomas D. Kühne Car Parrinello extended Lagrangian Lagrange multiplier for enforcing orthonormality

n N ! 2 CP µ M R L (R,R!; ψ ) = ψ! ψ! + I I − E[ ψ ;R]+ Λ ψ ψ −δ { i } ∑ i i ∑ { i } ∑ i, j ( i j ij ) i=1 2 I=1 2 i, j

Fictitious mass parameter for electronic degrees of freedom.

ψi (r,t) are treated as if they are classical fields.

d ∂L ∂L M R!! E = I I = −∇R +∑Λi, j∇R ψi ψ j ! I I dt ∂RI ∂RI i, j Z Z e2 Z e2 = − ∇ I I ' + ρ(r;R)∇ I dr + Λ ∇ ψ ψ ∑ RI ∫ RI ∑ i, j RI i j I ' RI − RI' r − RI i, j d ∂L ∂L = δE ! µψ!! (r,t) = − + Λ ψ dt ∂ ψi ∂ ψi i ∑ i, j j δ ψi j

Hˆ = − KS ψi +∑Λi, j ψ j j Why/when can CPMD work?

There needs to be ”adiabatic” separation (no energy exchange) between artificial electronic motion and real ionic/nuclear motion.

To achieve such, How do you find an appropriate fictitious electron parameter μ ?

Characteristic frequency of the slowest “electronic motion” is related to HOMO-LUMO energy gap, and it must be higher than fastest nuclear/ionic motion.

1/2 ! E $ ω min ≈ # gap & > ω max e # & Ion " µ %

Example: System with H atom: μ~ 500 a.u. Δt ~ 5-10 a.u. = 0.1-0.2 femto-seconds Car Parrinello Molecular Dynamics in a nutshell

“The heart of the matter is the ‘‘on the fly’’ calculation of the potential energy surface for nuclear motion, without performing a self-consistent diagonalization of the Kohn– Sham Hamiltonian at each time step…

The Car–Parrinello approach has remarkable time stability, which derives from energy conservation in the extended parameter space of electrons and nuclei…

Considerably larger drifts occur in Born–Oppenheimer simulations due to accumulation of the systematic errors in the electron minimization.”

Roberto Car in “AB INITIO Molecular Dynamics: Dynamics and Thermodynamic Properties” (2006) Applications Electron localization on CO2 in Water

Injection of an extra electron:

Single-Particle Energy Levels

- CO2 - LUMO e OCO angle (deg) angle OCO (H2O)s - LUMO CBM/LUMO Simulation time (ps)

VBM/HOMO

Simulation

Material CO2 in water

Experiment (deg) angle OCO Zhang, LH. Et al. Angwdt. Chemie, 53, 9746 (2014) Simulation time (ps) Electron Localization on CO2 in water

mostly

) (H2O)s - LUMO mostly eV ( CO2 - LUMO OCO angle (deg) angle OCO OCO angle (deg) angle OCO Eigenvalue

Simulation time (ps) Simulation time (ps) Density associate w/ the extra electron (spin density) Key observations

The electron dynamically localizes somewhat

around CO2 as the bending angle fluctuates. OCO angle (deg) angle OCO Large stochastic fluctuations prompt the electron to

localize(kcal/mol) Energy Free further, and it reciprocally causes the angle

to become smaller as CO2 anion.

SimulationOCO angle time (deg) (ps) Band splitting due to Spin Orbit Coupling (SOC)

CsPbI3

J. Phys. Chem. C 123, 291 (2019) Challenges in FPMD

You have exciting opportunities to contribute and advance the field! Challenges : Exchange-Correlation (XC) Functional

Pair Correlation Function, g(r) Probability of finding another particle (e.g. O atom) at a given distance from a particle. Challenges : Nuclear Quantum Effect (NQE)

Nuclei can be treated as quantum-mechanical particles using Feynman’s path integral (PI) formulation. TRPMD is a recent PI method by Ceriotti, et al.

3.5 3 classical nuclei MD 2.5 TRPMD Artificial neural network technique was used 2 EXP to “learn” FPMD simulation.

gOO 1.5 1 0.5 0 Yao and Kanai, J. Chem. Phys. 153, 044114 2 2.5 3 3.5 4 4.5 5 5.5 6 (2020) r(OO) Å 2.5 2 classical nuclei MD TRPMD 1.5 EXP gOH 1 Agreement to experiment improves 0.5 0 when NQE is accounted for properties 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 like gOH and gHH. r(OH) Å 2.5 2 classical nuclei MD The disagreement for gOO remains, TRPMD 1.5 EXP likely due to XC error. gHH 1 0.5 0 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 r(HH) Å Challenges : “Rare” event problem

Charge Localization, Stabilization, and Hopping in Lead Halide Perovskites: Competition between Polaron Stabilization and Cation Disorder F. Ambrosio, D. Meggiolaro, E. Mosconi, and F. De Angelis

ACS Energy Lett. 4, 2013 (2019)

hole ACS Energy Lett. 4, 2013, (2019)

hole Rare-event problem

You may not observe such a transition if energy barrier is high (unless FPMD is very very long).

Advanced approaches (Nudged Elastic Band, String, Meta- Dynamics) are needed but they are not without inconveniences. Challenges : Accounting for Electron Dynamics

In FPMD (both BOMD and CPMD*), electrons remain in the ground state of given nucler positions; no quantum dynamics of electrons are included.

*Electron dynamics in CPMD is fictitious, not real quantum dynamics

Born Oppenheimer Molecular Dynamics ̈ noP �-�- = −∇�l� �i; �

Ehrenfest Dynamics (with Time-Dependent DFT) occ !! DFT 2 M R = −∇ E [ρ(t);R] ρ(r,t) = 2 φi (r,t) I I RI ∑ i

d i! φ (t) = Hˆ #ρ(r,t)% φ (t) dt i KS $ & i

Tˆ Vˆ (t) Vˆ " (t)$ Vˆ " (t)$ (t) = { + ext + Hatree #ρ %+ XC #ρ %} φi Challenges : Accounting for Electron Dynamics

Ehrenfest Dynamics example : Nuclei can move in response to the quantum dynamics of electrons caused by optical excitation.

A single water at rest is electronically excited with electric field (in Z direction) that corresponds to 8.75 eV photon absorption.

By Chris Shepard

Electric field pulse applied at this point END