Introduction to Computational Physics Lectures, FYS4411/9411

Morten Hjorth-Jensen Email, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

Date: Jan 16, 2020

Copyright 1999-2020, Morten Hjorth-Jensen Email Released under CC Attribution-NonCommercial 4.0 license


  • Be able to apply central many-particle methods like the Variational Monte Carlo method to properties of many-fermion systems and many-boson systems.

  • Understand how to simulate quantum mechanical systems with many interacting particles. The methods are relevant for atomic, molecular, solid state, materials science, nanotechnology, quantum chemistry and nuclear physics.

  • Learn to manage and structure larger projects, with unit tests, object orientation and writing clean code

  • Learn about a proper statistical analysis of large data sets

  • Parallelization and code optimizations

Lectures and ComputerLab

  • Lectures: Thursday (2.15pm-4pm), remotely. First time January 16.

  • Computerlab: Thursday (4.15pm-7pm), first time January 16, last lab session May 9.

  • Weekly plans and all other information are on the webpage of the course

  • Intensive week starts March 2 and ends March 6. Lectures Monday-Wednesday to be decided and regular session on Thursday February 7 (2.15pm-7pm).

  • First project to be handed in March 23.

  • Second and final project to be handed in June 1.

  • We use piazza for discussions. Sign up as soon as possible.

  • There is no final exam, only project work.

Course Format

  • Two compulsory projects. Electronic reports only. You are free to choose your format. We use devilry to hand in the projects.

  • Evaluation and grading: The two projects count 1/2 each of the final mark. No exam.

  • The computer lab (room 397 in the Physics buidling) has no PCs, so please bring your own laptops. C/C++ is the default programming language, but Fortran2008 and Python are also used. All source codes discussed during the lectures can be found at the webpage of the course. We recommend either C/C++, Fortran2008 or Python as programming languages.

Topics covered in this course

  • Parallelization (MPI and OpenMP), high-performance computing topics. Choose between Python, Fortran2008 and/or C++ as programming languages.

  • Algorithms for Monte Carlo Simulations (multidimensional integrals), Metropolis-Hastings and importance sampling algorithms. Improved Monte Carlo methods.

  • Statistical analysis of data from Monte Carlo calculations, bootstrapping, jackknife and blocking methods.

  • Eigenvalue solvers

  • For project 2 there will be three variants:

a. Variational Monte Carlo for fermions

b. Hartree-Fock theory for fermions

c. Coupled cluster theory for fermions (iterative methods)

d. Neural networks and Machine Learning to solve the same problems as in project 1

e. Eigenvalue problems with deep learning methods

Topics covered in this course

  • Search for minima in multidimensional spaces (conjugate gradient method, steepest descent method, quasi-Newton-Raphson, Broyden-Jacobian). Convex optimization, gradient methods

  • Iterative methods for solutions of non-linear equations.

  • Object orientation

  • Data analysis and resampling techniques

  • Variational Monte Carlo (VMC) for 'ab initio' studies of quantum mechanical many-body systems.

  • Simulation of two-dimensional systems like quantum dots or atoms and molecules or systems from solid state physics

  • Simulation of trapped bosons using VMC (project 1, default)

  • Machine learning and neural networks (project 2, default, system same as in project 1)

  • Extension of project 1 to fermionic systems (project 2)

  • Coupled cluster theory (project 2, depends on interest)

  • Other quantum-mechanical methods and systems can be tailored to one's interests (Hartree-Fock Theory, Many-body perturbation theory, time-dependent theories and more).

Quantum Monte Carlo Motivation

Most quantum mechanical problems of interest in for example atomic, molecular, nuclear and solid state physics consist of a large number of interacting electrons and ions or nucleons.

The total number of particles $N$ is usually sufficiently large that an exact solution cannot be found.

Typically, the expectation value for a chosen hamiltonian for a system of $N$ particles is

