A Monte Carlo simulation of a classical particle in one dimension in
equilibrium with a heat bath.
The Metropolis algorithm for sampling the states of the system can be summarized by the following steps:
- Make a random trial change in the velocity of the particle by adding or
subtracting an amount equal to a random number times the input parameter equal to the maximum change in velocity, v → v + (2r - 1)δ.
- Compute the change in energy ΔE.
- If ΔE ≤ 0, accept the change. If ΔE > 0, then compute exp(- ΔE/kT). If r < exp(- ΔE/kT), where r is a random number between 0 and 1, then the trial change is accepted. Otherwise, do not accept the trial change. We will choose units such that Boltzmann's constant k = 1.
- Compute the quantities of interest.
- Repeat for many Monte Carlo steps (mcs).
- Show that the results for the mean energy and mean velocity of the particle are insensitive to the values of the initial speed and the
maximum change in velocity.
- What is the form of the probability distribution of the velocity?
Show that the width of the distribution is proportional to the
temperature by doing simulations at different temperatures.
- Describe the shape of the probability distribution of the energy. Confirm that the form is an exponential and show that the
energy distribution is proportional to exp(-E/T). Explain why you would expect this result.
Updated 29 December 2009.