We present a Markov-chain Monte Carlo algorithm of "worm"type that correctly
simulates the O(n) loop model on any (finite and connected) bipartite cubic
graph, for any real n>0, and any edge weight, including the fully-packed limit
of infinite edge weight. Furthermore, we prove rigorously that the algorithm is
ergodic and has the correct stationary distribution. We emphasize that by using
known exact mappings when n=2, this algorithm can be used to simulate a number
of zero-temperature Potts antiferromagnets for which the Wang-Swendsen-Kotecky
cluster algorithm is non-ergodic, including the 3-state model on the
kagome-lattice and the 4-state model on the triangular-lattice. We then use
this worm algorithm to perform a systematic study of the honeycomb-lattice loop
model as a function of n<2, on the critical line and in the densely-packed and
fully-packed phases. By comparing our numerical results with Coulomb gas
theory, we identify the exact scaling exponents governing some fundamental
geometric and dynamic observables. In particular, we show that for all n<2, the
scaling of a certain return time in the worm dynamics is governed by the
magnetic dimension of the loop model, thus providing a concrete dynamical
interpretation of this exponent. The case n>2 is also considered, and we
confirm the existence of a phase transition in the 3-state Potts universality
class that was recently observed via numerical transfer matrix calculations.Comment: 33 pages, 12 figure