0% found this document useful (0 votes)
94 views

MQ Intro

This document contains lecture notes on numerical methods in quantum mechanics. It covers several topics: solving the one-dimensional Schrodinger equation using Numerov's method; solving the radial Schrodinger equation for central potentials like hydrogen; calculating scattering cross sections; using the variational principle and plane wave basis sets; the Hartree, Hartree-Fock, and self-consistent field approximations; and applying these methods to molecules and periodic potentials. The notes include mathematical descriptions and examples of computer codes implemented for different numerical solutions.

Uploaded by

Hans
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

MQ Intro

This document contains lecture notes on numerical methods in quantum mechanics. It covers several topics: solving the one-dimensional Schrodinger equation using Numerov's method; solving the radial Schrodinger equation for central potentials like hydrogen; calculating scattering cross sections; using the variational principle and plane wave basis sets; the Hartree, Hartree-Fock, and self-consistent field approximations; and applying these methods to molecules and periodic potentials. The notes include mathematical descriptions and examples of computer codes implemented for different numerical solutions.

Uploaded by

Hans
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lecture notes

Numerical Methods in
Quantum Mechanics

Corso di Laurea Magistrale in Fisica

Interateneo Trieste – Udine

Anno accademico 2018/2019

Paolo Giannozzi
University of Udine

Contains software and material written by

Furio Ercolessi1 and Stefano de Gironcoli2


1 Formerly at University of Udine
2 SISSA - Trieste

Last modified March 28, 2019


Contents

Introduction 1
0.1 About Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
0.1.1 Compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
0.1.2 Visualization Tools . . . . . . . . . . . . . . . . . . . . . . 2
0.1.3 Mathematical Libraries . . . . . . . . . . . . . . . . . . . 2
0.1.4 Pitfalls in C-Fortran interlanguage calls . . . . . . . . . . 3
0.2 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1 One-dimensional Schrödinger equation 5


1.1 The harmonic oscillator . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.1 Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.2 Exact solution . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.3 Comparison with classical probability density . . . . . . . 8
1.2 Quantum mechanics and numerical codes: some observations . . 9
1.2.1 Quantization . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.2 A pitfall: pathological asymptotic behavior . . . . . . . . 9
1.3 Numerov’s method . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.1 Code: harmonic0 . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.2 Code: harmonic1 . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.3 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2 Schrödinger equation for central potentials 16


2.1 Variable separation . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.1 Radial equation . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2 Coulomb potential . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2.1 Energy levels . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.2 Radial wave functions . . . . . . . . . . . . . . . . . . . . 20
2.3 Code: hydrogen radial . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3.1 Logarithmic grid . . . . . . . . . . . . . . . . . . . . . . . 21
2.3.2 Improving convergence with perturbation theory . . . . . 22
2.3.3 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3 Scattering from a potential 25


3.1 Short reminder of the theory of scattering . . . . . . . . . . . . . 25
3.2 Scattering of H atoms from rare gases . . . . . . . . . . . . . . . 27
3.2.1 Derivation of Van der Waals interaction . . . . . . . . . . 27

i
3.3 Code: crossection . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.1 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4 The Variational Method 32


4.1 Variational Principle . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.1.1 Demonstration of the variational principle . . . . . . . . . 32
4.1.2 Alternative demonstration of the variational principle . . 33
4.1.3 Ground state energy . . . . . . . . . . . . . . . . . . . . . 34
4.1.4 Variational method in practice . . . . . . . . . . . . . . . 35
4.2 Secular problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.2.1 Expansion into a basis set of orthonormal functions . . . 36
4.3 Plane-wave basis set . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.4 Code: pwell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.4.1 Diagonalization routines . . . . . . . . . . . . . . . . . . . 40
4.4.2 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 41

5 Non-orthonormal basis sets 42


