Two and three dimensional Ising model simulations using Swendsen-Wang algorithm.
Open the project's directory in terminal. Type make
(or mingw32-make
depending on your environment) to compile.
Run main_2
and enter the parameters. You can also write the parameters in a file and use it as the input.
Example command:
For Windows:
main_2 < ./examples/input_2/1.txt
For macOS or a Linux based OS:
./main_2 < ./examples/input_2/1.txt
The results will be written into the files specified in the input.
You can visualize the results using plot.py
.
Note
You need to have matplotlib installed for this step.
Example command:
python plot.py -M ./examples/output_2/m1.txt -S ./examples/output_2/s1.txt --save ./examples/output_2/figure1.png
- You may need to type
python3
instead ofpython
depending on your environment. --save
is optional.- If you do not want matplotlib GUI to show up, you can pass the argument
--no-gui
. - If you need help about the usage of
plot.py
, you can trypython plot.py -h
.
This is similar to the two dimensional case.
Example commands:
For Windows:
main_3 < ./examples/input_3/1.txt
python plot.py -M ./examples/output_3/m1.txt -S ./examples/output_3/s1.txt --save ./examples/output_3/figure1.png
For macOS or a Linux based OS:
./main_3 < ./examples/input_3/1.txt
python plot.py -M ./examples/output_3/m1.txt -S ./examples/output_3/s1.txt --save ./examples/output_3/figure1.png
See here for more.