Computational Physics 2023, Course 509 - Physics Applications of Computers


Introductory lecture material


Basic numerical methods

Methods and Algorithms
Monte Carlo methods
Quantum Monte Carlo methods
Continuous Time Quantum Monte Carlo
Hartree-Fock method
Density functional theory
Molecular Dynamics

Left: Simulation of a bacteria growth by DLA method, Right: Molecular dynamics simulation of a small system of atoms Simulation codes is available to download in lecture material.

This course introduces algorithmic concepts and familiarizes students with the basic computational tools which are essential for graduate students in computational physics, but are also very useful to most graduate students in STEM and related areas, as well as to those students who plan to look for a job in the IT industry.

In this course, students work toward mastering computational skills, and basic algorithms which appear in classical and quantum physics, but are not limited to those fields, for example large scale minimization problems, high dimensional integration problems, and solving partial differential equations are constituting the bulk of the course, but these same algorithms appear in all STEM fields and are also used by quants in major banks. While the examples are drawn mostly from quantum physics, their applicability is far beyond this specific physics subfield.

As the programing language, we will use mostly Python and its scientific library scipy & numpy. To speed up parts of the code, we will also use C++ (with pybind11) and fortran90 (f2py) for short examples, which will be used through the Python interface.

This course has no prerequisites except for familiarity with programming language. It is designed for the student who wishes to broaden his/her knowledge of applications and develop techniques. To complete the homework and perform the hands-on training, it is desired that students use their laptops and bring their own laptops to the class (when in person).

Class Time: ARC 205 3:50pm-5:10pm Tuesday and Thursday

Instructor: Kristjan Haule
Office: Serin E267
Phone: 445-3881
Office hours: after lecture


Codes available at

Youtube videos from 2021: Lecture 1, Lecture 2, Lecture 3, Lecture 4, Lecture 5, Lecture 6, Lecture 7, Lecture 8, Lecture 9, Lecture 10, Lecture 11, Lecture 12, Lecture 13, Lecture 14, Lecture 15, Lecture 16, Lecture 17, Lecture 18, Lecture 19, Lecture 20, Lecture 21, Lecture 22, Lecture 23, Lecture 24, Lecture 25, Lecture 26

Preliminary Course Outline and Tentative List of Topics include

A) Introduction

  1. Installation, comparison of programing languages by computing Mandelbrot set, speed up the code with numba, f2py, pybind11, parallelization with openMP
  2. Numerical error accumulation, stable recursion and Miller's algorithm

Source code:

Text for recursive Homework in pdf

local copy of codes:

  • Plots of Mandelbrot set using fortran, C++, Perl and Python
  • Glues fortran and C++ to Python using f2py and pybind11
  • Computes Bessel functions with upward and downward recursion, shows the error.

  • B) Learning high level programming with examples in Python(Numpy, SciPy, Pylab)

    1. 00_Introduction (to Jupyter)
    2. 01_Basic_Python
    3. 02_Numpy
    4. 03_Scipy
    5. 04_Scipy_example_Hydrogen_atom
    6. 05_Atom_in_LDA
    7. Jupyter notebooks of these lectures can be downloaded at
    This lectures are adopted from

        Homework 3,     Numerov algorithm
        Homework 4,      Script for XC potential:
        Total energies from NIST (Energies are given in Hartree's)

    More literature on Learning Python:
  • Software carpentry
  • How to Think Like a Computer Scientist: Learning with Python
  • Python for beginners
  • Python documentation
  • Python regular expressions

  • C) Monte Carlo and Simulated Annealing
    1. Random numbers, multidimensional Vegas integration (source code in html)
    2. Classical Monte Carlo, Simulated Annealing (source code for Ising model, Wang Landau, Traveling Salesman)
    3. High-Dimensional integration by Metropolis
      Homework for high-D integration by Metropolis

    Alternative implementation of Ising: online Ising model simulation

    Source Codes:
  • jupyter nb for Vegas algorithm
  • jupyter nb for Ising model
  • jupyter nb for Wang Landau
  • jupyter nb for The Traveling Salesman problem
  • jupyter nb for High-D integration by Metropolis, C version of High-D integration
  • Diffusion limited aggregation
  • Other MC codes

  • D) Machine Learning
    1. Linear regression, pdf ( jupyter notebook, NucleousEnergy.dat)
    2. Logistic regression, pdf ( jupyter notebook)
    3. Deep Learning, pdf (jupyter notebook,NNfig.pdf,or_xor.pdf,NN_digits.pdf)

    E) Parallel Programing
    1. Parallel programming with MPI ( source code)
    F) Basic numerical methods:
    1. Numeric integration (source code)
    2. Interpolation, Splines and Fourier transformation (source code)
    3. Differential equations (source code)
    Literature: Numerical Recipes online

    G) More advanced topics in Computational Condensed Matter physics:
    1. Hartree-Fock method
    2. Density functional theory
    3. Quantum Monte Carlo methods
    4. Continuous Time Quantum Monte Carlo method
    5. Molecular dynamics simulation
    1. Computational Physics by J.M. Thijssen
    2. An introduction to Computer Simulation Methods by H. Gould, J Tobocnik and W. Christian
    3. Electronic Structure, Basic Theory and Practical Methods by Richard M. Martin(Very good book for the Density functional part of the course)
    4. An Introduction to Computational Physics by Tao Pang
    5. Computational Physics by Rubin H. Landau and Manuel J. Paez(More elementary but good book)

    Students with Disabilities