Skip to content

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

License

Notifications You must be signed in to change notification settings

Babalion/Ising2Level

Repository files navigation

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:

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages