This repository contains a C implementation of the Ising model simulation, a mathematical model in statistical mechanics describing ferromagnetism. The simulation utilizes the Metropolis algorithm to update the spins of a 2D lattice. The visualization is done using the SDL2 library, allowing for real-time rendering of the Ising model evolution.
- SDL2 library
- C compiler
- Clone the repository: git clone https://github.com/username/repo.git
- Compile the code using a C compiler: gcc main.c -o ising -lSDL2 -lm
- Run the executable: ./ising
- T (Temperature): The temperature of the system, which affects the behavior of spins. Input the desired temperature during program execution.
- J (Interaction Strength): The interaction strength between neighboring spins. Input the desired value during program execution.
- Distribution of Spins: Set the initial distribution of spins (0 - 1). Spins are randomly initialized based on this distribution
- The Ising model consists of discrete variables representing magnetic dipole moments of atomic spins, which can be in one of two states: up (+1) or down (-1).
- Spins are updated using the Metropolis algorithm, which calculates the change in energy for a spin flip and decides whether to accept or reject the flip based on the energy change and temperature.
- The simulation runs indefinitely, continuously updating spins and visualizing the evolving state of the system.
- The code contains a basic implementation of the Ising model and may not cover all edge cases or optimizations.
- Feel free to modify and experiment with the code to explore different aspects of the Ising model simulation.