Magnets: How do they work? Exploring the 2D Ising model¶

Magnetism on a microscopic level is caused by electrons in the atom "shells". The Ising model is a intuitive but powerful way of describing such a system. In this notebook, we'll first learn about the Ising model and try to get some intuition for it. To look into the physical consequences, we'll solve it numerically with my c++ solver magneto. Code for that program and this notebook is on github.com/s9w/magneto. After the physics, we'll have a look at the algorithms that are used to solve it and their differences at the end of the article.

Quantum Mechanics tells us that electrons have a property called spin which is in one of two states, usually called "up" and "down". In Ising model, that is represented by $\sigma=+1$ and $\sigma=-1$, with $\sigma$ just being the standard symbol for spin states. The spins are arranged in a two or three dimensional square lattice. We'll look at two dimensions here. Example for a small 4x4 system:

+1 +1 -1 +1 -1 -1 +1 +1 -1 +1 -1 -1 +1 -1 -1 +1

The behaviour of all physical systems boils down to minimizing the overall energy. So let's try to reason about the energy of such a system: Each electron spin produces either a positive or negative magnetic field. But it's also influenced by such fields, both external and those of the other spins. So there is an interaction between them. In good approximation, it's enough to only look at the interaction between next neighbor spins. So each spin only is affected by its four direct adjacent spins.

A positive field will push an electron spin towards a positive alignment and vice versa. So it's intuitive that without external fields and disturbances, a configuration where many spins are parallel (in the same state) is energetically beneficial. Put into an equation, the energy of the whole system (without an external magnetic field) is given by the Hamiltonian:

$$H = -J\sum_{\langle ij\rangle } \sigma_i \sigma_j$$

That way of writing a sum just means a summation over next neighbors for every single spin. We'll assume the coupling constant $J=1$ for the moment, more on that later.

Real systems consist of an astronomical number of spins, so a large lattice is crucial for good numerical results. To help cope with "finite size effects", periodic boundary conditions are used. So for a 2x2 grid with either all positive or all negative spins, the energy would be -8. Usually the energy is divided by the number of sites in the grid so that it's in a nice range between -2 and 0.

So we know what energy a specific configuration has. But a square grid with length $L$ has $L^2$ positions, which amounts to $2^{(L^2)}$ possible states. Even with conservative grid sizes that's a large number. Which of those configurations are actually physically realized and how often? More precise: What's their probability distribution? Statistical mechanics has the answer: The Boltzmann distribution

$$\exp\left(-\frac{H}{T}\right)$$

Normalized, it looks like this: