This repository applies a Monte-Carlo simulation scheme, involving a system of spins arranged in a 2D-lattice, using different algorithms. Dynamics are based on the basic Ising-model Hamiltonian:
including only nearest-neighbor interactions between spins, and no external magnetic field (which can be easily included).
The scheme is flexible regarding both the possible spin values and the used algorithm, such that additional algorithms can be easily added to the modeling framework (by adding new step__*.m
functions and including them in sim_basic.m
. Furthermore, wide generalizations can be made with just a few steps (for example, an external field or higher order interactions can be included via slight modifications to the coupling or interaction functions, respectively). Introducing different models to it (such as higher-dimension lattices or angular spin directions) is reasonably achievable too, making this framework quite useful.
Hopefully, you'll find it useful too! 🙏
Note
Here, the general structure of this repository's Code section is described. For a more specific description, look at each script specifically.
-
nearest_neighbors_2D_open.m
andcoupling_nearest_neighbors_2D.m
are the most basic functions, regarding spin ineteractions in a given matrix. -
The
step__*.m
functions execute the spin dynamics (a single algorithm-step) using the interaction functions, each of which adheres to a different algorithm and model.
form_cluster.m
is a sub-function of the Wolff-algorithm step function. -
cluster_size__wolff__2D_ising.m
finds the typical spin-cluster sizes in the Wolff algorithm at a given temperature. -
The
*_correlation.m
functions regard the auto-correlation of the system between different steps (i.e. 'time' correlation), which helps to derive the system's decorrelation time, and thus to determine the needed number of steps between following measurements (in order to get meaningful data thermodynamically).
plot__correlation.m
is called bysim_correlation.m
. -
The
sim_*.m
functions execute the actual simulations, and communnicate between the apply scripts and the step functions (orfind_correlation.m
in the case ofsim_correlation.m
). Their inner heirarchy is as such:
$\quad\quad\quad\quad\quad\quad$ sim_temperatures.m
$\quad \longmapsto \quad$ sim_smpl_avrg.m
$\quad \longmapsto \quad$ sim_basic.m
plot__M_E_C_X__vs__T.m
is called bysim_temperatures.m
. -
The
app_*.m
scripts are the main scripts that apply the simulation scheme, and are executed directly by the user.
Data and corresponding figures are automatically saved with easily identifiable, corresponding file names (including the simulation type, important parameter values, and used algorithm), in the Data and Plots directories, respectively.
A few basic examples are already included in the repository, inside these two directories. Here are the two figure types that are currently produced by this repository: