Introduction
The Spin Sampler library is designed to study the thermodynamical properties of spin glasses. It provides tools to sample from the Boltzmann distribution of a spin system using Gibbs sampling. This document explains the physical details, sampling procedure, and the algorithm used.
Physical Details
We consider a system of \(N\) binary spins \(\boldsymbol{s} = (s_1, \cdots, s_N) \in \{-1, +1\}^N\) coupled with the Hamiltonian:
where the coupling matrix \(\boldsymbol{J} = (J_{ij})\) is typically random. The system is assumed to be in equilibrium with a thermal bath at temperature \(T = 1 / \beta\), and the equilibrium configurations \(\boldsymbol{s}\) follow the Boltzmann distribution.
To describe these systems, we rely on order parameters (e.g., \(q\)) that are averages over the Boltzmann measure, but in practice we aproximate them with a Monte Carlo estimate based on a number of samples \(N_S\).
Sampling Procedure
To sample from the Boltzmann distribution, we use Gibbs sampling. The algorithm updates spins one at a time using their conditional probability:
where the local field at site \(i\) is given by
Algorithm
The Gibbs sampling algorithm starts at \(t=0\) with the initial configuration \(\boldsymbol{s}^{(0)} \in \{-1, +1\}^N, \;\) and continues as:
The only important thing to notice about the algorithm is that the inner loop over \(N\) (refered in the library as gibbs_step) must be done sequentially because the value of spin \(i\) at time \(t\) depends on the values of all other spins \(j<i\) that were already updated in the same \(t\).
This is different from other sampling problems where the update \((t-1) \rightarrow(t)\) can be done in a single step and even if there are many variables involved one could use parallelization techniques to make the update efficient.