Boltzmann distribution

Introduction

A Monte Carlo simulation of a classical particle in one dimension in equilibrium with a heat bath.

Algorithm

The Metropolis algorithm for sampling the states of the system can be summarized by the following steps:

  1. 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)δ.
  2. Compute the change in energy ΔE.
  3. 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.
  4. Compute the quantities of interest.
  5. Repeat for many Monte Carlo steps (mcs).

Questions

  1. 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.
  2. 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.
  3. 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.

Java Classes

Updated 29 December 2009.