In the below sandbox, you can interact with the Ising model and see the magnetization and the temperature change with every iteration. The 2D Ising model is simply an array of spins. Spin up is represented by a white tile and spin down is represented by a black tile. Each spin interacts with only 4 of its neighbors.
You can set different temperatures and see how the thermal equilibrium state of the spins changes. You can also plot them to obtain the critical temperature for the system.
A few points - The computations happen on "your system". If you think your system is not capable of handling this big array, change the number of rows and reset to play with a smaller array. We have set one iteration to be when $ n\times n $ spins are flipped randomly. The magnetization is not averaged for first 2000 iterations, after which it is averaged over the last 1000 iterations. You can pause (stop button) and resume (run button) the simulation at any point. 'Clear Board' only resets the spins, iterations and magnetization, while 'Reset' will redraw the board with $n$ number of rows, and also deletes the data added to the plot. 'Add To Plot' adds the absolute value of magnetization and the temperature to the plot. Changing the temperature while the simulation is running has no effect until the simulation has been stopped or the board has been cleared. If not stopped, the simulation will go on for 10000 iterations.
To find out the math behind it, scroll down to the next section.
You can set different temperatures and see how the thermal equilibrium state of the spins changes. You can also plot them to obtain the critical temperature for the system.
A few points - The computations happen on "your system". If you think your system is not capable of handling this big array, change the number of rows and reset to play with a smaller array. We have set one iteration to be when $ n\times n $ spins are flipped randomly. The magnetization is not averaged for first 2000 iterations, after which it is averaged over the last 1000 iterations. You can pause (stop button) and resume (run button) the simulation at any point. 'Clear Board' only resets the spins, iterations and magnetization, while 'Reset' will redraw the board with $n$ number of rows, and also deletes the data added to the plot. 'Add To Plot' adds the absolute value of magnetization and the temperature to the plot. Changing the temperature while the simulation is running has no effect until the simulation has been stopped or the board has been cleared. If not stopped, the simulation will go on for 10000 iterations.
To find out the math behind it, scroll down to the next section.
Sandbox
Temperature:
0.1
Iteration: 0
Magnetization: 0
Mathematics Behind It: Monte Carlo Simulation
Usually, for systems with large number of degrees of freedom, the value of $N$ is pretty huge, and the above calculation becomes very inefficient to perform.
It is worth noting that there are two ways to perform this calculation.
- The first way is to sample uniformly $n < N$ states randomly, calculate the both probability $p(s_i)$ and observable $f(s_i)$ for the sampled states and then calculate the approximate value of the observable $f$.
- An even better method would be to draw states according to the probability distribution, and simply find the average of the function over a set of the states drawn. That is $$ \langle f \rangle_p \approx \frac{1}{N} \sum_{i=1}^{N} f(s^p_i) $$ where the $s^p$ are the states drawn according to the probability distribution. The Monte Carlo Method does exactly this. It allows one to sample states from any given probability distribution.
The Metropolis algorithm advances a configuration $s_{i-1}$ to $s_{i}$ as follows:
- Choose a candidate configuration $s'$ starting from the original state $s$. In the Ising Model case, this is done by selecting randomly a spin and flipping it
- Compute the difference in the energies $\Delta E = E(s') - E(s)$. Compute a random number $r$ uniformly distributed in the interval $[0,~1)$.
- Accept the new configuration if $r \le \frac{P(s')}{P(s)} \equiv \exp\left( -\frac{\Delta E}{k T} \right)$, otherwise carry on the original state as the next state.
The 2D Ising Model
The system undergoes a 2nd order phase transition at the critical temperature $T_C$. For temperatures less than $T_C$, the system magnetizes, and the state is called the ferromagnetic or the ordered state. For temperatures greater than $T_C$, the system will go to a disordered or paramagnetic state, in which case there is no net magnetization.
The magnetization of the system is given by $$ m = \frac{1}{N}\sum_{i=1}^{N} \sigma_i $$