$$ \langle H \rangle = \frac{\int d\boldsymbol{R}_1d\boldsymbol{R}_2\dots d\boldsymbol{R}_N \Psi^{\ast}(\boldsymbol{R_1},\boldsymbol{R}_2,\dots,\boldsymbol{R}_N) H(\boldsymbol{R_1},\boldsymbol{R}_2,\dots,\boldsymbol{R}_N) \Psi(\boldsymbol{R_1},\boldsymbol{R}_2,\dots,\boldsymbol{R}_N)} {\int d\boldsymbol{R}_1d\boldsymbol{R}_2\dots d\boldsymbol{R}_N \Psi^{\ast}(\boldsymbol{R_1},\boldsymbol{R}_2,\dots,\boldsymbol{R}_N) \Psi(\boldsymbol{R_1},\boldsymbol{R}_2,\dots,\boldsymbol{R}_N)}, $$

an in general intractable problem.

This integral is actually the starting point in a Variational Monte Carlo calculation. Gaussian quadrature: Forget it! Given 10 particles and 10 mesh points for each degree of freedom and an ideal 1 Tflops machine (all operations take the same time), how long will it take to compute the above integral? The lifetime of the universe is of the order of $10^{17}$ s.

Quantum Monte Carlo Motivation

As an example from the nuclear many-body problem, we have Schroedinger's equation as a differential equation

$$ \hat{H}\Psi(\boldsymbol{r}_1,..,\boldsymbol{r}_A,\alpha_1,..,\alpha_A)=E\Psi(\boldsymbol{r}_1,..,\boldsymbol{r}_A,\alpha_1,..,\alpha_A) $$


$$ \boldsymbol{r}_1,..,\boldsymbol{r}_A, $$

are the coordinates and

$$ \alpha_1,..,\alpha_A, $$

are sets of relevant quantum numbers such as spin and isospin for a system of $A$ nucleons ($A=N+Z$, $N$ being the number of neutrons and $Z$ the number of protons).

Quantum Monte Carlo Motivation

There are

$$ 2^A\times \left(\begin{array}{c} A\\ Z\end{array}\right) $$

coupled second-order differential equations in $3A$ dimensions.

For a nucleus like beryllium-10 this number is 215040. This is a truely challenging many-body problem.

Methods like partial differential equations can at most be used for 2-3 particles.

Various many-body methods

  • Monte-Carlo methods

  • Renormalization group (RG) methods, in particular density matrix RG

  • Large-scale diagonalization (Iterative methods, Lanczo's method, dimensionalities $10^{10}$ states)

  • Coupled cluster theory, favoured method in quantum chemistry, molecular and atomic physics. Applications to ab initio calculations in nuclear physics as well for large nuclei.

  • Perturbative many-body methods

  • Green's function methods

  • Density functional theory/Mean-field theory and Hartree-Fock theory

The physics of the system hints at which many-body methods to use.

Quantum Monte Carlo Motivation

Pros and Cons of Monte Carlo.

  • Is physically intuitive.

  • Allows one to study systems with many degrees of freedom. Diffusion Monte Carlo (DMC) and Green's function Monte Carlo (GFMC) yield in principle the exact solution to Schroedinger's equation.

  • Variational Monte Carlo (VMC) is easy to implement but needs a reliable trial wave function, can be difficult to obtain. This is where we will use Hartree-Fock theory to construct an optimal basis.

  • DMC/GFMC for fermions (spin with half-integer values, electrons, baryons, neutrinos, quarks) has a sign problem. Nature prefers an anti-symmetric wave function. PDF in this case given distribution of random walkers ($p\ge 0$).

  • The solution has a statistical error, which can be large.

  • There is a limit for how large systems one can study, DMC needs a huge number of random walkers in order to achieve stable results.

  • Obtain only the lowest-lying states with a given symmetry. Can get excited states with extra labor.

Quantum Monte Carlo Motivation

Where and why do we use Monte Carlo Methods in Quantum Physics.

  • Quantum systems with many particles at finite temperature: Path Integral Monte Carlo with applications to dense matter and quantum liquids (phase transitions from normal fluid to superfluid). Strong correlations.

  • Bose-Einstein condensation of dilute gases, method transition from non-linear PDE to Diffusion Monte Carlo as density increases.

  • Light atoms, molecules, solids and nuclei.

  • Lattice Quantum-Chromo Dynamics. Impossible to solve without MC calculations.

  • Simulations of systems in solid state physics, from semiconductors to spin systems. Many electrons active and possibly strong correlations.