Giter Site home page Giter Site logo

ising-model's Introduction

Ising Model Simulation using SDL2

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.

Prerequisites

  • SDL2 library
  • C compiler

How to Use

  1. Clone the repository: git clone https://github.com/username/repo.git
  2. Compile the code using a C compiler: gcc main.c -o ising -lSDL2 -lm
  3. Run the executable: ./ising

Parameters

  • 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

How it Works

  • 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.

Note

  • 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.

References

Screenshot_2

Screenshot_1342

ising-model's People

Contributors

blagojeblagojevic avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.