Giter VIP home page Giter VIP logo

isingmodel's Introduction

IsingModel

A classic implementation of the famous 2D Ising Model, written in C++. This was done as a project for Cooperative and Critical Phenomena, a subject for the Master in Physics of Complex Systems offered by the Institute of Cross-Disciplinary Physics and Complex Systems. The code is mostly based in the implementation by Raul Toral in his book Stochastic Numerical Methods: an Introduction for Students and Scientists.

The Ising Model is a model for a ferromagnetic - paramagnetic transition in magnetic materials, which has been studied as a reference model for phase transitions. It is formed by spins up or down, which can interact. Spins tend to align, but temperature makes them flip. However, in the stationary distribution the statistical properties of the ensable are fixed. For example, this is how the material looks at the critical point in a space of size 512x512:

Ising 512

The program computes the magnetization, susceptibility, energy and specific heat in the stationary state. Far away the critical point, the Metropolis algorithm was used to reach this state. Near the critical temperature, we change to Wolff collective to do it in a fast way. Once we are in the stationary state, we take several measures, updating enough steps between measurements in order to avoid statistical correlations. In the next graph you can see the observables, for several system sizes:

Ising

The next step is to compute critical temperature, as well as critical exponents. For the critical temperature, Binder cumulant is used. This quantity is constant exactly at the critical point, so we try to compute where all the graphs, for different sizes, converge. In practice, we take pairs and make an average:

Binder

Finally, once all the temperature and the critical exponents have been computed, we can check the scaling function. The result is pretty beautiful, and it possible to see the collapse of all the sizes near the critical points:

Binder

The C++ code may be not very readable, and the program takes time to do all the measurements. However, I hope you find it a useful reference: it is pretty well optimized, and all the errors are carefully computed.

isingmodel's People

Contributors

victorseven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

isingmodel's Issues

Stack overflow error

I use Visual Studio 2019. When I tried to run for the L value 128, 256, 512 etc. , it gives a stack overflow error. How can I handle with this error for bigger L values?

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.