Ising model simulation for honeycomb and triangular lattice. This code is originally from https://www.mathworks.com/matlabcentral/fileexchange/62194-ising-model-and-metropolis-algorithm for square lattice. Our detailed model for analytical solution and simulation are available from the slides and report. Any discussion is welcome!
The matlab live script files (.mlx) are example to run the code for different kinds of lattice (Triangular, honeycomb and square lattice). If you want to simulate the lattice with impurity and defect lattice, replace initSpins with initSpinsImpurity in your simulation.
regular Hexagon lattice:
Honeycomb lattice with impurity:
Honeycomb lattice with missing spins: