Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 991 Bytes

README.md

File metadata and controls

9 lines (5 loc) · 991 Bytes

Ising-Model

This Python code simulates the two-dimensional Ising model using the Metropolis algorithm on a square lattice at a given temperature.

It begins by initializing the spin grid, in which each magnetic spin is assigned a random initial state of -1 or +1. The Metropolis algorithm then evolves the spin system by randomly flipping spins based on changes in the system's energy, parametrized by $\verb|kBT|$, the Boltzmann constant $k_B$ multiplied by the temperature $T$. The energy calculations take into account the nearest neighbours' spins, which may include diagonal interactions, under periodic boundary conditions. After a set number of iterations, the resulting spin configuration is visualized using a colour map. The script also includes a section for a one-dimensional model, which is currently commented out.

The results are displayed in the folders "2D noDiag," "2D withDiag," and "1D."