0
$\begingroup$

2D Ising model simulation using Metropolis algorithm.

There is one thing which I don't understand. The difference in energy $\Delta E$ between initial state and new state is:

$\Delta E = 2Js\sum_rs_r$ (btw can someone confirm that pls) where J is constant, s-initial spin and sum is equal to the sum of spins of the nearest neighbours.

The new state is always accepted when $\Delta E<0$ or if $\Delta E>0$ accepted with probability $p=\exp(-\Delta E/k_bT)$.

The question is what happens when $\Delta E = 0$?

$\endgroup$
  • $\begingroup$ If you apply either of the $\Delta E < 0$ and $\Delta E > 0$ rules to the $\Delta E = 0$ case, you get the same result (accept with probability $p=1$). $\endgroup$ – Noiralef Jan 28 '17 at 11:29
0
$\begingroup$

The answer comes from the implementation. The simplest way to code this is to generalize the process of acceptance by always calculating the acceptance probability $p=\exp(-\Delta E / k_b T)$, which, all other quantities assumed constant:

  • is between 0 and 1 for $\Delta E > 0$
  • is larger than 1 for $\Delta E < 0$
  • is exactly 0 for $\Delta E = 0$

Then you pick a real number between 0 and 1 at random and if it's less than $p$, accept the spin flip. And here's the kicker - since you're picking a random float, the chance of hitting precisely 1 is basically zero. So it's not something that's going to impact your simulation either way.

This, at least, is how it was implemented in the amazing MOOC "Statistical Mechanics: Algorithms and Computations" on Coursera, so I'm basing the answer on that.

Your $\Delta E$ expression looks okay, by the way.

$\endgroup$
  • $\begingroup$ For ΔE = 0 p =1 and spin flip is always accepted? $\endgroup$ – ad1v7 Jan 27 '17 at 22:05
  • $\begingroup$ Yeah, because your random number for checking acceptance of the flip is always below zero. $\endgroup$ – Perfi Jan 27 '17 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.