In the 2D XY model, spins are unit vectors with angle theta(i,j).
Topological charge on plaquette (i,j):
q = (1/2pi) * sum of angle differences around the square (mod pi to [-pi,pi]).
Vortices (q=+1) and antivortices (q=-1) come in pairs. Below the Kosterlitz-Thouless temperature T_KT, pairs are bound; above T_KT they unbind and destroy quasi-long-range order.