A lightweight, high-performance simulation of the 2D Ising Model built in pure Python.
This script models a ferromagnetic phase transition using the Metropolis-Hastings Monte Carlo algorithm. It visualizes the system cooling from a state of thermal chaos (high entropy) into a magnetically ordered ground state, demonstrating spontaneous symmetry breaking and magnetic domain formation near the critical temperature (Tc ≈ 2.27).
- Vectorized Monte Carlo Sweeps: Bypasses slow Python
forloops by using a checkerboard masking technique (updating alternating lattice sites simultaneously via NumPy). - Real-Time Visualization: Dynamically plots the spin lattice, current temperature, and absolute magnetization per spin.
- High-Quality Export: Automatically compiles the simulation into an MP4 video using Matplotlib's FFmpeg writer.