The XY model is one of many, many models describing a lattice of interacting spins. Unlike the Ising model, it considers spins that may point along any direction in the plane. The Hamiltonian of this model is
where the sum is over all nearest neighbor pairs
In this short project, I tried to estimate
- Choose a random number
$\phi \sim \mathrm{Unif}(-\alpha, \alpha)$ - Calculate the energy change
$\Delta E$ when a particular spin$\theta_i$ is changed to$\theta_i + \phi$ - If
$\Delta E \le 0$ , then set$\theta_i \leftarrow \theta_i + \phi$ .- Otherwise, if
$\Delta E > 0$ , set$\theta_i \leftarrow \theta_i + \phi$ with probability$\exp(-\beta \Delta E)$
- Otherwise, if
When the algorithm is written in this suggestive way, one might suspect that it converges to the canonical ensemble no matter the initial state. In fact, this is true (if any state is reachable from any other).
Following [1], the implementation updates the whole lattice from left to right, then top to bottom. (this is called a "sweep"). The parameter
although this seems not to work when
After random initialization, the system is set to a temperature of
Once averages of energy traces are obtained at 30 temperature points, the specific heat capacity can be approximated with a simple forward difference as
I have not searched for more efficient sampling algorithms in the literature, although many must certainly exist. I also have not investigated the quantitative differences between these results and those of [1] and more modern calculations such as [2], and would not trust my code until these are understood.
After cloning this repository, type pip install -e .
to set up the package in your Python environment.
Then you can run the sampling procedure with python -m xymontecarlo.xymc
. This will generate the above figure if allowed to run to completion.
(Probably you should run pip uninstall xymontecarlo
when you are done)
[1] Tobochnik, J.; Chester, G. V. Monte Carlo Study of the Planar Spin Model. Physical Review B 1979, 20 (9), 3761โ3769. https://doi.org/10.1103/physrevb.20.3761.
[2] Nguyen, P.H.; Boninsegni, M. Superfluid Transition and Specific Heat of the 2D x-y Model: Monte Carlo Simulation. Appl. Sci. 2021, 11, 4931. https://doi.org/10.3390/app11114931