The J-current model is a classical statistical model of conserved currents on a lattice. It was first suggested to study quantum-phase transitions in bosonic systems by mapping corresponding problems in

dimensions to the classical problem in

dimensions. The recently developed worm algorithm (WA) proved to be a superb tool in calculations for systems with a configuration space of closed loops, since it eliminated a critical slowdown of Monte Carlo convergence around critical points [1].

The main idea in WA is to introduce the configuration space of closed paths to collect statistics of the model. The efficiency of sampling is increased tremendously for such classical statistical models as the 2D and 3D Ising models, 2D and 3D XY models, and the Gaussian model.

This Demonstration provides a step-by-step worm algorithm implementation for a classical J-current model with a Hamiltonian of the form

,

where

stands for a current of site

in the direction

(either

or

),

is an interaction parameter, and

is a chemical potential. The variables

and

are the horizontal and vertical directions, respectively. We consider a 10×10 lattice, subject to periodic boundary conditions.

1. The usual scheme of the algorithm consists of choosing the initial current configuration and then performing a cycle of the usual Metropolis updates. In this Demonstration the initial configuration is

on all bonds.

2. Closed current loops are created by starting a "worm" in the system, usually one at a time. A worm consists of a path of currents, which "wanders" around the lattice during the updates. Initially you need to choose where to place your very first worm, and once you do that you position its "head" and "tail" there (zero size worm).

3. Next you "grow" the worm head by suggesting a site around it and deciding if it should go there or not (using the Metropolis algorithm). The worm is "willing" to grow by shifting the worm head to the suggesting site thus creating a current on a bond. Such an update is called a "shift" and is one of two possible updates during WA. The described shift "draws" a new current on a bond. As you perform many of these updates and create multiple currents on bonds, it becomes possible that the worm head will try to move toward a current that already exists thus "erasing" it.

4. After wandering for a while around the lattice, the head will meet the tail and you get a closed path of currents. Such a configuration is physical and you collect the statistics for the partition function and observables at this point (however the correlator is collected at each step [1, 2]).

5. Once your worm is closed you can perform a second type of update called a "move": you can randomly choose another site for a worm to start and put the worm head and tail there.

6. After that, perform the procedure (steps 3–5) again.

In this Demonstration the amount of current on each bond has a maximum of 1.

Essentially WA is a draw-and-erase procedure, very similar to just drawing the loops on paper and using an eraser from time to time. It is quite efficient in sampling the system configurations and is stable enough to maintain the ergodicity of the process.

Due to periodic boundary conditions the loops can "wind" around the system, and the winding number in, for example, the

direction is defined as the total current in this direction normalized by the system's size. The winding numbers are collected only for closed-loop configurations, so they are integers and allow one to calculate, for example, the compressibility of the system.

The lattice graph displays the bond current configuration for each step of WA and plots the graph of average current in the

direction. Such a simulation is mainly of educational value, since the number of updates is rather limited (400) and there is no chance to collect real statistics. The plot shows how the total current in the

direction progresses with updates. The adjustable parameters include the interaction parameter

and chemical potential

. You can see that for higher

it is easier for a system to create winding loops in both directions. Chemical potential is applied in the

direction, so increasing

will facilitate vertical windings.