Logic behind Metropolis algorithm

113 Views Asked by At

I am using Metropolis algorithm to make a program for Ising model in Statistical Physics. In Ising model, we take a collection of spins with initial energy, say $E_i$, then we randomly flip one of the spins and recalculate the energy of the system. Let that energy be $E_f$. If $E_f<E_i$, then we accept that the spin flips but if $E_f>E_i$, we calculate $exp(-(E_f-E_i)/kT)$ and we compare this quantity with a random number between 0 and 1 generated using a uniform distribution. If $exp(-(E_f-E_i)/kT)>$random number, then we accept the spin flip, otherwise we reject it. What is the reason behind the comparison of $exp(-(E_f-E_i)/kT)$ with a completely random number? Why and How does this work?

1

There are 1 best solutions below

0
On

Let suppose you have chosen a particular spins using a random number. You have calculated the energy of this microstate beforehand and let it be denoted by E1. If the spin is flipped then it will affect its neighboring spins and let suppose the energy of the new microstate is E2. If E2

And for the case when E2>E1 ,as the system has the same probability to go from initial to final state or coming back to the initial state from final state , we compare it with a random number. And we choose a uniform random number varying from 0 to 1 to do the comparison. Here the randomness of the random number is fixed but as the energy difference increases or T decreases, the exponential term becomes small compared to the random number. And for this transition does not occur when the energy difference is large.