MC-04 Measurements
Beyond thermodynamic averages such as energy and magnetization, QMC simulations can measure spatial correlation functions and their Fourier transforms. This tutorial demonstrates these measurements using the directed-loop SSE code on the Heisenberg model on a small square lattice.
The spin-spin correlation function describes how spin orientations at two sites separated by are correlated. For the antiferromagnetic Heisenberg model at low temperature, correlations alternate in sign with distance, reflecting the tendency towards Néel order. The structure factor is the Fourier transform of the correlations; it peaks at the antiferromagnetic wavevector .
Two-dimensional Heisenberg square lattice
We simulate the Heisenberg model on a square lattice at temperature with a small field to weakly break the spin-rotation symmetry. The small system size allows a fast simulation; finite-size effects are significant at this scale.
Command line
The parameter file parm4 enables three additional measurement flags alongside the standard parameters:
MODEL="spin"
LATTICE="square lattice"
local_S=1/2
MEASURE[Correlations]=true
MEASURE[Structure Factor]=true
MEASURE[Green Function]=true
THERMALIZATION=10000
SWEEPS=500000
J=1
L=4
W=4
T=0.3
{h=0.1;}MEASURE[Correlations] records for all site pairs.
MEASURE[Structure Factor] records at all wavevectors compatible with the lattice.
MEASURE[Green Function] records the imaginary-time Green function, which can be analytically continued to obtain spectral information.
Convert and run:
parameter2xml parm4
dirloop_sse --Tmin 10 --write-xml parm4.in.xml--Tmin 10 sets the checkpoint interval to 10 seconds; --write-xml writes XML output files that pyalps can read alongside the HDF5 results.
Python
The script tutorial4.py:
import pyalps
parms = [{
'LATTICE' : "square lattice",
'MODEL' : "spin",
'MEASURE[Correlations]' : True,
'MEASURE[Structure Factor]' : True,
'MEASURE[Green Function]' : True,
'local_S' : 0.5,
'T' : 0.3,
'J' : 1,
'THERMALIZATION' : 10000,
'SWEEPS' : 500000,
'L' : 4,
'W' : 4,
'h' : 0.1
}]
input_file = pyalps.writeInputFiles('parm4', parms)
pyalps.runApplication('dirloop_sse', input_file, Tmin=10)Evaluating the results
Load all measurements from the output files and print them:
import pyalps
data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm4'))
for s in pyalps.flatten(data):
if len(s.x) == 1:
print(s.props['observable'], ':', s.y[0])
else:
for (x, y) in zip(s.x, s.y):
print(s.props['observable'], x, ':', y)Scalar observables (energy, magnetization, susceptibility) are printed on a single line. Vector observables (correlations, structure factor, Green function) are printed one entry per line, with their index — site pair, wavevector, or imaginary-time point — shown alongside the value.
Plotting the spin-spin correlations
To visualize the correlation function, load the Sz Correlations observable and plot it:
import pyalps
import matplotlib.pyplot as plt
import pyalps.plot
data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm4'), 'Sz Correlations')
correlations = pyalps.collectXY(data, x='d', y='Sz Correlations')
plt.figure()
pyalps.plot.plot(correlations)
plt.xlabel('Distance $r$')
plt.ylabel('$\\langle S^z_0 S^z_r \\rangle$')
plt.title('Spin correlations, $4\\times 4$ Heisenberg model')
plt.show()The correlations should alternate in sign with distance, with the nearest-neighbour value negative (antiferromagnetic) and its magnitude decreasing with .
Plotting the structure factor
import pyalps
import matplotlib.pyplot as plt
import pyalps.plot
data = pyalps.loadMeasurements(pyalps.getResultFiles(prefix='parm4'), 'Sz Structure Factor')
structure_factor = pyalps.collectXY(data, x='q', y='Sz Structure Factor')
plt.figure()
pyalps.plot.plot(structure_factor)
plt.xlabel('Wavevector $q$')
plt.ylabel('$S^z(q)$')
plt.title('Structure factor, $4\\times 4$ Heisenberg model')
plt.show()The largest value should appear at the antiferromagnetic wavevector , corresponding to the alternating spin pattern of Néel order.
Questions
- At which wavevector is the structure factor largest? What pattern of spin correlations does this correspond to?
- How do the correlations decay with distance ? Do they remain significant across the whole lattice?
- Repeat the simulation at a lower temperature, e.g. . How do the correlations and structure factor change?
- Increase the system size to . How does the peak of the structure factor scale with ? What does this tell you about the presence or absence of long-range order at finite temperature?
- What is the physical meaning of the Green function ? How could it be used to obtain dynamical information about the system?