5.1 Non-orthonormal basis set . . . . . . . . . . . . . . . . . . . . . . 42
5.1.1 Gaussian functions . . . . . . . . . . . . . . . . . . . . . . 44
5.1.2 Exponentials . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.2 Code: hydrogen gauss . . . . . . . . . . . . . . . . . . . . . . . . 44
5.2.1 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 46

6 Self-consistent Field 47
6.1 The Hartree Approximation . . . . . . . . . . . . . . . . . . . . . 47
6.2 Hartree Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.2.1 Eigenvalues and Hartree energy . . . . . . . . . . . . . . . 49
6.3 Self-consistent potential . . . . . . . . . . . . . . . . . . . . . . . 50
6.3.1 Self-consistent potential in atoms . . . . . . . . . . . . . . 50
6.4 Code: helium hf radial . . . . . . . . . . . . . . . . . . . . . . . . 51
6.4.1 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 52

7 The Hartree-Fock approximation 53


7.1 Hartree-Fock method . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.1.1 Coulomb and exchange potentials . . . . . . . . . . . . . . 55
7.1.2 Correlation energy . . . . . . . . . . . . . . . . . . . . . . 56
7.1.3 The Helium atom . . . . . . . . . . . . . . . . . . . . . . . 57
7.2 Code: helium hf gauss . . . . . . . . . . . . . . . . . . . . . . . . 57
7.2.1 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 59

8 Molecules 60
8.1 Born-Oppenheimer approximation . . . . . . . . . . . . . . . . . 60
8.2 Potential Energy Surface . . . . . . . . . . . . . . . . . . . . . . . 61
8.3 Diatomic molecules . . . . . . . . . . . . . . . . . . . . . . . . . . 62
8.4 Code: h2 hf gauss . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.4.1 Gaussian integrals . . . . . . . . . . . . . . . . . . . . . . 64
8.4.2 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 65

ii
9 Electrons in periodic potential 67
9.1 Crystalline solids . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
9.1.1 Periodic Boundary Conditions . . . . . . . . . . . . . . . 68
9.1.2 Bloch Theorem . . . . . . . . . . . . . . . . . . . . . . . . 69
9.1.3 The empty potential . . . . . . . . . . . . . . . . . . . . . 69
9.1.4 Solution for the crystal potential . . . . . . . . . . . . . . 70
9.1.5 Plane-wave basis set . . . . . . . . . . . . . . . . . . . . . 71
9.2 Code: periodicwell . . . . . . . . . . . . . . . . . . . . . . . . . . 73
9.2.1 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 74

10 Pseudopotentials 75
10.1 Three-dimensional crystals . . . . . . . . . . . . . . . . . . . . . . 75
10.2 Plane waves, core states, pseudopotentials . . . . . . . . . . . . . 76
10.3 Code: cohenbergstresser . . . . . . . . . . . . . . . . . . . . . . . 77
10.3.1 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . 79

11 Exact diagonalization of quantum spin models 80


11.1 The Heisenberg model . . . . . . . . . . . . . . . . . . . . . . . . 80
11.2 Hilbert space in spin systems . . . . . . . . . . . . . . . . . . . . 81
11.3 Iterative diagonalization . . . . . . . . . . . . . . . . . . . . . . . 82
11.4 Code: heisenberg exact . . . . . . . . . . . . . . . . . . . . . . 83
11.4.1 Computer Laboratory . . . . . . . . . . . . . . . . . . . . 84

12 Density-Functional Theory 86
12.1 Hohenberg-Kohn theorem . . . . . . . . . . . . . . . . . . . . . . 86
12.2 Kohn-Sham equations . . . . . . . . . . . . . . . . . . . . . . . . 87
12.3 Approximated functionals . . . . . . . . . . . . . . . . . . . . . . 88
12.4 Structure of a DFT code . . . . . . . . . . . . . . . . . . . . . . . 89
12.4.1 Matrix elements of the potential . . . . . . . . . . . . . . 90
12.4.2 FFT and FFT grids . . . . . . . . . . . . . . . . . . . . . 91
12.4.3 Computing the charge density . . . . . . . . . . . . . . . . 92
12.4.4 Computing the potential . . . . . . . . . . . . . . . . . . . 93

