Preface

This book is intended for those who want a relatively easy introduction in to the difficult world of computational quantum mechanics and especially density functional theory, a popular tool for simulating quantum mechanical systems.

When I was learning this material, my problem was that I didn't understand how to implement the relevant code myself. Sure, I could find a program on the internet that would do it just fine, and I could more or less understand the basic theory behind constructing a simulation program, but I didn't understand the practice. For example, a standard density functional theory (DFT) textbook might contain a recipe like this: "In a DFT calculation, you first guess the density, calculate the Hamiltonian, solve the Kohn-Sham equations, and then calculate a new density based on this solution. If the guess and the solution are close to each other, the calculation has converged. If not, the new solution is used as a guess for the next iteration."

That's all well and good --- but how do you guess the density? How do you calculate the Hamiltonian? How do you solve the Kohn-Sham equations? How do you iterate on the solution? Answers to these questions were scattered across the literature. It seemed to me that there was no easy starting point: most descriptions either didn't explain how to program at all, or else were advanced research implementations that were difficult to understand.

This book is intended to be the easy starting point that I never found. I will explain, step-by-step, how to write a program capable of solving electronic structure problems. We begin with an introduction to basic quantum mechanics (and its computational aspects) in Chapter 1. These tools will be used in the rest of the book to construct our electronic structure programs. In Chapter 2, I give an overview of density functional theory and how we're going to solve its equations on a computer. We implement a simple one-dimensional solver for DFT problems with a simplified interaction potential. Chapter 3 deals with calculations for single atoms. Chapter 4 (WIP) discusses more difficult problems.

The point of the book is not to arrive at a full DFT implementation or to optimize our code to the highest standard; neither do I make any claim that the material here is mathematically rigorous. I omit many important theoretical aspects. I also don't study any particular physical phenomenon in great theoretical detail; I rather try to provide some general methods that would allow the reader to explore any topic he or she chooses. Most glaringly, discussion of time-dependent aspects is omitted to arrive at a better understanding of stationary states.

This book should ideally be used as a stepping stone to computational QM for those who are interested in learning how things work under the hood. After all, one must learn to walk before getting on a bicycle, and to quote Silvanus Thompson (Calculus Made Easy (1910)):
Considering how many fools can calculate, it is surprising that it should be thought either a difficult or a tedious task for any other fool to learn how to master the same tricks [...] What one fool can do, another can.

However, you can't even walk unless you've first managed to crawl. Thus, there are some requirements for a full understanding of the book. You should know some elementary linear algebra (like what matrices are) and some basic calculus to understand everything in the book. Knowing elementary quantum mechanics beforehand helps, but you can also treat the equations as "black boxes"\ without understanding where they ultimately come from. Likewise, I don't really offer a primer on the Python programming language: you don't need to be an expert programmer, but you should understand things like functions, for loops and if-else statements.

I'll be using the SciPy stack, particularly numpy for numerical operations and matplotlib for plotting. You can easily find instruction for installing these important tools on the internet --- I will spend no time on it. If you don't understand some numpy/matplotlib command, you should refer to their documentation.