Ising Model, Monte Carlo Method, and the Metropolis Algorithm

A breezy intro to the Ising model, Monte Carlo method, and Metropolis algorithm — just enough to say you've heard of them once.

This time let’s take a quick look at the Ising Model and move on.

This one I won’t cover in detail either. Just “let’s at least hear about it once.” is the main purpose of this posting.

This model is apparently the simplest model used in the study of magnetic materials.

If it’s a field that studies magnetism, it’ll be related to spin.​

The super-simple spin-related model was proposed by Wilhelm Lenz and studied in one dimension by Ernst Ising

How simple did he make it

The spin-related interaction

Equation from the original notes

should be written like this,

but the Ising model says “first let’s just look in one direction!”

So ignore x, y!!!!!​

And on top of that

Equation from the original notes

it adds the assumption that each of these can only take +1 or -1.

And and and and and and and on top of all of that​

the spin interaction is only between the nearest atoms!!!!! it sticks this on too.

So​

Equation from the original notes

For an actual material, particle G would be influenced by multiple particles 1, 2, 3, 4, 5, 6, 7, 8.

No, even more, 9, 10, 11, 12, 13, 14, 15, 16, 17…. an infinite number of particles would affect it.

This is probably what’s actually true

The Ising model is a model that ‘assumes’ it’s only influenced by the nearest particle

i.e., as a picture it would be expressed like this​

Equation from the original notes

Ignoring everything else, the nearest atoms are only particles 2, 4, 5, 7!!!!​

Alright, since we said there’s only the z direction, now let’s drop the z subscript and write it out.​

The Hamiltonian for spin would be like this.

Equation from the original notes

It’s expressed as the sum over neighboring sites i, j, and S can only be +1, -1~~~​

Then what is J… J….

J can be said to be a property of the material, the substance.

Equation from the original notes

these will interact in the direction that minimizes the Hamiltonian.

If J is positive, to minimize H ​

Equation from the original notes

needs to be 1 to be a minimum, and

Equation from the original notes

being 1 means we can say there’s an interaction making them have “the same direction”.​

But on Earth there are also things with J < 0.

Then to minimize the Hamiltonian

Equation from the original notes

it becomes minimized when there are lots of things turning to -1.

That is,

Equation from the original notes

there’s pressure to align “in opposite directions” to each other.​

So when J is positive, it represents a ferromagnetic — super-magnet — interaction,

and when J is negative, it represents an antiferromagnetic interaction, favoring opposite neighbors.​

Then let’s explore the Ising model for 4 atoms.​

Ising model for ferromagnetic interaction (J > 0),

let’s consider 4 spins located at the corners of an interacting square.​

Let’s think about how many cases there are for the Energy it can take​​

For E = -4J there are exactly two cases​

Equation from the original notes

Equation from the original notes

These exactly two cases have E = -4J.

Why this is -4J — taking only these neighboring ones gives -J four times

so the total energy is -4J.​

Let’s also think about E = 4J

Since J > 0, for E = 4J

all neighboring spins have to be in opposite directions to each other.​

That is, this too has exactly 2 possible cases.

Equation from the original notes

Equation from the original notes

And every other case is E = 0.​

↑↑

↑↑

if you flip just one spin from this,

↑↓

↑↑​​​​​

if you work it out it’s 0, and

if you flip a different one it stays the same​

Then since we know all the Energy states and we know the counts,

let’s work out the partition function Z.​

For the four-edge square, $Z=2e^{4\beta J}+12+2e^{-4\beta J}=12+4\cosh(4\beta J)$. In the final pictured line, delete the extra multiplicative $\beta$ after $\cosh(4\beta J)$; the $\beta$ already inside the cosh argument is correct.

Equation from the original notes

Oho, the partition function comes out like this.

Since we’ve derived Z, now we can easily pull out the state functions.​

The mean energy is $U=-\partial_\beta\ln Z=-4J\sinh(4\beta J)/[3+\cosh(4\beta J)]$, not the derivative shown in the next picture. This gives the stated limits $-4J$ as $T\to0$ and 0 as $T\to\infty$.

Equation from the original notes

