Ising Simulation

Note the plots may take 30s to load as the data is unzipped.

The Ising is a tool used in statistical physics to study phase transitions and collective dynamics in systems with many interacting parts. Initially designed to represent ferromagnetism, it models spins on a lattice that can take one of two states, interacting with their neighbors. Its applications extend to areas like neural network activity, protein folding and quantum cluster states. The model's simplicity allows for analytical solutions in certain cases and computational approaches in others, making it broadly applicable for exploring the connection between microscopic interactions and macroscopic phenomena.

Here I'm making a small monte carlo simulation of an Ising Model with Glauber dynamics.

1. Energy of the Ising Model:

The energy of a configuration of spins (where ) on a lattice is given by:

Where:

2. Glauber Dynamics Update Rule:

The Glauber dynamics updates the spin at site based on the local energy configuration. The probability of a spin flipping to is:

Where:

For the case of a single spin flip , the energy change for the flip is:

This means that the probability of flipping a spin depends on the interaction with neighboring spins and the external field. At high temperatures (), flips occur more freely, while at low temperatures (), the system tends to settle into aligned configurations.

Note the critical temperature for an ising model should lie around

in our sim J is always 1.0, so the critical temp is 2.27.


Lattice state plot

Here we plot the lattice state for various temperatures and time steps, play around with the sliders to view the dynamics behaviour of the lattice.

The simulation calculates the lattice states using Glauber dynamics in the update_step_numba function. At each step, a random site is picked, and the change in energy () due to flipping that spin is computed from the local interactions (the sum of the nearest neighbors’ spins and any external field). The flip is then accepted with probability ​. Repeating this process for many steps yields a time evolution of the spin configuration.

At low temperatures, we often see large, stable clusters where spins align and rarely flip, indicating an ordered phase. Near critical temperature (), these clusters form and dissolve in a more balanced manner, and we catch glimpses of interesting domain structures. At high temperatures, spins will flip frequently and produce a more disordered or “noisy” lattice with low magnetization.


Identifying the critical point

We can plot the following graphs: magnetization, average_energy, susceptibility, and specific_heat.


Correlations

Spatial correlations are calculated by shifting the last step lattice in all possible directions (dx, dy) and measuring how much each site’s spin correlates with its shifted partner. That sum gets binned by the distance ​. In the script, it’s done with a loop that applies np.roll on the lattice to shift it, computes the pairwise product lattice * shifted_lattice, and accumulates results at the correct radial distance. Finally, each bin is normalized by the number of sites that contributed. This gives the correlation value as a function of distance.

When we plot these spatial correlations, you’ll typically see them decay as distance increases. At high temperature, the correlation should fall off quickly, indicating that spins behave more independently. Near or below the critical temperature, the correlation length grows, and we see a slower or even power-law–like decay, indicating large-scale domains of aligned spins.