12#ifndef __ISING_MODEL__
13#define __ISING_MODEL__
22#include <unordered_map>
24#define INDEX(I, N) (I + N) % N
Test class for the Ising model.
The Ising model in 2 dimensions.
int M
The current magnetic strength. unit: Unitless.
std::unordered_map< int, double > energy_diff
A hash map containing all possible energy changes.
double T
The temperature of the model.
int L
Size of the lattice.
arma::Mat< int > lattice
matrix where element .
void initialize_lattice()
Initialize the lattice with a random distribution of 1s and -1s.
data_t Metropolis()
The Metropolis algorithm.
void initialize_energy()
Initialize the energy.
void initialize_neighbors()
initialize the neighbors matrix.
void initialize_magnetization()
Initialize the magnetization.
arma::Mat< int > neighbors
matrix with the neighbors of each element .
int get_M()
Get the current magnetization.
int get_E()
Get the current energy.
IsingModel()
Constructor used for testing.
int E
The current energy state. unit: .
void initialize_energy_diff()
Initialize the hashmap with the correct values.
Header for the data_t type.
Useful typedefs for cleaner code.
Function prototypes and macros that are useful.