Skip to content

bennymac360/MCMC_simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Ising MCMC Generator

Metropolis Monte Carlo sampler for the 2D Ising model with periodic boundaries (J=1). It produces 1,000 configurations from a 10×10 lattice by default (1,000,000 spin-flip attempts, saving every 1,000 steps) and writes them with energies to training_data.txt.

Requirements

  • Python 3.8+ (tested on 3.12)

Run

Generate the default dataset:

python ising_mcmc.py

With verbose progress every 50k steps:

python ising_mcmc.py --verbose --log-interval 50000

Tune temperature (beta = 1/kT), lattice size, sampling cadence, and output path:

python ising_mcmc.py --beta 0.2 --steps 100000000 --sample-interval 10000 --verbose --log-interval 50000

Set a seed for reproducibility:

python ising_mcmc.py --seed 42

Output format

training_data.txt is CSV-like with a header:

energy,spin
-79.000000,"[1, 0, 1, ...]"
  • energy: absolute total energy of the lattice at that snapshot (ground-state degeneracy treated symmetrically).
  • spin: flattened row-major list of spins, encoded as 0/1 for (-1/+1).

Notes

  • Coupling J=1; periodic boundary conditions.
  • Uses the Metropolis acceptance rule with single-spin flips.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages