Ising
Ising
Ising
University of Uppsala
∗
jeg1@hi.is
Abstract
A Monte Carlo algorithm for a two dimensional Ising model is proposed and
implemented using Matlab. The results of computer simulations agree with other
sources that claim that the critical value of interaction strength is close to 0.44.
Table of contents
1 Introduction 1
2 The Model 1
References 10
A montecarlo.m 11
B ising.m 13
1 Introduction 1
1 Introduction
The two dimensional Ising Model is very suitable for practising simple Monte Carlo
methods. It describes a lattice with a discrete number of particles that have some
binary propertie such as spin. We can study the evolution of the system over time
depending on a particular variable called the interaction strength. At a certain
value of interaction strength we notice a phase transition, albeit a week one. The
interacation strength at this transition is compared to a theoretical value.
2 The Model
(2.1)
X X
H = −J Si Sj − B Si
hiji i
where hiji means that we sum over the nearest-neighbour pair of spins. This
means that the spin at site ij interacts with at i(j ± 1) and (i ± 1)j . We will be
assuming periodic boundary conditions in our model which means that every spin
will interact with four other spins regardless of their position on the nite lattice.
We refer to gure 1 for better understanding of the proposed system. Here J is
Figure 1: The energy of particle on the left is low since all the neighboring particles
have the same alignment of spin. In contrast, the energy of the particle on the right
is at its highes since all the neighboring particles have a dierent spin alignment.
the Magnetisation of the lattice and is also dimensionless. From the Hamiltonian
we can calculate the partition function which is
(2.2)
X
Z= e−Hi
i
where we sum over all the particles in the lattice. Then the probability of nding
the system in a certain state, denoted S, is
e−H(S)
p(S) = (2.3)
Z
We can now calculate quantaties such as Magnetisation and susceptibility using
well known equations from statistical physics. We have
∂ log Z X
(2.4)
X
M= = p(S) Si
∂B S i
(2.6)
X
E= p(S)H(S).
S
such as M and E is obtained will give as an estimation of the true value. We must
point out that in the limit of an innitely large lattice, it is possible to solve the
Ising model exactly. If we assume that B = 0 the expressions are simplest and we
see that the energy is [2]
2
2
E = −N J coth(2J) 1 + ξK1 (κ) , (2.9)
π
the Magnetisation is
(1 + z 2 )1/4 (1 − 6z 2 + z 4 )1/8
M = ±N 2 (2.10)
(1 − z 2 )1/2
when J > Jc but vanishes when J < Jc and the specic heat is
2 hπ i
C = N 2 (J coth(2J))2 2K1 (κ) − 2E1 (κ) − (1 − ξ) + ξK1 (κ) . (2.11)
π 2
Here
sinh(2J)
κ=2 ≤ 1, (2.12)
cosh2 (2J)
ξ = 2 tanh2 (2J − 1) (2.13)
and z = e−2J . The critical value of J for which κ = 1 is Jc = 0.4406868. The
complete eliptical integrals of the rst and second kind are
Z π/2
dφ
K1 (κ) ≡ , (2.14)
0 (1 − sin2 φ)1/2
κ2
Z π/2
E1 (κ) ≡ dφ(1 − κ2 sin2 φ)1/2 . (2.15)
0
These thermodynamic parameters can be calculated using numerical methods and
compared to the results of the Monte Carlo model.
3 Running the model 4
We wrote a code in Matlab that implements the model, a part of the code is
borrowed from particularly well written Matlab code by Tobin Fricke [3]. The
code can be seen in the appendix. We choose to begin by creating a square lattice
with 400 particles and assign random spin orientation. We also choose a random
value between 0 and 1 for the interaction strength and then watch how the system
evolves over 1000 steps. Note that a positive value for interaction strength means
that the energy is lower if the spin is in the same direction as that of its neighbors.
This corresponds to ferromagnetism while a negative value of J means that the
spins will tend to be anti-aligned corresponding to anti-ferromagnetism. The speed
of evolution is controlled by the variable randTol and in this case we decided that
randTol = 0.1. A value of 0.1 means that only 10% percent of the originally
selected group will have its spin ipped. In essence this parameter tries to mimic
the evolution of real systems. Even though a certain particle will have a smaller
energy with its spin ipped it doesn't mean that the all the particles in the lattice
that follow that criterion will have their spins ipped immediatly. We watched the
evolution of 12,000 systems and took note of some of the important parameters.
We then plot the total energy of the system as a function of interaction, see gure
2. Although it isn't very distinctive we can see some transition at an interaction
Figure 2: Energy as a function of interaction strength for the 202 particle lattice.
strength between 0.4 and 0.5. This can be seen more clearly when we look at the
change in Magnetisation as a function of interaction strength, see gure 3. When
the strength of interaction is low the spin of particles tends to be randomly oriented
which results in a zero net Magnetisation. This corresponds to a high temperature
(the crossing of Curie's temperature) since J = −E/kT which means that J is
inversely proportional to T . However, as we increase the interaction strength the
spins tend to align. When looking at the relation between Magnetisation and
3 Running the model 5
energy, see gure 4 we see that there are two regions of low energy corresponding
to spin up orientation and spin down. There are also low energy cases that do
not show a high net Magnetisation. This happens when we have relatively large
clusters of either spin up and spin down. This is analogous to the domains of
ferromagnets. It is good to notice that a net Magnetisation or the formation of
Figure 5: Energy as function of interaction strength for the 1002 particle lattice.
to look at the evolution of the system over 1,000 steps to reach an equilibrium.
We see that there are two reasons for an increased computational time in a larger
lattice. One, since it is bigger the ipping of spins for more particles needs to be
decided. Two, it takes greater time for a larger system to reach equilibrim which
means that you have to let the system evolve over a larger number of steps. In this
case, since the calculations are more demanding, we only look at the evolution of
3.1 A bigger lattice 7
1,000 systems. Unlike before the value of the parameter randTol was 0.5 which
meant that the speed of evolution was much faster. The computer time needed to
nish these computations was approximately 43 thousand seconds on a Pentium
4, 3GHz processor. As can be seen in gure 5 the phase transition is much more
apparent. The splitting of the line which becomes more apparant as interaction
strength increases is probably due to dierent energy for the lattice with domains,
i.e. zero net magnetisation, and the lattice with a total magnetisation of -1 or
1. We also notice, see gure 6 and 7, that more systems seem to populate the
M = −1 and M = 1 branches than for the case of a 400 particle lattice. It turns
out that this is in agreement with theory. We will end by comparing these results
with theoretical model proposed in chapter 2.
4 Comparing the model with theory 8
It is easy to calculate the theoretical values for energy and Magnetisation ac-
cording to equations (2.9) and (2.10). We can then compare them to the values
obtained using our model. The theoretical model assumes an innite lattice which
aects the meaning of all our comparisons. It is however a reasuring thing that
our Monte Carlo model gives better results for the bigger lattice. This proba-
bly implies that the greater lattice you model the more agreement you will nd
with the theoretical value. We can see that the theoretical model for the energy
is quite dierent from what we obtain using our model, see gure 8. But like
Figure 8: Energy as a function of interaction strength for the 1002 particle lattice.
we said before, the theoretical model was in the limit of an innite lattice and
therefore we cannot be too surprised that theory and our model do not agree. We
innity when the interaction strength goes to zero. This is in agreement with the
References
Appendix
A montecarlo.m
Contents
Initial Conguration
Setting up the theoretical model
The Monte Carlo Loop
Figure Generation
% File montecarlo.m
Initial Conguration
n_grid = 20; % Size of grid
Ms = [];
Js = [];
Ns = [];
Es = [];
%while (1),
% Choose a random value between 0 and 1 for the interaction strength
J = rand()+1e-10;
% Perform a simulation
[M, N, E] = ising2(n_grid, J);
Figure Generation
Energy per site, versus interaction strength
figure(1)
plot(Js, Es, 'ro');
hold on
plot(J,E);
ylabel('energy per site');
xlabel('interaction strength');
pbaspect([2 1 1]);
print(gcf, '-depsc2', 'ising-energy');
ylim([-1.1 1.1]);
pbaspect([2 1 1]);
print(gcf, '-depsc2', 'ising-Magnetisation');
B ising.m
B = 0;
M = []; % The total magnetic field of the system
E = []; % The total energy of the system
end