Implementation of Metropolis

The crucial point is the calculation of the transition probability:

This is conviniently calculated as

  delene = ... 

  if( delene < 0. ||
    (delene < 15.*kbt && exp(-delene/kbt) > ran()))
        accept();
    else
        reject();

This implementation does handle T=0 correctly and it does not cause underflow or overflow for exp().

T=0 as well as large positive and large negative changes in energy are physical meaningful situations. It is remarkable that many MC programs do not handle one or more of these situations corretly.


Back

Author Per Stoltze stoltze@fysik.dtu.dk