A Solution of time-dependent Schrödinger equations 94


A.1 Discretization in time: Crank-Nicolson algorithm . . . . . . . . . 95
A.2 Direct discretization of the time evolution operator . . . . . . . . 96

B More on real-space grids 98

C The Helium atom 100


C.1 Perturbative treatment for Helium atom . . . . . . . . . . . . . . 100
C.2 Variational treatment for Helium atom . . . . . . . . . . . . . . . 101
C.3 ”Exact” treatment for Helium atom . . . . . . . . . . . . . . . . 102
C.4 Laboratory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

iii
Introduction

The aim of these lecture notes is to provide an introduction to methods and


techniques used in the numerical solution of simple (non-relativistic) quantum-
mechanical problems, with special emphasis on atomic and condensed-matter
physics. The practical sessions are meant to be a sort of “computational lab-
oratory”, introducing the basic ingredients used in the calculation of materials
properties at a much larger scale. The latter is a very important field of today’s
computational physics, due to its technological interest and potential applica-
tions.
The codes provided during the course are little more than templates. Stu-
dents are expected to analyze them, to run them under various conditions, to
examine their behavior as a function of input data, and most important, to
interpret their output from a physical point of view. The students will be asked
to extend or modify those codes, by adding or modifying some functionalities.
For further insight on the theory of Quantum Mechanics, many excellent
textbooks are available (e.g. Griffiths, Schiff, or the ever-green Dirac and Lan-
dau). For further insight on the properly computational aspects of this course,
we refer to the specialized texts quotes in the Bibliography section, and in
particular to the book of Thijssen.

0.1 About Software


This course assumes some basic knowledge of how to write and execute simple
programs, and how to plot their results. All that is needed is a Fortran or C
compiler and some visualization software. The target machine is a PC running
Linux, but other operating systems can be used as well (including Mac OS-X
and Windows), as long as the mentioned software is installed and working, and
if you know how to use it in practise.

0.1.1 Compilers
In order to run a code written in any programming language, we must first
translate it into machine language, i.e. a language that the computer can
understand. The translation is done by an interpreter or by a compiler: the
former translates and immediately executes each instruction, the latter takes
the file, produces the so-called object code that together with other object codes
and with libraries is finally assembled into an executable file. Python, Java (or at

1
an higher level, Matlab, Mathematica) are examples of “interpreted” language.
Fortran, C, C++ are “compiled” languages.
Our codes are written in Fortran 90 (or 95, or later). This is a sophisti-
cated and complex language offering dynamical memory management, arrays
operations (e.g. matrix-vector products), modular and object-based structure.
Fortran 90 maintains a wide compatibility with existing Fortran 77 codes, while
remaining as efficient as Fortran 77 was. It is worth mentioning that the first
applications of computers to physics go back to well before the birth of modern
computer languages like C++, python, or even C: there is a large number of
codes and libraries written in Fortran 77 (or even Fortran 66!) and still widely
used in physics. Even among physicist, however, Fortran is no longer as com-
mon and widespread as it used to be. Resources are still easy to find: see for
instance the web page mentioned in the bibliography section. The codes them-
selves are very simple and make little usage of advanced language features. In
any case, there is no problem if a student prefers to use a more widespread
language like C/C++. A version of all codes in C is also available, with no
warranty about the quality of the C code in terms of elegance and good coding
practice.
In all cases, you need a C or Fortran compiler. The C compiler gcc is
free and can be installed on all operating systems (in Linux PCs it is always
present). Less-then-archaic versions of gcc include a Fortran compiler, called
gfortran.

0.1.2 Visualization Tools


