Skip to content

Monte Carlo Simulation of Ising Lattice Model (with nucleus formation)

License

Notifications You must be signed in to change notification settings

AdityaDendukuri/IsingNucleation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INTRODUCTION

This is a Monte Carlo simulation program for the Ising spin model. Simulations include free energy construction [1], nucleus formation [2] with umbrella sampling [1]. The program is written in C, with ffmpeg used for the generation of simulation videos. Please ensure ffmpeg is installed on your system (can be found here). Python is used to visualize the thermodynamics of the system via Jupyter notebooks for two specific experiments for validation, which can be found in analysis/.

INSTRUCTIONS TO RUN

  1. Clone the repo
$ git clone https://github.com/AdityaDendukuri/IsingNucleation.git
  1. Create the directories build/ and output/
$ cd IsingNucleation
$ mkdir build output
  1. Go to the build directory and run cmake as follows (you only need to do this the first time)
$ cd build
$ cmake -S ../ -B .
  1. This will generate the makefile in build/. Compile the program by simply typing:
$ make
  1. Run the executable
$ ./IsingNucl

Simulation output and video will be saved in output/.

SIMULATION SETUP AND ANALYSIS

Please refer to "main.c" for the steps to invoke the simulation. There are three experiments pre-coded in "src/simul.c".

  1. run_sim(): Classic Metropolis Monte Carlo 2D Ising Lattice Simulation. simulation video
  2. validate_free_energy(): Validating the simulation by running simulations at various temperatures and comparing the minimum energy of each temperature with the exact solution. Free energy validation based on the output of the experiment is shown in the Python Jupyter notebook in analysis/ folder "free_energy.ipynb".
  3. run_sim_nucleation(): Simulation of nucleus formation in 2D Ising System simulated via umbrella sampling (also known as non-Boltzmann sampling) with overlapping windows from N = 15 to 450. Refer to nucleation.ipynb in analysis/ folder for the analysis of the simulation data and free energy construction. simulation video.

NOTES

  1. The lattice size, defined in main (int n), is the sidelength of the lattice square (not the number of spins). That means the number of spins = n * n.

  2. The resolution of the output video should be the same as the lattice dimensions. The resolution of the output video is set in the function make_video() in src/media.c. The resolution should be explicitly defined in the string with the ffmpeg command. For example, if the lattice is n=50, change the resolution as "ffmpeg -s 50x50 <rest_of_the_command>".

  3. int* simspace is the memory buffer holding the lattice snapshots which will be turned into a video. It is better to skip some steps before adding a frame to the video to avoid stack overflow issues.

REFERENCES

[1] Chandler, David. Introduction to modern statistical mechanics. 1987.

[2] Brendel, Kevin, G. T. Barkema, and Henk van Beijeren. "Nucleation times in the two-dimensional Ising model." Physical Review E 71, no. 3 (2005): 031601.

About

Monte Carlo Simulation of Ising Lattice Model (with nucleus formation)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published