The Metropolis Algorithm and the Two-dimensional Ising Model

In a calculation of the Ising model in two dimensions, the number of configurations is given by \( 2^N \) with \( N=L\times L \) the number of spins for a lattice of length \( L \). Fortunately, the Metropolis algorithm considers only ratios between probabilities and we do not need to compute the partition function at all. The algorithm goes as follows

  1. Establish an initial state with energy \( E_b \) by positioning yourself at a random configuration in the lattice
  2. Change the initial configuration by flipping e.g., one spin only. Compute the energy of this trial state \( E_t \).
  3. Calculate \( \Delta E=E_t-E_b \). The number of values \( \Delta E \) is limited to five for the Ising model in two dimensions, see the discussion below.
  4. If \( \Delta E \le 0 \) we accept the new configuration, meaning that the energy is lowered and we are hopefully moving towards the energy minimum at a given temperature. Go to step 7.
  5. If \( \Delta E > 0 \), calculate \( w=e^{-(\beta \Delta E)} \).
  6. Compare \( w \) with a random number \( r \). If \( r \le w \), then accept the new configuration, else we keep the old configuration.
  7. The next step is to update various expectations values.
  8. The steps (2)-(7) are then repeated in order to obtain a sufficently good representation of states.
  9. Each time you sweep through the lattice, i.e., when you have summed over all spins, constitutes what is called a Monte Carlo cycle. You could think of one such cycle as a measurement. At the end, you should divide the various expectation values with the total number of cycles. You can choose whether you wish to divide by the number of spins or not. If you divide with the number of spins as well, your result for e.g., the energy is now the energy per spin.