2d Ising Model Simulation

Published:

Monte Carlo Simulation of the 2D Ising model

Explores the properties of the generalized Ising Model in 2 dimensions. The spins are arranged in a square lattice and interact with the nearest neighbors only. Periodic boundary conditions are imposed in both directions. Link to the source code here.

Below is the visualization of the lattice over time given an inverse temperature and starting from a random configuration. The interaction between neighbors causes the elements of the lattice to group into like polarizations. As you can see in the video the lattice goes from very checkered and random to eventually showing clumps of polarizations grouped together.

ising2D Function Input Variables

The ising2D.m uses the Monte Carlo algorithm to simulate the behavior of a General 2D Ising Model under specified conditions. If the plot flag is set to 1 then it will show the real time change of the cell matrix over time.

ising2D Function Input Variables

The ising2D.m uses the Monte Carlo algorithm to simulate the behavior of a General 2D Ising Model under specified conditions. If the plot flag is set to 1 then it will show the real time change of the cell matrix over time.

T = Temperature

N = linear lattice size

J = Ising coupling

plot_flag - 1 to have the script plot the cell matrix evolution in real time

tempChange and T_C_investigation

These scripts graph the energy, magnetization, heat capacity, and magnetic susceptibility as temperature changes. The difference between them is that T_C_investigation.m focuses more on the range around the critical temperature.

Thermalization

The thermalization time is how long it takes for the algorithm to reach an equilibrium.

thermalization_relationship plots the thermalization time of the simulated ising models as the value of N is increased. This script is dependent on the thermalization.m script.

Calculation for initial model energy:

Optimization for Metropolis Algorithm

Predetermined all the possible probabilities for the Metropolis algorithm. This way the code does not have to execute the relatively taxing ‘exp’ function every iteration.

alt text

Equation for calculating magnetic susceptibility:

Equation for calculating heat capacity