Skip to content

panda-yoo/ising_model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ising Model Simulation

This repository contains a C++ implementation of a 2D Ising model simulation. This project was developed as a part of the course PH755: Computational Physics during my second semester for my Master of Science in Physics program.

The project explores the magnetic properties of a system of spins on a square lattice using two different Monte Carlo algorithms: the Metropolis algorithm and the Wolff algorithm.

The simulation code is organized into a CMake project and can be built and run using a C++ IDE like CLion.

⚙️ Algorithms Implemented

  • Metropolis Algorithm: A single-spin-flip Monte Carlo method that uses a probability acceptance criterion based on the change in system energy. It is an efficient algorithm for simulating systems at low temperatures.
  • Wolff Algorithm: A cluster-based Monte Carlo method that is particularly effective near the critical temperature of the Ising model. It grows and flips clusters of aligned spins, which helps overcome the problem of critical slowing down.

📂 Project Structure

The project is structured for clarity and maintainability. I can update the README.md file to include the additional context about your project's academic background. Here is the revised version with the requested details.

🛠️ How to Build and Run

This project uses CMake for its build system. The recommended way to build and run is through an IDE that supports CMake, such as CLion.

Building with CLion

  1. Open the project folder in CLion.
  2. CLion will automatically detect and load the CMakeLists.txt file.
  3. The project will be configured and built automatically. You can manually trigger a build by clicking the hammer icon.

Running the Simulation

The main.cpp file acts as the entry point, likely calling either main_metropolis() or main_wolff().

  1. Select the metropolis_sim run configuration from the top right of the CLion window.
  2. Click the "Run" button (green play icon).
  3. Output data files (e.g., energy.dat, initial_lattice.dat) will be generated in the data directory at the project's root.

Note: To ensure data files are saved to the project root directory, you must configure your run environment to execute the program from that location. In CLion, you can set the Working directory in your run configuration to the project's root folder.

📈 Data Output

The simulations generate several output files in the data directory:

  • energy.dat: Stores the total energy of the system at each iteration.
  • initial_lattice.dat: The state of the lattice at the start of the simulation.
  • final_lattice.dat: The final state of the lattice after all iterations.
  • parameters.dat: A summary of the simulation parameters, such as LATTICE_SIZE, NO_OF_ITERATIONS, EXTERNAL_B, and BETA_J.

These files can be used for post-processing and plotting the results to analyze the system's behavior.

📝 Configuration

Simulation parameters like LATTICE_SIZE, NO_OF_ITERATIONS, and physical constants (EXTERNAL_B, BETA_J) can be configured by modifying the const variables in include/lattice_utils.hpp.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published