Next: Quiz Up: Importance Sampling. Monte Carlo Previous: Ensemble Averages (flashback).

Importance Sampling. Metropolis Algorithm

Ensemble distribution is sharply peaked in some regions of the phase space, and is very small, virtually zero in the most of it.

For liquid, for instance, only the configurations without overlaps are possible. That means, that applying simple Monte Carlo approach to our problems is not very helpful.

The cure is to sample the relevant configurations only. We can create a random walk in the phase space, sampling it with the ensemble distribution.

Then, the ensemble average, would be just the average over all points , generated by this random walk:

Designing the random walk algorithm:
We want our random walk to sample phase space with the probability density

Designing a random walk means to specify the algorithm to go from the current point to the next . If the transition probability to go from to in one step is , and the probability density at the n-th step is , we can write the master equation'' for our random walk:

It is the same equation as the Kolmogorov-Chapman equation from the last lecture . It's called differently, because, unlike the situation in the last lecture, here we know P, and try to find W. This equation just counts the probability to be at the point at the n+1-st step as the probability to be there at the n-th step minus the probability to leave for any other point , plus the probability to come from any other point . As we want to build the stationary random process, we do not want P depend on n, hence we assume . We also use that .
 (2)

Any random process with the transition probability satisfying equation (2) would serve our purpose, but we want to go the easy way. We'll try to construct the random walk, that satisfies more strict condition of the detailed balance. Instead of solving the integral equation for W, we make W satisfy the following:

• For any two points and    (3)

Detailed balance is a sufficient, but not necessary condition for a random process to sample the phase space with the probability density . Any scheme, satisfying (3) will do it for sure, but it does not mean, that if a random process does not satisfy (3), it's probability density P cannot be proportional to .

There is more than one solution for W to satisfy detailed balance. Most of the MC methods do so, as this is the safest way to make a Monte Carlo simulation. It guarantees success..

Here are two examples ()

1.

2.

 (4)

is an arbitrary constant. If there is any dynamic interpretation of the MC simulation, can be taken as a time scale corresponding to one MC step. The second example (4) is the basis of the famous Metropolis Monte Carlo algorithm

Metropolis algorithm:
Here is how it goes:
1.
Choose the initial position, calculate energy
2.
Pick the random displacement, calculate the new location and energy
3.
Decide whether to accept the move:
• if , calculate
• draw a random number r from 0 to 1.
• if w<r or , accept the new position, update it and the energy, otherwise, stay at the same place, add the current values to the running averages.
4.
go back to step 2

Fortran code Example 2 :
Here is an example of the Fortran code to calculate the average energy for the harmonic oscillator by the Metropolis Monte Carlo method. Code.

Next: Quiz Up: Importance Sampling. Monte Carlo Previous: Ensemble Averages (flashback).

© 1997 Boris Veytsman and Michael Kotelyanskii
Tue Nov 4 23:48:52 EST 1997