Coder Social home page Coder Social logo

babalion / ising2level Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 53.77 MB

A performant implementation of the ising-2D model with headless and OpenCV live view versions

License: MIT License

CMake 1.15% C++ 98.40% C 0.29% MATLAB 0.16%
simulation ising-model ising-model-2d parallel-computing metropolis-monte-carlo monte-carlo-simulation

ising2level's Introduction

Ising2Level Simulation

With the following programs one can analyze the 2D-Ising model with monte-carlo algorithms. In addition, calculate critical exponents with reweighting in MATLAB. Furthermore, analyze the autocorrelations and compare metropolis with the heatbath algorithm. With little programming effort also every other calculation with the 2D-Ising model can be achieved.

This project includes the following runnable programs, in the following called {program-name} Every program runs with 100% CPU load on every core.

  1. ising-with-plots: generates plots directly after simulation with CV-Plot
  2. ising-headless: only status updates from console, saves all data to file
  3. ising-live: you can view the whole configuration of the spin-field in live while simulation. Furthermore, calculates autocorrelation of energies and plots it with CV-Plot.

Furthermore, this repository includes matlab-scripts for post-calculations of the generated values.

Requirements and Installation

Requirements

Project is based on C++20

(optional for project 2):

How to run?

This is a CMake-Project. Compilation and building is pretty easy. Simply run in main folder via terminal:

    $ cmake .
    $ cmake --build .
    $ cmake --build --target {program-name}

The executable can be found in ./bin/{program-name}.

Analyze a long headless run

Measured and reweighted observables

I've done a long headless run with N=16,32,64,128,256 spins per edge with 32 temperatures equally spaced between T=2-3. Sweeps per temperature-step were 5E5, but I stored only every 10th sweep due to lower autocorrelations. Raw data one can find in ./result/IsingResultsNew4.zip.

There are too few data for 256^2 spins, and the tremendous autocorrelations to perform a good analysis. Thus, we neglect this data-sample.

The following data are already reweighted around T_c, like described in the literature below.

To estimate the heat capacity and magnetic susceptibility I followed the literature and estimated variances in the data and furthermore reweighted those.

reweighted energy of ising simulation

binder-cumulant analysis

One approach to estimate the critical temperature T_c is by using binder-cumulants U_L like described in the literature below.

The exact value from the literature is T_c=2/log(1+sqrt(2))=2.2691... This is within our confidence interval.

estimate critical temperature with binder cumulants

Calculate critical exponents

Following the literature further one can estimate the critical exponents of the 2D-Ising-model by fitting

  • deviation of finite size critical temperature
  • magnetization
  • maxima of heat capacities
  • maxima of susceptibility

against the number of spins in a double logarithmic plot.

fit of magnetization fit of critical exponents

Let's compare the critical exponents with the literature:

rel. observable critical exponent calculated literature
heat capacity alpha 0.13+-0.03 0 (logarithmic singularity)
magnetization beta 0.223+-0.142 0.125
susceptibility gamma 1.777+-0.038 1.75
correlation length nu 1.095+-0.138 1

Overall the values are quite well. However, we only used data up to N=128^2 spins.

One could increase the achieved accuracy by increasing N.

Ising-live

One can observe the monte-carlo process live via a fast GUI built with OpenCV. A small impression: ising live screenshot

Furthermore, a plot of autocorrelations is shown after simulation. Here we compare the metropolis-algorithm with the heatbath-algorithm. ising autocorrelations

Literature

Autocorrelations: https://www.statlect.com/fundamentals-of-statistics/Markov-Chain-Monte-Carlo-diagnostics

Metropolis-algorithm and general analysis of ising-model, finite size scaling:

ising2level's People

Contributors

babalion avatar

Stargazers

 avatar  avatar

Watchers

 avatar

ising2level's Issues

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.