Let’s plot <E> against temperature.

Figure 28.16. Mean energy of a system of four Ising spins according to Eq. 28.62.Open figure at full size

Figure 28.16. Mean energy of a system of four Ising spins according to Eq. 28.62.

It sits at -4J at low temperature, climbs fairly quickly through the middle, then slowly levels off toward 0 at high temperature. Apparently there are 4 really important facts here.

  1. When T→∞, <E> = 0

Since the probability of going to every state becomes equal, it goes to the state with the highest entropy~​

  1. When T→0, <E> = -4J!!!​

<E> being -4J means e~verything aligns in the same direction.

That is, the lower the temperature gets, the more “ordered”

i.e., it means it becomes a state where entropy is not large!!!!​

  1. <E> already changes quite extremely, but if you increase N further

you can see even more extreme changes, apparently.

A true thermodynamic singularity requires the infinite-size limit. These four spins alone have no finite-temperature phase transition!​

  1. Here there are 2 possible ground states.

↑↑

↑↑

or

↓

↓

But if we think in terms of the concept of “thermal equilibrium”, whether they go back and forth between the two or not,

just the equilibrium being <E> = -4J is what it means,

but in reality at T→0, does it make any sense that with that tiny bit of energy the thing would wholesale go from up-up-up-up to wholesale down-down-down-down or whatever changes??????

At low T, switching the whole magnetization with local moves can take an extremely long time. That is a sampling/dynamics issue, not a reason to discard equilibrium statistical mechanics.​​

Monte Carlo is one numerical way to sample the statistical-mechanical equilibrium distribution!!!!​

What is the Monte-Carlo Method….

I happened to hear someone explain Monte-Carlo method to a high-school student,

let me repeat that simply.​

Equation from the original notes

It’s one of the computer simulation methods.

You use a computer to randomly splatter points like crazy.

Just tell it to blast away. A computer can make random points​

If we run this quickly,

when the computer dots 5000 points,

it counts the number of points that fell inside that square. About 1917 were marked, apparently

​Now then, what points are being counted,​

Equation from the original notes

we count the number of points dotted inside this circle of radius r.

If we count, 1503 get caught, apparently

​And if we take this ratio

Equation from the original notes

this comes out, and what this means we’ve just computed is…..

Equation from the original notes

we’ve computed this…..​

Whoa then if we multiply by 4 let’s see what happens……?

Equation from the original notes

Yep…. apparently we can also compute π this way.

Right now it didn’t get to 3.14, but if we increase the number of trials more more more more more more, we can compute π to an amazingly surprising degree.​

……..Monte-Carlo method — do you get a little sense of what it’s trying to do????????

Why is this Monte-Carlo method necessary right now…..???​

In studying the Ising model,

directly enumerating all states gets costly when N is large, especially in higher dimensions.​

There are important exact results too: the zero-field square-lattice 2D Ising model is solvable. Simulation is useful far beyond the cases with simple analytic solutions.​

​(Above, there were only 4, so we could do it by hand….)​

So in 1D with the existing

Equation from the original notes

analysis is possible,​

and what this ‘possible’ means is: suppose we have a 1D solid.

Since it’s a solid, let’s assume ΔV ~~ 0, i.e. almost no change in volume.

Then when finding equilibrium, rather than thinking in terms of minimizing the Gibbs free energy, whose variables are p, T,

it would be better to think in terms of minimizing the Helmholtz free energy, whose variables are T, V.

Let’s look at the 1D ground state.​

The ground state, as we learned above, would have everything aligned in the same direction.

↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑​

​Here let’s arbitrarily flip one spin shyoom!!!​

↑↑↑↑↑↑↑↑↑↑↑↑↑↓↑↑↑↑↑↑↑↑↑​

We flipped it, so how does the free energy of that class of defects compare?

We use the F = U - TS function, and for S we use the statistical mechanics definition of entropy.​

Equation from the original notes

Equation from the original notes

What is the energy cost and the entropy gain?

First, the energy changes by 4J.

With the left neighbor it was -J, and it becomes +J so it changes by +2J

and with the right neighbor it was originally -J too, and it becomes +J so it changes by +2J

