Planar model


This program implements a Monte Carlo simulation of the planar or XY model. The spins are located on a square lattice and can point in any direction in the plane. The interaction is given by -J s1 . s2, where J is the energy of the interaction, and s1 and s2 are two unit spin vectors on neighboring lattice sites. We can rewrite this interaction in a simpler form by substituting si,x = cos θi and si,y = sin θi, where the phase θi is measured from the horizontal axis in the counter-clockwise direction. The result is

-J cos(θi - θj),

    One of the interesting features of the d = 2 XY model is that the mean magnetization 〈M〉 = 0 for all nonzero temperatures, but there is a phase transition at a nonzero temperature TKT known as the Kosterlitz-Thouless transition. For T ≤ TKT the spin-spin correlation C(r) decreases as a power law; for T > TKT, C(r) decreases exponentially. The power law decay of C(r) for T ≤ TKT implies that every temperature below TKT acts as a critical point.

    Another interesting feature of the XY model is the existence of vortices and anti-vortices (marked by blue and red squares, respectively). A vortex is a region of the lattice where the spins rotate by at least 2π as you trace a closed path.


The Metropolis algorithm is used and can be summarized as follows

  1. A spin is chosen at random and rotated by a random amount up to a maximum value δ.
  2. The change in energy ΔE for the trial rotation is computed.
  3. If ΔE ≤ 0, accept the flip. Or if exp(-ΔE/T) > r, where r is a uniform random number between 0 and 1, the flip is also accepted; otherwise reject the flip.
  4. Repeat steps 2 and 3 for many Monte Carlo steps per spin (mcs).
  5. Accumulate data for the various thermodynamic quantities


  1. Run the simulation with the default parameters and observe the locations of the vortices using the default parameters. Follow the arrows as they turn around a vortex. A vortex is indicated by a square box. What is the difference between a positive (blue) and negative (red) vortex? Does a vortex ever appear isolated? Count the number of positive vortices and negative vortices. Is the number the same at all times?
  2. Click the Reset button and change the temperature to 0.2. Make sure the initial configuration is set to "random." You should see quenched-in vortices which don't change with time. Are there an equal number of positive and negative vortices? Are there isolated vortices whose centers are more than a lattice spacing apart?
  3. Click the Reset button and set the initial configuration to "ordered" and the temperature to 0.2. Also set steps per display to 100 so that the simulation will run much faster. Run the simulation for at least 1000 mcs and record the thermodynamic data. Repeat for temperatures from 0.3 to 1.5 in steps of 0.1. Plot the energy and specific heat versus the temperature. Near the specific heat and susceptibility peaks take more data in temperature intervals of 0.02. Do the peaks in the susceptibility and specific heat occur at the same temperature? Is the vorticity (the mean number density of vortices) a smooth function of the temperature?
  4. Near the peak in the susceptibility look at configurations showing the vortices. At the peak in susceptibility (the Kosterlitz-Thouless transition) is there any evidence that the positive vortices are moving away from the negative vortices? The Kosterlitz-Thouless transition is due to this unbinding of vortex pairs.

Java Classes

Updated 28 December 2009.