Visualization of data produced by the codes (wave functions, charge densities,
various other quantities) has a central role in the analysis and understanding
of the results. Code gnuplot can be used to make two-dimensional or three-
dimensional plots of data or of analytical expressions. gnuplot is open-source
software, available for all operating systems and often found pre-installed on
Linux PCs. An introduction to gnuplot, with many links to more resources,
can be found here: http://www.gnuplot.info/help.html.
Another software that can be used is Grace1 , formerly known as xmgr. This
is also open-source and highly portable, has a graphical user interface and thus
it is easier to use than gnuplot, whose syntax is not always easy to remember.

0.1.3 Mathematical Libraries


The usage of efficient mathematical libraries is crucial in “serious” calculations.
Some of the codes use routines from the BLAS2 (Basic Linear Algebra Subpro-
grams) library and from LAPACK3 (Linear Algebra PACKage). The latter is
an important and well-known library for all kinds of linear algebra operations:
solution of linear systems, eigenvalue problems, etc.. LAPACK calls BLAS
1
http://plasma-gate.weizmann.ac.il/Grace
2
http://www.netlib.org/blas
3
http://www.netlib.org/lapack

2
routines for all CPU-intensive calculations. The latter are available in highly
optimized form for many different architectures.
BLAS and LAPACK routines are written in Fortran 77. They are often
found precompiled on many machines and can be linked directly by the com-
piler by adding -llapack -lblas. If called by a C code, it may be needed to
add an underscore ( ) in the calling program, as in: dsyev , dgemm . This is
due to different C-Fortran conventions for the naming of “symbols” (i.e. com-
piled routines). Note that the C compiler may also need -lm to link general
mathematical libraries (i.e. operations like the square root).

0.1.4 Pitfalls in C-Fortran interlanguage calls


In addition to the above-mentioned potential mismatches between C and For-
tran naming conventions, there are a few more pitfalls one has to be aware of
when Fortran routines are called by C (or vice versa).

• Fortran passes pointers to subroutines and functions; C passes values. In


order to call a Fortran routine from C, all C variables appearing in the
call must be either pointers or arrays.

• Indices of vectors and arrays start from 0 in C, from 1 in Fortran (unless


differently specified in array declaration or allocation).

• Matrices in C are stored in memory row-wise, that is: a[i][j+1] follows


a[i][j] in memory. In Fortran, they are stored column-wise (the other
way round!): a(i+1,j) follows a(i,j) in memory.

An additional problem is that C does not provide run-time allocatable matrices


like Fortran does, but only fixed-dimension matrices and arrays of pointers.
The former are impractical, the latter are not usable as arguments to pass to
Fortran. It would be possible, using either non-standard C syntax, or using
C++ and the new command, to define dynamically allocated matrices similar
to those used in Fortran. We have preferred for our simple C codes to “simulate”
Fortran-style matrices (i.e. stored in memory column-wise) by mapping them
onto one-dimensional C vectors.
We remark that Fortran 90 has a more advanced way of passing arrays to
subroutines using “array descriptors”. The codes used in this course however do
not make use of this possibility but use the old-style Fortran 77 way of passing
arrays via pointers.

3
0.2 Bibliography

J. M. Thijssen, Computational Physics, Cambridge University Press, Cam-


bridge, 1999. A second edition has appeared:
http://www.cambridge.org/gb/knowledge/isbn/item1171410.
F. J. Vesely, Computational Physics - An Introduction: Second Edition, Kluwer,
2001. Also see the author’s web page:
http://www.ap.univie.ac.at/users/Franz.Vesely/cp0102/serious.html,
containing parts of the accompanying material.
S. E. Koonin e D. C. Meredith, Computational physics - Fortran Version,
Addison-Wesley, 1990. See also Dawn Meredith’s web page:
https://mypages.unh.edu/dawnm/home.
Timothy H. Kaiser, A quick introduction to advanced Fortran-90:
https://inside.mines.edu/ tkaiser/fortran/.

You might also like