MC Einstein Solid

Program MCEinsteinSolid simulates the Einstein solid using the Metropolis Monte Carlo (MC) algorithm, which simulates systems at constant temperature. An oscillator is chosen at random and one unit of energy is either added or taken from the oscillator. If the change decreases the energy of the system, the change is accepted. If it increases the energy, a random number $r$ between 0 and 1 is computed and compared to $p = e^{-\Delta E/kT}$, where $\Delta E$ is the change in energy of the system. If $p \ge r$, the change is accepted; otherwise it is rejected. This algorithm leads to a Boltzmann distribution for the microstates of the system.

The goal of this simulation is to show how the Metropolis algorithm works to simulate a system in the canonical ensemble.

Problem: Simulation of the Einstein solid in equilibrium with a reservoir

Program MCEinsteinSolid implements the Metropolis algorithm for an Einstein solid of $N$ particles at a temperature $T$. (As usual, we choose units such that the Boltzmann constant $k=1$.)

  1. Choose $N=20$ and $\beta = 1$. Does the energy of the system eventually reach a well-defined average? If so, determine $\overline{E}(T)$.
  2. Compare your results to the analytical results found in Problem 4.26 in the text.


Problem 4.32 in Statistical and Thermal Physics: With Computer Applications, 2nd ed., Harvey Gould and Jan Tobochnik, Princeton University Press (2021).

OSP Projects:
Open Source Physics - EJS Modeling - Tracker - Physlet Physics - Physlet Quantum Physics - STP Book