in total it changed by 4J

and

Equation from the original notes

There are N choices for the flipped site, giving a configurational entropy gain $k_B\ln N$ for that one-defect class.

Therefore

Equation from the original notes

so the free energy change from putting one deformation on the chain

keeps going to negative infinity as N gets larger.

This shows that perfect alignment has thermal defects at nonzero T, but a single-spin defect alone does not prove the absence of long-range order.

For the infinite nearest-neighbor 1D Ising chain at zero applied field, use domain walls: one wall in an open chain costs only 2J regardless of domain length, with order N possible positions. Its entropy gain wins at any positive T,

meaning the system is in a disordered state at every positive temperature (at zero applied field), and the critical temperature is T=0.​

It can go to a conclusion similar to reality too!!!

In 2D, domain walls have a length-dependent energy cost, so the balance can allow a finite-temperature ordered phase. Direct enumeration still grows very fast:

for an N by N square there are N squared spins, hence 2 to the N squared configurations.

Equation from the original notes

If we look at a 2x2 like this, the total number of cases is​

per atom there are 2 possible spins, 4 atoms

so the total number of cases is

Equation from the original notes

Then for a 3x3 solid the total number of cases is

Equation from the original notes

For 4x4 the total number of cases is

Equation from the original notes

Ugh…. the count is exponential in the number of spins (2 to the N squared when N is the side length),

expo-expo-expo-nennn-tiallyyy,

saying that counting

Equation from the original notes

cases is impossible doesn’t seem wrong.​

Also, another problem in 2D is,,,,

Equation from the original notes

suppose there are 3 atoms like this.

And, two of the spins are determined​

Equation from the original notes

lol lol lol lol lol

with those two neighbors temporarily fixed in opposite directions, either choice disagrees with one of them, right??????

it roughly ends up in a bind.​

Equation from the original notes

Which direction should it react to bring equilibrium to the system?????????

lol lol lol lol seriously this is absurd

(This is a local conflict with fixed neighbors. It is not proof that the nearest-neighbor square ferromagnet is geometrically frustrated; that model can satisfy every bond by aligning all spins.)​

Alright alright alright alright so. that’s. why. computer simulation via the Monte-Carlo method is needed apparently.

Sample configurations with their Boltzmann weights and average after equilibration…. not just uniformly random spin configurations at every temperature!​

There are a ton of algorithms used with the Monte-Carlo method, and the easiest one among them to introduce

is called the Metropolis algorithm.

What kind of algorithm is it: you pick any atom and flip its spin shyoong!!! and if $\Delta E\le0$, accept the flip and keep the new state

and if it raises the system’s energy by ΔE,

Equation from the original notes

​with this probability you accept the flip and keep the new state,

Equation from the original notes

​and with this probability you reject it and return to the old state

going through this process

you keep picking another arbitrary atom and flip it and again follow the above process

with suitable proposals, equilibration and enough sampling, this has the canonical distribution as its stationary distribution. Successive samples are correlated, and near criticality local moves can equilibrate slowly!

let’s look at the result after following this algorithm.​

if we color up spins black and down spins white, here’s what we see as the temperature goes up:

Figure 28.18. Spin Monte Carlo snapshots of the two-dimensional Ising model at increasing temperatures. Spin states +1 and −1 are black and white, respectively.Open figure at full size

Figure 28.18. Spin Monte Carlo snapshots of the two-dimensional Ising model at increasing temperatures. Spin states +1 and −1 are black and white, respectively.​

At T ~~ 0 it converges to an al~most static state

At T ~~ T_c it shows enormous fluctuations

At T ~~ ∞ up and down exist in equal proportions…​

This can predict such actual phenomena, apparently

so complex-systems research methods are essential in the physics domain

something like that………..

Ugh………..I don’t understand anything

pretending to know is freakin’ hard damn

ugh I’m pissed, let’s go to grad school damn I’m dead gonna smash everything

Questions or corrections?

Did a step lose you, or does a number look off? Email me or use the contact page. Include the note title and the step or figure you mean.

Feedback goes to me privately by email; it is not posted as a public comment.