is a model in statistical mechanics to describe a field of two-state variables (spins) with local (nearest neighbor) interaction. The engery of the system is described by the Hamiltonian: where is the spin at site , is the coupling constant between neighboring spin pairs , and is the external field.
In the following simulation of a 2D Ising model, we assume the coupling constant without losing generality. The temperature of the system is give by where is the Boltzmann constant.