# Why does the Metropolis algorithm allow changes even for ∆E > 0?

In the Metropolis Monte Carlo algorithm, why can you accept changes even for $\Delta E > 0$ (provided that a random number is less than a given probability ratio, e.g. $\exp(-\beta \Delta E)$)?

• Basically: you want the global minimum and if you don't allow going up in the energy landscape, you can't get out of a local minimum to get to the global one. – Wouter Sep 10 '14 at 12:50
• user2561523, it would be nice if you accepted one of these guys' answer, they have all provided you clear and sufficient explanation! I've noticed you very rarely accept answers to your posts, it is not a nice attitude on SE to just take your answer and not show appreciation! – Phonon Sep 13 '14 at 7:31
• @Phonon Sorry, I didn't know that was the etiquette around here. Thanks for letting me know. I have since accepted one of the answers. – user2561523 Sep 13 '14 at 13:52

Standard Monte Carlo samples the canonical (NVT) ensemble. So it maintains constant temperature but the potential energy is free to fluctuate - both up and down.

This will only seem odd if you incorrectly imagine the equilibrium state of a system to correspond to that with the minimum energy. The equilibrium state is actually determined by the minimum free energy which balances potential energy with entropy. So although there will be a natural inclination to decrease the potential energy, there is also an inclination to increase entropy (which the $\Delta E>0$ case helps achieve).

As a demonstration, imagine starting with an ice structure and increasing the temperature to 1000 K. What will happen to the structure if you omit the $\Delta E > 0$ case? Absolutely nothing.

• Dear lemon, since you are also very much involved with computational physics in your studies, I was wondering if you had any recommendations for introductory books on MC and MD simulations, in physics. Other than the famous Daan Frenkel & Berend Smit book. Thanks in advance! – Phonon Sep 11 '14 at 0:58
• @Phonon Frenkel & Smit is a favourite of mine but a slightly softer introduction is Allen & Tildesley's classic Computer Simulation of Liquids. Otherwise, most MD/MC software come with very detailed manuals - I've learnt a great deal from these. – lemon Sep 11 '14 at 10:55
• By the way, interestingly about the lowest energy vs the lowest free energy point you bring up in your answer, it is also a matter of confusion to a lot of people when it comes to liquid-liquid phase coexistence interfaces, where although the lowest energy would correspond to a planar interface, at equilibrium the interface is actually fluctuating due to a greater entropy (low knowledge on the interface's actual position), which I find very neat! That's why I liked your answer right off :) – Phonon Sep 11 '14 at 11:16
• @Phonon That's absolutely right. It actually took me a long time to fully get my head around the role of entropy in chemical systems but, once I had that 'aha!' moment, so many things suddenly made perfect sense. It is possibly the most important thing I've ever learnt. – lemon Sep 11 '14 at 11:25

The underlying reason is purely mathematical (apart from the fact that the relative probability of a state is $\exp(-\beta E)$), so'll give a mathematical answer.

The idea is that you want to sample the state space, meaning that you want to randomly generate states so that the generated states follow a probability distribution, in your case the Boltzmann distribution. One way is to directly generate samples, but that is often not a realistic option. An alternative is to randomly walk through the state space in small steps, where the steps are generated to follow a certain distribution in such a way that the long term sample will follow the required probability distribution. The Metropolis algorithm is one of the simplest such schemes, in which neighbouring states are randomly generated and accepted or rejected in such a way as to fulfill the previously mentioned condition.

The answer to your question is simply that if you would reject changes with $\Delta E > 0$, then you wouldn't be sampling according to that distribution.

If you want I can elaborate on how you can see this.

It's because you don't want to just find an optimum, but to sample the entire distribution. The MH algorithm satisfies a property called "detailed balance", and for me this video is the most intuitive explanation I've seen.

• Not allowing "backwards" motion also makes it possible that you can't find the optimum if your starting conditions are in a part of the phase space dominated by a local but suboptimal extremum. – dmckee Jun 26 '18 at 0:43