SciPost Phys. Codebases 1 (2022)

The ALF (Algorithms for Lattice Fermions)project release 2.0
Documentation for the auxiliary-field quantum Monte Carlo code
The ALF Collaboration? :Fakher F. Assaad , Martin Bercx1 , Florian Goth1 , Anika Götz1 ,Johannes S. Hofmann2 , Emilie Huffman3 , Zihong Liu1 ,Francesco Parisen Toldin1 , Jefferson Stafusa E. Portela1 , Jonas Schwab1
1,4

1 Institut für Theoretische Physik und Astrophysik, Universität Würzburg,
97074 Würzburg, Germany
2 Department of Condensed Matter Physics, Weizmann Institute of Science,
Rehovot, 76100, Israel
3 Perimeter Institute for Theoretical Physics,
Waterloo, Ontario N2L 2Y5, Canada
4 Würzburg-Dresden Cluster of Excellence ct.qmat,
Am Hubland, 97074 Würzburg, Germany? alf@physik.uni-wuerzburg.de

Abstract
The Algorithms for Lattice Fermions package provides a general code for the finitetemperature and projective auxiliary-field quantum Monte Carlo algorithm. The codeis engineered to be able to simulate any model that can be written in terms of sumsof single-body operators, of squares of single-body operators and single-body operators
coupled to a bosonic field with given dynamics. The package includes five predefinedmodel classes: SU(N) Kondo, SU(N) Hubbard, SU(N) t-V and SU(N) models with longrange Coulomb repulsion on honeycomb, square and N-leg lattices, as well as Z2 unconstrained lattice gauge theories coupled to fermionic and Z2 matter. An implementation of the stochastic Maximum Entropy method is also provided. One can download
the code from our Git instance at https://git.physik.uni-wuerzburg.de/ALF/ALF/-/
tree/ALF-2.0 and sign in to file issues.
Copyright F. F. Assaad et al.
This work is licensed under the Creative Commons
Attribution-ShareAlike 4.0 International License.
Published by the SciPost Foundation.

Received 21-01-2021
Accepted 22-10-2021
Check forupdatesPublished 22-08-2022
doi:10.21468/SciPostPhysCodeb.1

This publication is part of a bundle: Please cite both the article and the release you used.
DOI
doi:10.21468/SciPostPhysCodeb.1
doi:10.21468/SciPostPhysCodeb.1-r2.0

Type
ArticleCodebase release1

SciPost Phys. Codebases 1 (2022)

Contents
1 Introduction
1.1 Motivation
1.2 Definition of the Hamiltonian
1.3 Outline and What is new

4
4
6
7

2 Auxiliary-Field Quantum Monte Carlo: finite temperature
2.1 Formulation of the method
2.1.1 The partition function
2.1.2 Observables
2.1.3 Reweighting and the sign problem
2.2 Updating schemes
2.2.1 Sequential single spin flips
2.2.2 Sampling of e−S02.2.3 Global updates in space
2.2.4 Global updates in time and space
2.2.5 Parallel tempering
2.2.6 Langevin dynamics
2.3 The Trotter error and checkerboard decomposition
2.3.1 Asymmetric Trotter decomposition
2.3.2 Symmetric Trotter decomposition
2.3.3 The Symm flag
2.4 Stabilization - a peculiarity of the BSS algorithm

8
8
10
11
12
13
13
14
15
15
16
17
21
21
23
24
25

3 Auxiliary-Field Quantum Monte Carlo: projective algorithm
3.1 Specification of the trial wave function
3.2 Some technical aspects of the projective code
3.3 Comparison of finite and projective codes

27
27
28
29

4 Monte Carlo sampling
4.1 The Jackknife resampling method
4.2 An explicit example of error estimation
4.3 Pseudocode description

30
31
31
33

5 Data Structures and Input/Output
5.1 The Operator type
5.2 Handling of the fields: the Fields type
5.3 The Lattice and Unit_cell types
5.4 The observable types Obser_Vec and Obser_Latt
5.4.1 Scalar observables
5.4.2 Equal-time and time-displaced correlation functions
5.5 The WaveFunction type
5.6 Specification of the Hamiltonian: the Hamiltonian module
5.7 File structure
5.7.1 Input files
5.7.2 Output files – observables

35
35
36
36
39
39
40
41
42
44
44
47

6 Using the Code
6.1 Zeroth step
6.2 Compiling and running

48
48
49

2

SciPost Phys. Codebases 1 (2022)

6.3
6.4

Error analysis
Parameter optimization

51
53

7 The plain vanilla Hubbard model on the square lattice
7.1 Setting the Hamiltonian: Ham_set
7.2 The lattice: Ham_latt
7.3 The hopping: Ham_hop
7.4 The interaction: Ham_V
7.5 The trial wave function: Ham_Trial
7.6 Observables
7.6.1 Allocating space for the observables: Alloc_obs
7.6.2 Measuring equal-time observables: Obser
7.6.3 Measuring time-displaced observables: ObserT
7.7 Numerical precision
7.8 Running the code and testing

54
55
55
56
56
57
57
58
59
60
60
60

8 Predefined Structures
8.1 Predefined lattices
8.1.1 Square lattice, Fig. 5(a)8.1.2 Bilayer Square lattice, Fig. 5(b)8.1.3 N-leg Ladder lattice, Fig. 5(c)8.1.4 Honeycomb lattice, Fig. 5(d)8.1.5 Bilayer Honeycomb lattice, Fig. 5(e)8.1.6 π-Flux lattice (deprecated)
8.2 Generic hopping matrices on Bravais lattices
8.2.1 Setting up the hopping matrix: the Hopping_Matrix_type
8.2.2 An example: nearest neighbor hopping on the honeycomb lattice
8.2.3 Predefined hoppings
8.3 Predefined interaction vertices
8.3.1 SU(N) Hubbard interaction
8.3.2 Mz -Hubbard interaction
8.3.3 SU(N) V -interaction
8.3.4 Fermion-Ising coupling
8.3.5 Long-Range Coulomb repulsion
8.3.6 Jz -Jz interaction
8.4 Predefined observables
8.4.1 Equal-time SU(N) spin-spin correlations
8.4.2 Equal-time spin correlations
8.4.3 Equal-time Green function
8.4.4 Equal-time density-density correlations
8.4.5 Time-displaced Green function
8.4.6 Time-displaced SU(N) spin-spin correlations
8.4.7 Time-displaced spin correlations
8.4.8 Time-displaced density-density correlations
8.4.9 Dimer-Dimer correlations
8.4.10 Cotunneling for Kondo models
8.4.11 Rényi Entropy
8.5 Predefined trial wave functions
8.5.1 Square
8.5.2 Honeycomb
8.5.3 N-leg ladder

61
61
62
62
63
64
64
64
64
65
68
69
70
71
71
72
72
72
73
73
74
75
76
76
76
76
77
77
77
78
79
80
80
80
80

3

SciPost Phys. Codebases 1 (2022)

8.5.4
8.5.5

Bilayer square
Bilayer honeycomb

81
81

9 Model Classes
9.1 SU(N) Hubbard models Hamiltonian_Hubbard_mod.F90
9.2 SU(N) t-V models tV_mod.F90
9.3 SU(N) Kondo lattice models Kondo_mod.F90
9.4 Models with long range Coulomb interactions LRC_mod.F90
9.5 Z2 lattice gauge theories coupled to fermion and Z2 matter Z2_mod.F90
9.5.1 Projective approach
9.5.2 Observables
9.5.3 A test case: Z2 slave spin formulation of the SU(2) Hubbard model

81
81
83
84
86
88
91
91
92

10 Maximum Entropy
10.1 General setup
10.2 Single-particle quantities: Channel=P
10.3 Particle-hole quantities: Channel=PH
10.4 Particle-Particle quantities: Channel=PP
10.5 Zero-temperature, projective code: Channel=T0
10.6 Dynamics of the one-dimensional half-filled Hubbard model

93
93
95
95
96
97
97

11 Conclusions and Future Directions

97

A Practical implementation of Wick decomposition of 2n-point correlation functions of two imaginary times

98

B Performance, memory requirements and parallelization

99

C Licenses and Copyrights

101

References

102

1

Introduction

1.1

Motivation

The aim of the ALF project is to provide a general formulation of the auxiliary-field QMC
method that enables one to promptly play with different model Hamiltonians at minimal programming cost. The package also comes with a number of predefined Hamiltonians aimed at
producing benchmark results.
The auxiliary-field quantum Monte Carlo (QMC) approach is the algorithm of choice tosimulate thermodynamic properties of a variety of correlated electron systems in the solid stateand beyond [1–6]. Apart from the physics of the canonical Hubbard model [7,8], the topics one
can investigate in detail include correlation effects in the bulk and on surfaces of topologicalinsulators [9–12], quantum phase transitions between Dirac fermions and insulators [13–20],
deconfined quantum critical points [18, 21–24], constrained and unconstrained lattice gauge
theories [21, 25–30], heavy fermion systems [31–36], nematic [37, 38] and magnetic [39, 40]
quantum phase transitions in metals, antiferromagnetism in metals [41], superconductivity
4

SciPost Phys. Codebases 1 (2022)

in spin-orbit split and in topological flat bands [42–44], SU(N) symmetric models [45–50],
long-ranged Coulomb interactions in graphene systems [51–55], cold atomic gases [56], lowenergy nuclear physics [57] that may require formulations in the canonical ensemble [58,59],
entanglement entropies and spectra [60–66], electron-phonon systems [67–72], Landau level
regularization of continuum theories [73,74], Yukawa SYK models [75] and even spin systems[76,77] among others. This ever-growing list of topics is based on algorithmic progress and on
recent symmetry-related insights [78–81] that lead to formulations free of the negative sign
problem for a number of model systems with very rich phase diagrams.
Auxiliary-field methods can be formulated in a number of very different ways. The fields
define the configuration space C . They can stem from the Hubbard-Stratonovich (HS) [82]transformation required to decouple the many-body interacting term into a sum of non-interacting problems, or they can correspond to bosonic modes with predefined dynamics such as
phonons or gauge fields. In all cases, the result is that the grand-canonical partition function
takes the form
 X
Z = Tr e−β Ĥ =e−S(C ) ,(1)
C

where β corresponds to the inverse temperature and S is the action of non-interacting fermionssubject to a space-time fluctuating auxiliary field. The high-dimensional integration over thefields is carried out stochastically. In this formulation of many-body quantum systems, there is
no reason for the action to be a real number. Thereby e−S(C ) cannot be interpreted as a weight.
To circumvent this problem one can adopt re-weighting schemes and sample |e−S(C ) |. Thisinvariably leads to the so-called negative sign problem, with the associated exponential computational scaling in system size and inverse temperature [83]. The sign problem is formulation
dependent and, as mentioned above, there has been tremendous progress at identifying an
increasing number of models not affected by the negative sign problem which cover a rich domain of collective emergent phenomena. For continuous fields, the stochastic integrations canbe carried out with Langevin dynamics or hybrid methods [84]. However, for many problems
one can get away with discrete fields [85]. In this case, Monte Carlo importance sampling
will often be put to use [86]. We note that due to the non-locality of the fermion determinant(see below), cluster updates, such as in the loop or stochastic series expansion algorithms forquantum spin systems [87–89], are hard to formulate for this class of problems. The searchfor efficient updating schemes that quickly wander through the configuration space defines
ongoing challenges.
Formulations differ not only in the choice of the fields, continuous or discrete, and sampling strategy, but also by the formulation of the action itself. For a given field configuration,
integrating out fermionic degrees of freedom generically leads to a fermionic determinant ofdimension β N where N is the volume of the system. Working with this determinant leads tothe Hirsch-Fye approach [90] and the computational effort scales1 as O (β N )3 . The Hirsch-Fyealgorithm is the method of choice for impurity problems, but has in general been outperformed
by a class of so-called continuous-time quantum Monte Carlo approaches [91–93]. One key
advantage of continuous-time methods is being action based, allowing one to better handle
the retarded interactions obtained when integrating out fermion or boson baths. However,in high dimensions or at low temperatures, the cubic scaling originating from the fermionicdeterminant is expensive. To circumvent this, the hybrid Monte-Carlo approach [5, 94, 95] expresses the fermionic determinant in terms of a Gaussian integral thereby introducing a newvariable in the Monte Carlo integration. The resulting algorithm is the method of choice forlattice gauge theories in 3+1 dimensions and has been used to provide ab initio estimates oflight hadron masses starting from quantum chromodynamics [96].
1Here we implicitly assume the absence of negative sign problem.

5

SciPost Phys. Codebases 1 (2022)

The approach we adopt lies between the above two extremes. We keep the fermionic determinant, but formulate the problem so as to work only with N ×N matrices. This Blankenbecler,
Scalapino, Sugar (BSS) algorithm scales linearly in imaginary time β, but remains cubic in thevolume N . Furthermore, the algorithm can be formulated either in a projective manner [3,4],
adequate to obtain zero temperature properties in the canonical ensemble, or at finite temperatures, in the grand-canonical ensemble [2]. In this documentation we summarize theessential aspects of the auxiliary-field QMC approach, and refer the reader to Refs. [6, 97] forcomplete reviews.

1.2

Definition of the Hamiltonian

The first and most fundamental part of the project is to define a general Hamiltonian which
can accommodate a large class of models. Our approach is to express the model as a sum of
one-body terms, a sum of two-body terms each written as a perfect square of a one body term,
as well as a one-body term coupled to a bosonic field with dynamics to be specified by theuser. Writing the interaction in terms of sums of perfect squares allows us to use generic formsof discrete approximations to the HS transformation [98, 99]. Symmetry considerations areimperative to increase the speed of the code. We therefore include a color index reflecting an
underlying SU(N) color symmetry as well as a flavor index reflecting the fact that after the HStransformation, the fermionic determinant is block diagonal in this index.
The class of solvable models includes Hamiltonians Ĥ that have the following generalform:

Ĥ = Ĥ T + ĤV + Ĥ I + Ĥ0,I , whereĤ T =ĤV =Ĥ I =

Ncol X
MT X
Nfl N
dim
X
X
k=1 σ=1 s=1 x, y
MV
X
k=1
MI
X
k=1

Uk

ĉ †xσs Tx(ks)y ĉ yσs ≡ẐkN N N
col X
dim
fl X
X
σ=1 s=1 x, yT̂ (k) ,(3)

k=1¨ N N N
col X
dim
fl
X
X
σ=1 s=1(2)
MTXĉ †xσs Vx(ks)y ĉ yσs

«2


+ αks

≡

x, y

MV
X

Uk V̂ (k)

2

,

(4)

k=1

ĉ †xσs I x(ks)y ĉ yσs


≡

MI
X

Ẑk Î (k) .

(5)

k=1

The indices and symbols used above have the following meaning:• The number of fermion flavors is set by Nfl . After the HS transformation, the action willbe block diagonal in the flavor index.
• The number of fermion colors is set2 by Ncol . The Hamiltonian is invariant under SU(Ncol )rotations.
• Ndim is the total number of spacial vertices: Ndim = Nunit-cell Norbital , where Nunit-cell is thenumber of unit cells of the underlying Bravais lattice and Norbital is the number of orbitals
per unit cell.
• The indices x and y label lattice sites where x, y = 1, · · · , Ndim .
• Therefore, the matrices T (ks) , V (ks) and I (ks) are of dimension Ndim × Ndim .
• The number of interaction terms is labeled by MV and M I . M T > 1 would allow for acheckerboard decomposition.
2

Note that in the code Ncol ≡ N_SUN.

6

SciPost Phys. Codebases 1 (2022)• ĉ †yσs is a second-quantized operator that creates an electron in a Wannier state centeredaround lattice site y, with color σ, and flavor index s. The operators satisfy the anticommutation relations:¦©
¦©
ĉ †yσs , ĉ y 0 σ0 s0 = δ x x 0 δss0 δσσ0 , and ĉ yσs , ĉ y 0 σ0 s0 = 0 .
(6)• αks is a complex number.
The bosonic part of the general Hamiltonian (2) is Ĥ0,I + Ĥ I and has the following properties:• Ẑk couples to a general one-body term. We will work in a basis where this operator
is diagonal: Ẑk |φ〉 = φk |φ〉. φk is a real number or an Ising variable. Hence Ẑk cancorrespond to the Pauli matrix σ̂z or to the position operator.
• The dynamics of the bosonic field is given by Ĥ0,I . This term is not specified here; it
has to be specified by the user and becomes relevant when the Monte Carlo updateprobability is computed in the code.
Note that the matrices T (ks) , V (ks) and I (ks) explicitly depend on the flavor index s but not on
the color index σ. The color index σ only appears in the second quantized operators such thatthe Hamiltonian is manifestly SU(Ncol ) symmetric. We also require the matrices T (ks) , V (ks)and I (ks) to be Hermitian.
It is the comprehensive definition of its Hamiltonian what renders the ALF package unique,by allowing the simulation of a large class of model Hamiltonians (see Sec. 9 for a selection).
The other existing open-source implementation of the auxiliary-field QMC approach, QUEST[100], concentrates on Hubbard models.

1.3

Outline and What is new

In order to use the program, a minimal understanding of the algorithm is necessary. Its code iswritten in Fortran, according to the 2003 standard, and natively uses MPI, for parallel runs onsupercomputing systems. In this documentation we aim to present in enough detail both thealgorithm and its implementation to allow the user to confidently use and modify the program.
In Sec. 2, we summarize the steps required to formulate the many-body, imaginary-time
propagation in terms of a sum over HS and bosonic fields of one-body, imaginary-time propagators. To simulate a model not already included in ALF, the user has to provide this one-body,
imaginary-time propagator for a given configuration of HS and bosonic fields. In this section
we also touch on how to compute observables and on how we deal with the negative sign problem. ALF 2.0 has a number of new updating schemes. The package comes with the possibility
to implement global updates in space and time or only in space. We provide parallel-temperingand Langevin dynamics options. Another important addition in ALF 2.0 is the possibility to
implement symmetric Trotter decompositions. At the end of the section we comment on theissue of stabilization for the finite temperature code.
In Sec. 3, we describe the projective version of the algorithm, constructed to produce
ground state properties. This is a new feature of ALF 2.0, and one can very easily switch
between projective and finite temperature codes.
One of the key challenges in Monte Carlo methods is to adequately evaluate the stochastic
error. In Sec. 4 we provide an explicit example of how to correctly estimate the error.
Section 5 is devoted to the data structures that are needed to implement the model, as
well as to the input and output file structure. The data structures include an Operator typeto optimally work with sparse Hermitian matrices, a Lattice type to define one- and twodimensional Bravais lattices, a generic Fields type for the auxiliary fields, two Observable
7

SciPost Phys. Codebases 1 (2022)

types to handle scalar observables (e.g., total energy) and equal-time or time-displaced twopoint correlation functions (e.g., spin-spin correlations) and finally a Wavefunction type todefine the trial wave function in the projective code. At the end of this section we commenton the file structure.
In Sec. 6 we provide details on running the code using the shell. As an alternative the user
can download a separate project, pyALF that provides a convenient python interface as wellas Jupyter notebooks.
In ALF 2.0 we have defined a set of predefined structures that allow easy reuse of lattices,
observables, interactions and trial wave functions. Although convenient, this extra layer of
abstraction might render ALF 2.0 harder to modify. To circumvent this we make available an
implementation of a plain vanilla Hubbard model on the square lattice (see Sec. 7) that shows
explicitly how to implement this basic model without making use of predefined structures. We
believe that this is a good starting point to modify a Hamiltonian from scratch, as exemplified
in the package’s Tutorial.
Sec. 8 introduces the sets of predefined lattices, hopping matrices, interactions, observables
and trial wave functions available. The goal here is to provide a library so as to facilitate
implementation of new Hamiltonians.
ALF 2.0 comes with a set of Hamiltonians, described in Sec. 9, which includes: (i) SU(N)
Hubbard models, (ii) SU(N) t-V models, (iii) SU(N) Kondo lattice models, (iv) Models withlong range Coulomb interactions, and (v) Generic Z2 lattice gauge theories coupled to Z2
matter and fermions. These model classes are built on the predefined structures.
In Sec. 10 we describe how to use our implementation of the stochastic analytical continuation [101, 102].
Finally, in Sec. 11 we list a number of features being considered for future releases of the
ALF package.

2

Auxiliary-Field Quantum Monte Carlo: finite temperature

We start this section by deriving the detailed form of the partition function and outlining
the computation of observables (Sec. 2.1.1 - 2.1.3). Next, we present a number of updatestrategies, namely local updates, global updates, parallel tempering and Langevin dynamics(Sec. 2.2). We then discuss the Trotter error, both for symmetric and asymmetric decompositions (Sec. 2.3) and, finally, we describe the measures we have implemented to make the code
numerically stable (Sec. 2.4).

2.1

Formulation of the method

Our aim is to compute observables for the general Hamiltonian (2) in thermodynamic equilibrium as described by the grand-canonical ensemble. We show below how the grand-canonicalpartition function can be rewritten as X
Z = Tr e−β Ĥ =e−S(C) + O(∆τ2 ) ,(7)
Cand define the space of configurations C. Note that the chemical potential term is alreadyincluded in the definition of the one-body term Ĥ T , see Eq. (3), of the general Hamiltonian.
The essential ingredients of the auxiliary-field quantum Monte Carlo implementation in the
ALF package are the following:• We discretize the imaginary time propagation: β = ∆τLTrotter . Generically this introduces a systematic Trotter error of O(∆τ)2 [103]. We note that there has been considerable effort at getting rid of the Trotter systematic error and to formulate a genuine
8

SciPost Phys. Codebases 1 (2022)

continuous-time BSS algorithm [104]. To date, efforts in this direction that are basedon a CT-AUX type formulation [105, 106] face two issues. The first one is that they are
restricted to a class of models with Hubbard-type interactions(n̂i − 1)2 = (n̂i − 1)4 ,(8)in order for the basic CT-AUX equation [107],
1+U
1 X αs(n̂i −1)U(n̂i − 1)2 =e
with= cosh(α) − 1 and K ∈ R ,K
2 s=±1K(9)

to hold. The second issue is that it is hard to formulate a computationally efficientalgorithm. Given this situation, if eliminating the Trotter systematic error is required, itturns out that extrapolating to small imaginary-time steps using the multi-grid method[108–110] is a more efficient scheme.
There has also been progress in efficient continuous-time methods using techniques thatdraw from the Stochastic Series Expansion [111] which can be combined with fermion
bag ideas [112]. However, these techniques are even more restricted to a specific class ofHamiltonians,that can be expressed as sums of exponentiated fermionic bilinear
P those(i)terms Ĥ = i ĥ , whereĥ(i) = −γ(i) e

P

(i) †
jk α jk ĉ j ĉk +H.c.

.

(10)

Stabilization can also be costly depending on the parameters, particularly for large α
values [113].
• Having isolated the two-body term, we apply Gauß-Hermite quadrature3 [114] to thecontinuous HS transform and obtain the discrete HS transformation [98, 99]:2e∆τλÂ =p
1 X
γ(l)e ∆τλη(l)Â + O (∆τλ)4 ,4 l=±1,±2(11)where the fields η and γ take the values:
γ(±1) = 1 +

p

6/3,

γ(±2) = 1 −

p

6/3,

r 
p 
2 3− 6 ,r p 
η(±2) = ± 2 3 + 6 .
η(±1) = ±(12)

Since the Trotter error is already of order (∆τ2 ) per time slice, this transformation isnext to exact. One can relate the expectation value of the field η(l) to the operator Â bynoting that:


p

η(l)
2
1 X
∆τλη(l)Â
γ(l)e= e∆τλÂ Â + O (∆τλ)3 andp
4 l=±1,±2−2 ∆τλ


2
p

2
1 X
∆τλη(l)Â (η(l)) − 2γ(l)e= e∆τλÂ Â2 + O (∆τλ)2 .
(13)
4 l=±1,±24∆τλ• Ẑk in Eq. (5) can stand for a variety of operators, such as the Pauli matrix σ̂z – inwhich case the Ising spins take the values sk = ±1 – or the position operator – suchthat Ẑk |φ〉 = φk |φ〉, with φk a real number.
3

We would like to thank Kazuhiro Seki for discussions on this subject.

9

SciPost Phys. Codebases 1 (2022)• From the above it follows that the Monte Carlo configuration space C is given by the
combined spaces of bosonic configurations and of HS discrete field configurations:C = φi,τ , l j,τ with i = 1 · · · M I , j = 1 · · · MV , τ = 1 · · · LTrotter .
(14)Here, the HS fields take the values l j,τ = ±2, ±1 and φi,τ may, for instance, be a continuous real field or, if Ẑk = σ̂z , be restricted to ±1.
2.1.1

The partition function

With the above, the partition function of the model (2) can be written as follows.

Z = Tr e−β Ĥ LTrotter
MV
MI
MT
Y
Y
2 Y
−∆τĤ0,I−∆τUk (V̂ (k) )−∆τσ̂k Î (k)−∆τ T̂ (k)= Tr eeee+ O(∆τ2 )
k=1

=

M L
Trotter
V Y
X Y

k=1

k=1



γk,τ e−S0 ({si,τ }) ×

k=1 τ=1

C

«
¨L
M
MT
MI
Trotter Y
VYYYp−∆τ T̂ (k)−∆τsk,τ Î (k)−∆τUk ηk,τ V̂ (k)+ O(∆τ2 ) .
e
e
TrF
e
τ=1

k=1

k=1

k=1

(15)

In the above, the trace Tr runs over the bosonic and fermionic degrees of freedom, and TrF
only over the fermionic Fock space. S0 si,τ is the action corresponding to the bosonic
Hamiltonian, and is only dependent on the bosonic fields so that it can be pulled out of thefermionic trace. We have adopted the shorthand notation ηk,τ ≡ η(l k,τ ) and γk,τ ≡ γ(l k,τ ). At
this point, and since for a given configuration C we are dealing with a free propagation, we
can integrate out the fermions to obtain a determinant:
«
¨L
M
MT
MI
Trotter Y
VYYYp−∆τ T̂ (k)−∆τsk,τ Î (k)−∆τUk ηk,τ V̂ (k)
e
=
TrF
e
e
τ=1

k=1
Nfl
Y

k=1

k=1



M
PV LTrotter
P

Ncol

p

−∆τUk αk,s ηk,τ

e k=1 τ=1



×

s=1

(16)

Nfl 
Y



det 1 +LY
MV
Trotter Y

ep−∆τUk ηk,τ V (ks)

τ=1 k=1s=1MIYe−∆τsk,τ I

k=1

(ks)

MT
Y

e−∆τT

(ks)

Ncol,k=1

where the matrices T (ks) , V (ks) , and I (ks) define the Hamiltonian [Eq. (2) - (5)]. All in all, thepartition function is given by:
Nfl MV LTrotter p
M L


P
P P
Nfl 
Trotter
V Y
X
Y
Y
Ncol
−∆τUk αk,s ηk,τZ=
e−S0 ({si,τ })γ
e s=1 k=1 τ=1
×
det 1
k,τ

k=1 τ=1

C

+

LY
MV
Trotter Y

ep

τ=1 k=1

≡

X
C

e

−S(C)

−∆τUk ηk,τ V

s=1
(ks)

MI
Y
k=1

2

+ O(∆τ ) .

e−∆τsk,τ I

(ks)

MT
Y
k=1

e−∆τT

(ks)

Ncol+ O(∆τ2 )(17)

In the above, one notices that the weight factorizes in the flavor index. The color index raises
the determinant to the power Ncol . This corresponds to an explicit SU(Ncol ) symmetry for eachconfiguration. This symmetry is manifest in the fact that the single-particle Green functions
are color independent, again for each given configuration C.
10

SciPost Phys. Codebases 1 (2022)

2.1.2

Observables

In the auxiliary-field QMC approach, the single-particle Green function plays a crucial role.
It determines the Monte Carlo dynamics and is used to compute observables. Consider theobservable:X
Tr e−β Ĥ Ô
e−S(C)
 =〈Ô〉 =
P(C)〈〈Ô〉〉(C) , where P(C) = P
(18)
−S(C)
Tr e−β Ĥ
CeC
and 〈〈Ô〉〉(C) denotes the observed value of Ô for a given configuration C. For a given configuration C one can use Wick’s theorem to compute O(C) from the knowledge of the single-particle
Green function:
G(x, σ, s, τ|x 0 , σ0 , s0 , τ0 ) = 〈〈T ĉ xσs (τ)ĉ †x 0 σ0 s0 (τ0 )〉〉C ,(19)

where T denotes the imaginary-time ordering operator. The corresponding equal-time quantity reads
G(x, σ, s, τ|x 0 , σ0 , s0 , τ) = 〈〈ĉ xσs (τ)ĉ †x 0 σ0 s0 (τ)〉〉C .
(20)
Since, for a given HS field, translation invariance in imaginary-time is broken, the Green function has an explicit τ and τ0 dependence. On the other hand it is diagonal in the flavor index,
and independent of the color index. The latter reflects the explicit SU(N) color symmetry
present at the level of individual HS configurations. As an example, one can show that theequal-time Green function at τ = 0 reads [6]:G(x, σ, s, 0|x 0 , σ, s, 0) = 1 +LY
Trotter
τ=1

withBτ(s) =

Bτ(s)

−1
,

(21)

x,x 0

MV p
MI
MT
Y
Y
Y
(ks)
(ks)
(ks)
e −∆τUk ηk,τ Ve−∆τsk,τ Ie−∆τT .
k=1

k=1

(22)

k=1

To compute equal-time, as well as time-displaced observables, one can make use of Wick’s
theorem. A convenient formulation of this theorem for QMC simulations reads:〈〈T ĉ †x (τ1 )ĉ x 0 (τ01 ) · · · ĉ †x (τn )ĉ x 0 (τ0n )〉〉C =
1
n
n
1

†
0
〈〈T ĉ x (τ1 )ĉ x 0 (τ1 )〉〉C 〈〈T ĉ †x (τ1 )ĉ x 0 (τ02 )〉〉C
1
1
1
2

0
0
†
†
〈〈T ĉ x 2 (τ2 )ĉ x 0 (τ1 )〉〉C 〈〈T ĉ x 2 (τ2 )ĉ x 0 (τ2 )〉〉C
1
2

det 
..
..

.
.
〈〈T ĉ †x (τn )ĉ x 0 (τ01 )〉〉C 〈〈T ĉ †x (τn )ĉ x 0 (τ02 )〉〉C
n

1

n

...
...
..

.
...

2

〈〈T ĉ †x (τ1 )ĉ x 0 (τ0n )〉〉C
1



n


〈〈T ĉ †x (τ2 )ĉ x 0 (τ0n )〉〉C 2n . (23)
..


.
†
0
〈〈T ĉ x (τn )ĉ x 0 (τn )〉〉CnnHere, we have defined the super-index x = {x, σ, s}.
Wick’s theorem can be also used to express a reduced density matrix, i.e., the density
matrix for a subsystem, in terms of its correlations [115]. Within the framework of auxiliaryfield QMC, this allows to express a reduced density matrix ρ̂A for a subsystem A as [60]
ρ̂A =

X

P(C)det(1 − GA(τ0 ; C))e−c †x H(A)cx,x 0 x 0,

H (A) ≡ ln

¦(GA(τ0 ; C)) T

−1

©
−1 ,

(24)

C

where GA(τ0 ; C) is the equal-time Green’s function matrix restricted on the subsystem A andat a given time-slice τ0 . In Eq. (24) an implicit summation over repeated indexes x, x 0 ∈ A is
11

SciPost Phys. Codebases 1 (2022)

assumed. Interestingly, Eq. (24) holds also when A is the entire system: in this case, it provides an alternative expression for the density matrix, or the (normalized) partition function,
as a superposition of Gaussian operators. Eq. (24) is the starting point for computing the entanglement Hamiltonian [64] and the Rényi entropies [60, 62, 63]. A short review on various
computational approaches to quantum entanglement in interacting fermionic models can befound in Ref. [66]. ALF provides predefined observables to compute the second Rényi entropy
and its associated mutual information, see Sec. 8.4.11.
In Sec. 8.4 we describe the equal-time and time-displaced correlation functions that comepredefined in ALF. Using the above formulation of Wick’s theorem, arbitrary correlation functions can be computed (see Appendix A). We note, however, that the program is limited to thecalculation of observables that contain only two different imaginary times.
2.1.3

Reweighting and the sign problem

In general, the action S(C) will be complex, thereby inhibiting a direct Monte Carlo samplingof P(C). This leads to the infamous sign problem. The sign problem is formulation dependentand as noted above, much progress has been made at understanding the class of models thatcan be formulated without encountering this problem [78–81]. When the average sign is not
too small, we can nevertheless compute observables within a reweighting scheme. Here we
adopt the following scheme. First note that the partition function is real such that:
X
X
X 

Z=
e−S(C) =e−S(C) =Re e−S(C) .
(25)
C

C

C

4

Thereby and with the definition
Re e−S(C) ,sgn(C) =Re e−S(C)the computation of the observable [Eq. (18)] is re-expressed as follows:
P −S(C)〈〈Ô〉〉(C)CeP〈Ô〉 =−S(C)Ce −S(C)  e−S(C)PRee〈〈Ô〉〉(C)C
Re[e−S(C) ]


=
P
−S(C)
C Re enPo P
 −S(C) e−S(C)
sgn(C) Re e−S(C) 〈〈Ô〉〉(C) / C Re e−S(C)C Re e
[
]


P


=
P
−S(C)
sgn(C) / C Re e−S(C)C Re e¬¶e−S
sgn Re[e
〈〈
Ô〉〉
−S ]
P
=
.
〈sgn〉 P

(26)

(27)

The average sign isP〈sgn〉 P =

 −S(C) Reesgn(C)
C


,
P
−S(C)
C Re e(28)

and we have 〈sgn〉 P ∈ R per definition. The Monte Carlo simulation samples the probability
distributionRe e−S(C) .

P(C) = P(29)−S(C)
C Re e4
The attentive reader will have noticed that for arbitrary Trotter decompositions, the imaginary time propagatoris not necessarily Hermitian. Thereby, the above equation is correct only up to corrections stemming from thecontrolled Trotter systematic error.

12

SciPost Phys. Codebases 1 (2022)

such that the nominator and denominator of Eq. (27) can be computed.
Notice that, for the Langevin updating scheme with variable Langevin time step, a straightforward generalization of the equations above is used, see Sec. 2.2.6.
The negative sign problem is still an issue because the average sign is a ratio of two partition
functions and one can argue that〈sgn〉 P ∝ e−∆N β ,(30)where ∆ is an intensive positive quantity
p and N β denotes the Euclidean volume. In a Monte
Carlo simulation the error scales as 1/ TCPU where TCPU corresponds to the computational
time. Since the error on the average sign has to be much smaller than the average sign itself,
one sees that:
TCPU  e2∆N β .
(31)
Two comments are in order. First, the presence of a sign problem invariably leads to an exponential increase of CPU time as a function of the Euclidean volume. And second, ∆ isformulation dependent. For instance, at finite doping, the SU(2) invariant formulation of the
Hubbard model presented in Sec. 9.1 has a much more severe sign problem than the formulation (presented in the same section) where the HS field couples to the z-component of themagnetization. Optimization schemes minimize ∆ have been put forward in [116, 117].

2.2

Updating schemes

The program allows for different types of updating schemes, which are described below andsummarized in Tab. 1. With the exception of Langevin dynamics, for a given configuration C,
we propose a new one, C 0 , with a given probability T0 (C → C 0 ) and accept it according to theMetropolis-Hastings acceptance-rejection probability,
T0 (C 0 → C)W (C 0 )P(C → C ) = min 1,,(32)
T0 (C → C 0 )W (C)
so as to guarantee the stationarity condition. Here, W (C) = Re e−S(C) .
Predicting how efficient a certain Monte Carlo update scheme will turn out to be for agiven simulation is very hard, so one must typically resort to testing to find out which option
produces best results. Methods to optimize the acceptance of global moves include HybridMonte Carlo [84] as well as self-learning techniques [118, 119]. Langevin dynamics stands
apart, and as we will see does not depend on the Metropolis-Hastings acceptance-rejection
scheme.
0

2.2.1

Sequential single spin flips

The program adopts per default a sequential, single spin-flip strategy. It will visit sequentiallyeach HS field in the space-time operator list and propose a spin flip. Consider the Ising spinsi,τ . By default (Propose_S0=.false.), we will flip it with probability 1, such that for thislocal move the proposal matrix is symmetric. If we are considering the HS field l i,τ we willpropose with probability 1/3 one of the other three possible fields. For a continuous field, we
modify it with a box distribution of width Amplitude centered around the origin. The default
value of Amplitude is set to unity. These updating rules are defined in the Fields_mod.F90
module (see Sec. 5.2). Again, for these local moves, the proposal matrix is symmetric. Hencein all cases we will accept or reject the move according to
W (C 0 )P(C → C 0 ) = min 1,
.
W (C)
13

(33)

SciPost Phys. Codebases 1 (2022)

Table 1: Variables required to control the updating scheme. Per default the program carries out sequential, single spin-flip sweeps, and logical variables are set to.false..
Updating schemes

Type

Description

Sequential

logicalPropose_S0

logical(internal variable) If true, the configurations moves
through sequential, single spin flips
If true, proposes sequential local moves according to theprobability e−S0 , where S0 is the free Ising action. This
option only works for type=1 operator where the fieldcorresponds to an Ising variable
Whether to carry out global moves on a single time slice.
For a given time slice the user can define which part ofthe operator string is to be computed sequentially. Thisis specified by the variable N_sequential_start and
N_sequential_end. A number of N_tau_Global userdefined global moves on the given time slice will then be
carried out
If true, allows for global moves in space and time. A userdefined number N_Global of global moves in space andtime will be carried out at the end of each sweep
If true, Langevin dynamics is used exclusively (i.e., canonly be used in association with tempering)
Requires MPI and runs the code in a parallel temperingmode, also see Sec. 2.2.5, 6.2

Global_tau_moves logical

Global_moves

logicalLangevin

logicalTemperingCompiling
optionThis default updating scheme can be overruled by, e.g., setting Global_tau_moves to.true. and not setting Nt_sequential_start and Nt_sequential_end (see Sec. 5.7.1).
It is also worth noting that this type of sequential spin-flip updating does not satisfy detailedbalance, but rather the more fundamental stationarity condition [86].
2.2.2

Sampling of e−S0

The package can also propose single spin-flip updates according to a non-vanishing free bosonicaction S0 (C). This sampling scheme is used if the logical variable Propose_S0 is set to.true.. As mentioned previously, this option only holds for Ising variables.
Consider an Ising spin at space-time i, τ in the configuration C. Flipping this spin generates
the configuration C 0 and we propose this move according to0

e−S0 (C )1
T0 (C → C ) = −S (C 0 )
=1−
.
−S
(C)
−S
(C
e 0
+e 0
1 + e 0 0 ) /e−S0 (C)0(34)

Note that the function S0 in the Hamiltonian_Hubbard_include.h module computes pre0
cisely the ratio e−S0 (C ) /e−S0 (C) , therefore T0 (C → C 0 ) is obtained without any additional calculation. The proposed move is accepted with the probability:
e−S0 (C) W (C 0 )0P(C → C ) = min 1, −S (C 0 ).
(35)
e 0 W (C)Note that, as can be seen from Eq. (17), the bare action S0 (C) determining the dynamics of thebosonic configuration in the absence of coupling to the fermions does not enter the Metropolis
acceptance-rejection step.
14

SciPost Phys. Codebases 1 (2022)

2.2.3

Global updates in space

This option allows one to carry out user-defined global moves on a single time slice. This
option is enabled by setting the logical variable Global_tau_moves to .true.. Recall thatthe propagation over a time step ∆τ (see Eq. 22) can be written as:e−VM I +MV (s M I +MV ,τ )···e

−V1 (s1,τ )

MT
Y

e−∆τT

(k)

,

(36)

k=1

where e−Vn (sn ) denotes one element of the operator list containing the HS fields. One can provide an interval of indices, [Nt_sequential_start, Nt_sequential_end], in which theoperators will be updated sequentially.
Setting Nt_sequential_start = 1 and
Nt_sequential_end = M I + MV reproduces the sequential single spin flip strategy of theabove section.
The variable N_tau_Global sets the number of global moves carried out on each time slice
ntau. Each global move is generated in the routine Global_move_tau, which is provided
by the user in the Hamiltonian file. In order to define this move, one specifies the following
variables:• Flip_length: An integer stipulating the number of spins to be flipped.
• Flip_list(1:Flip_length): Integer array containing the indices of the operators to
be flipped.
• Flip_value(1:Flip_length): Flip_value(n) is an integer containing the newvalue of the HS field for the operator Flip_list(n).
• T0_Proposal_ratio: Real number containing the quotient
T0 (C 0 → C),
T0 (C → C 0 )(37)

where C 0 denotes the new configuration obtained by flipping the spins specified in the
Flip_list array. Since we allow for a stochastic generation of the global move, it mayvery well be that no change is proposed. In this case, T0_Proposal_ratio takes thevalue 0 upon exit of the routine Global_move_tau and no update is carried out.
0

• S0_ratio: Real number containing the ratio e−S0 (C ) /e−S0 (C) .
2.2.4

Global updates in time and space

The code allows for global updates as well. The user must then provide two additional functions (see Hamiltonian_Hubbard_include.h): Global_move andDelta_S0_global(Nsigma_old).
The subroutine Global_move(T0_Proposal_ratio,nsigma_old,size_clust) proposes a global move. Its single input is the variable nsigma_old of type Field (see Section 5.2) that contains the full configuration C stored in nsigma_old%f(M_V+M_I, Ltrot).
On output, the new configuration C 0 , determined by the user, is stored in the two-dimensional
array nsigma, which is a global variable declared in the Hamiltonian module. Like for the
global move in space (Sec. 2.2.3), T0_Proposal_ratio contains the proposal ratio
T0 (C 0 → C)/T0 (C → C 0 ). Since we allow for a stochastic generation of the global move,it may very well be that no change is proposed. In this case, T0_Proposal_ratio takes thevalue 0 upon exit, and nsigma = nsigma_old. The real-valued size_clust gives the size
15

SciPost Phys. Codebases 1 (2022)

Number of flipped spinsof the proposed move (e.g., Total number of spins ). This is used to calculate the average sizes of
proposed and accepted moves, which are printed in the info file. The variable size_clust
is not necessary for the simulation, but may help the user to estimate the effectiveness of the
global update.
In order to compute the acceptance-rejection ratio, the user must also provide a function
0
Delta_S0_global(nsigma_old) that computes the ratio e−S0 (C ) /e−S0 (C) . Again, the configuration C 0 is given by the field nsigma.
The variable N_Global determines the number of global updates performed per sweep.
Note that global updates are expensive, since they require a complete recalculation of theweight.
2.2.5

Parallel tempering

Exchange Monte Carlo [120], or parallel tempering [121], is a possible route to overcome
sampling issues in parts of the parameter space. Let h be a parameter which one can vary
without altering the configuration space {C} and let us assume that for some values of h one
encounters sampling problems. For example, in the realm of spin glasses, h could correspondto the inverse temperature. Here at high temperatures the phase space is easily sampled,but at low temperatures simulations get stuck in local minima. For quantum systems, h could
trigger a quantum phase transition where sampling issues are encountered, for example, in theordered phase and not in the disordered one. As its name suggests, parallel tempering carries
out in parallel simulations at consecutive values of h: h1 , h2 , · · · hn , with h1 < h2 < · · · < hn .
One will sample the extended ensemble:
P([h1 , C1 ] , [h2 , C2 ] , · · · , [hn , Cn ]) = P

W (h1 , C1 )W (h2 , C2 ) · · · W (hn , Cn )C1 ,C2 ,··· ,Cn W (h1 , C1 )W (h2 , C2 ) · · · W (hn , Cn )

,

(38)

where W (h, C) corresponds to the weight for a given value of h and configuration C. Clearly,
one can sample P([h1 , C1 ] , [h2 , C2 ] , · · · , [hn , Cn ]) by carrying out n independent runs. However, parallel tempering includes the following exchange step:[h1 , C1 ] , · · · , [hi , Ci ] , [hi+1 , Ci+1 ] , · · · , [hn , Cn ] →[h1 , C1 ] , · · · , [hi , Ci+1 ] , [hi+1 , Ci ] , · · · , [hn , Cn ] , (39)which, for a symmetric proposal matrix, will be accepted with probabilityW (hi , Ci+1 )W (hi+1 , Ci )min 1,.
W (hi , Ci )W (hi+1 , Ci+1 )(40)

In this way a configuration can meander in parameter space h and explore regions where
ergodicity is not an issue. In the context of spin-glasses, a low temperature configuration,
stuck in a local minima, can heat up, overcome the potential barrier and then cool down
again.
A judicious choice of the values hi is important to obtain a good acceptance rate for theexchange step. With W (h, C) = e−S(h,C) , the distribution of the action S reads:X
P (h, S) =P(h, C)δ(S(h, C) − S) .
(41)
C

A given exchange step can only be accepted if the distributions P (h, S) and P (h + ∆h, S)
overlap. For 〈S〉h < 〈S〉h+∆h one can formulate this requirement as:
q〈S〉h + 〈∆S〉h ' 〈S〉h+∆h − 〈∆S〉h+∆h , with 〈∆S〉h = 〈(S − 〈S〉h )2 〉h .
(42)
16

SciPost Phys. Codebases 1 (2022)

Assuming 〈∆S〉h+∆h ' 〈∆S〉h and expanding in ∆h one obtains:∆h '2〈∆S〉h.
∂ 〈S〉h /∂ h

(43)

The above equation becomes transparent for classical systems with S(h, C) = hH(C). In thiscase, the above equation reads:pc∆h ' 2h, with c = h2 〈(H − 〈H〉h )2 〉h .
(44)
c + h〈H〉h
Several comments are in order:i) Let us identify h with the inverse temperature such that c corresponds topthe specificheat. This quantity is extensive, as well as the energy, such that ∆h ' 1/ N where N
is the system size.
ii) Near a phase transition the specific heat can diverge, and h must be chosen with particular care.
iii) Since the action is formulation dependent, also the acceptance rate of the exchange
move equally depend upon the formulation.
The quantum Monte Carlo code in the ALF project carries out parallel-tempering runs when
the script configure.sh is called with the argument Tempering before compilation, seeSec. 6.2.
2.2.6

Langevin dynamicsFor models that include continuous real fields s ≡ sk,τ there is the option of using Langevindynamics for the updating scheme, by setting the variable Langevin to .true.. This corresponds to a stochastic differential equation for the fields. They acquire a discrete Langevintime t l with step width δt l and satisfy the stochastic differential equationÆ∂ S(s (t l ))s(t l + δt l ) = s (t l ) − Q(45)
δt l + 2δt l Qη(t l ) .
∂ s (t l )Here, η(t l ) are independent Gaussian stochastic variables satisfying:〈ηk,τ (t l )〉η = 0

and〈ηk,τ (t l )ηk0 ,τ0 (t l0 )〉η = δk,k0 δτ,τ0 δ t l ,t 0 ,l(46)

S(s (t l )) is an arbitrary real action and Q is an arbitrary positive definite matrix. By default Q is
equal to the identity matrix, but a proper choice can help accelerate the update scheme, as we
discuss below. We refer the reader to Ref. [122] for an in-depth introduction to stochastic differential equations. To see that the above indeed produces the desired probability distribution
in the long Langevin time limit, we can transform the Langevin equation into the corresponding Fokker-Plank one. Let P(s , t l ) be the distribution of fields at Langevin time t l . Then,P(s , t l + δt l ) =

Z

·
­ 

Æ
∂ S(s 0 )0
δt l + 2δt l Qη(t l ),Ds P(s , t l ) δ s − s − Q
∂ s0
η
0

0

(47)

where δ corresponds to the Ltrotter M I dimensional Dirac δ-function. Taylor expanding up toorder δt l and averaging over the stochastic variable yields:Z ∂ S(s 0 )∂
0P(s , t l + δt l ) = Ds 0 P(s 0 , t l ) δ s 0 − s −
δ
s
−
s
Q
δt l
∂ s0
∂ s0



∂
∂
0
+ 0 Q 0 δ s − s δt l + O δt l2 . (48)
∂s ∂s
17

SciPost Phys. Codebases 1 (2022)

Partial integration and taking the limit of infinitesimal time steps gives the Fokker-Plank equation∂ P(s , t l )∂∂∂ S(s)P(s , t l ) =P(s , t l )Q
+Q
.
(49)
∂ tl
∂s
∂s
∂s
The stationary, ∂∂t P(s , t l ) = 0, normalizable, solution to the above equation corresponds tolthe desired probability distribution:e−S(s )P(s ) = R

Ds e−S(s).

(50)

Taking into account a potential negative sign problem, the action for our general model reads:
S(C) = − ln Re e−S(C)

,

(51)

where S(C) is defined in Eq. (17). Hence,∂ S(C)
1iφ(C) ∂ S(C)

Re e
=
,
∂ sk,τ
∂ sk,τ
Re e iφ(C)withe iφ(C) =(52)

e−S(C),|e−S(C) |(53)

corresponding to the variable PHASE in the ALF package.
Therefore, to formulate the Langevin dynamics we need to estimate the forces:∂ S(C) ∂ S0 (C) ∂ S F (C)=+,∂ sk,τ
∂ sk,τ
∂ sk,τ

(54)

with the fermionic part of the action being

S F (C) = − ln


MV LY
Y
Trotter


×

Nfl
Y
s=1




γk,τ eNcol

Nfl MV LTrotter pP
P P−∆τUk αk,s ηk,τs=1 k=1

τ=1

k=1 τ=1



det 1 +LY
MV
Trotter Y

ep−∆τUk ηk,τ V

τ=1 k=1

(ks)

MI
Y

e−∆τsk,τ I

k=1

(ks)

MT
Y

e−∆τT

(ks)

Ncol ). (55)

k=1

The forces must be bounded for Langevin dynamics to work well. If this condition is violated
the results produced by the code are not reliable.
One possible source of divergence is the determinant in the fermionic action. Zeros lead tounbounded forces and, in order to mitigate this problem, we adopt a variable time step. The
user provides an upper bound to the fermion force, Max_Force and, if the maximal force in aconfiguration, Max_Force_Conf, is larger than Max_Force, then the time step is rescaled as
˜l =δtMax_Force* δt l .
Max_Force_Conf(56)

With the adaptive time step, averages are computed as:P〈Ô〉 =e−S(Cn )˜
n (δt l )n sgn(Cn ) Re[e−S(Cn ) ] 〈〈Ô〉〉(Cn )P

˜n (δt l )n sgn(Cn )

18

.

(57)

SciPost Phys. Codebases 1 (2022)

where sgn(Cn ) is defined in Eq. (26). In this context the adaptive time step corresponds to thevariable Mc_step_weight required for the measurement routines (see Sec. 5.4).
A possible way to reduce autocorrelation times is to employ Fourier acceleration [123,124].
As we see from Eq. (50), the choice of the matrix Q does not alter the probability distribution
obtained from the Langevin equation. The main idea of Fourier acceleration is to exploit thisfreedom and use Q to enhance (reduce) the Langevin time step δt l of slow (fast) modes of the
fields s [125]. The modified Langevin equation reads:




Æ
∂ S(s (t l ))s (t l + δt l ) = s (t l ) − F̂ −1 Q F̂(58)
δt l + 2δt l Q F̂ [η(t l )] ,∂ s (t l )with F̂ being a transformation to independent modes of the field. This generically corresponds
to a Fourier transform, thus the notation. Currently, Fourier acceleration is not implemented
in ALF, but can be included by the user.
In order to use Langevin dynamics the user also has to provide the Langevin time step
Delta_t_Langevin_HMC, the maximal force Max_Force, set Global_update_scheme =(C)
Langevin in the parameter file. Furthermore, the forces ∂∂Ss0k,τ
are to be specified in theroutine Ham_Langevin_HMC_S0 of the Hamiltonian files. The Langevin update for a general
Hamiltonian is carried out in the module Langevin_HMC_mod.F90. In particular the fermion
forces,NflX∂ S F (C)= ∆τNcolTr I (ks) 1 − G (s) (k, τ) ,(59)
∂ sk,τ
s=1
are computed in this module. In the above, we introduce a Green function that depends on
the time slice τ and the interaction term k to which the corresponding field sk,τ belongs:<>Tr Û(s)(k, τ)ĉ x,s ĉ †y,s Û(s)(k, τ)
G (s),x, y (k, τ) =<>Tr Û(s)(k, τ)Û(s)(k, τ)(60)

where the following definitions are used<Û(s)(k0 , τ0 ) =LY
Trotter

MV p
MI
Y
Y
† (ks)−∆τUk ηk,τ0 ĉs† V (ks) ĉse−∆τsk,τ0 ĉs I ĉs ,Û(s) (τ)e(61)

τ=τ0 +1

k=k0 +1
k=1
0
0
M
k
τ
−1
T
Y
Y
Y

† (ks)† (ks)>Û(s)(k0 , τ0 ) =e−∆τsk,τ0 ĉs I ĉse−∆τĉs T ĉsÛ(s) (τ) ,
τ=1
k=1
k=1
MV p
MI
MT
Y
Y
Y
† (ks)† (ks)† (ks)
Û(s) (τ) =e −∆τUk ηk,τ ĉs V ĉse−∆τsk,τ ĉs I ĉse−∆τĉs T ĉs .
k=1
k=1
k=1

(62)

(63)

The vector ĉs† contains all fermionic operators ĉ †x,s of flavor s.
During each Langevin step, all fields are updated and the Langevin time is incremented by˜
δt l . At the end of a run, the mean and maximal forces encountered during the run are printed
out in the info file.
The great advantage of the Langevin updating scheme is the absence of update rejection,
meaning that all fields are updated at each step. As mentioned above, the price we pay forusing Langevin dynamics is ensuring that forces show no singularities. Two other potential
issues should be highlighted:• Langevin dynamics is carried out at a finite Langevin time step, thereby introducing afurther source of systematic error.
19

SciPost Phys. Codebases 1 (2022)

p• The factor 2δt l multiplying the stochastic variable makes the noise dominant on shorttime scales. On these time scales Langevin dynamics essentially corresponds to a random
walk. This has the advantage of allowing one to circumvent potential barriers, but may
render the updating scheme less efficient than the hybrid molecular dynamics approach .
Example - Hubbard chain at half-filling
Let us consider a 6-site Hubbard chain at half-filling with U/t = 4 and β t = 4. The Hubbard
interaction can be decoupled using a continuous HS transformation, where we introduce areal auxiliary field si,τ for every lattice site i and time slice τ. When the HS fields are coupled
to the z-component of the magnetization (see Sec. 9.1), the partition function can be writtenasZ=

Z  LY
Trotter Nunit-cell
Y
τ=1

i=1

dsi,τ − 1 s2
p e 2 i,τ
2π
×





Y

det 1 +

LY
Trotter Nunit-cell
Y 
τ=1

s=↑,↓

e


p
−∆τT
− ∆τUsi,τ V (is)
e

i=1


+ O(∆τ2 ) . (64)

The flavor-dependent interaction matrices have only one non-vanishing entry each:= δ x, y δ x,i
Vx,(i,s=↑)y= −δ x, y δ x,i .
Vx,(i,s=↓)yandThe forces of the Hubbard model are given by:
X p∂ S(C)= si,τ − ∆τU
Tr V (is) 1 − G (s) (i, τ) ,∂ si,τ
s=↑,↓(65)

where the Green function is defined by Eq. (60) with
< 0
Û(s)
(i , τ0 ) =

> 0
Û(s)
(i , τ0 ) =Û(s) (τ) =Yp Nunit-cell† (is)e− ∆τUsi,τ0 ĉs V ĉs ,Û(s) (τ)

LYTrotter
τ=τ0 +1
i0 
Y

(66)

i=i 0 +1
0

e

τ
−1
Y

p
−∆τĉs† T ĉs− ∆τUsi,τ0 ĉs† V (is) ĉse

i=1
Nunit-cellY Û(s) (τ) ,

(67)

τ=1
p

†

e− ∆τUsi,τ ĉs V

(is)

ĉs



†

e−∆τĉs T ĉs .

(68)

i=1

One can show that for periodic boundary conditions the forces are not bounded and to makesure that the program does not crash we set Max_Force = 1.5.
The results are: the reference, discrete-variable code gives〈Ĥ〉 = −3.4684 ± 0.0007,(69)

while the Langevin code at δt l = 0.001 yields

and at δt l = 0.01

〈Ĥ〉 = −3.457 ± 0.010(70)〈Ĥ〉 = −3.495 ± 0.007.

(71)

20

SciPost Phys. Codebases 1 (2022)

L = 6, βt = 4
−2.81
−2.82

hĤi

−2.83
−2.84
−2.85
−2.86
−2.87
−2.88

0

0.02

0.04

0.06

0.08

0.1

δtl
Figure 1: Total energy for the 6-site Hubbard chain at U/t = 4, β t = 4 and with
open boundary conditions. For this system it can be shown that the determinant isalways positive, so that no singularities occur in the action and, consequently, theLangevin dynamics works very well. The reference data point at δt l = 0 comes fromthe discrete field code for the field coupled to the z-component of the magnetization and reads −2.8169 ± 0.0013, while the extrapolated value is −2.8176 ± 0.0010.
Throughout the runs the maximal force remained bellow the threshold of 1.5. The
displayed data has been produced by the pyALF script Langevin.py.
At δt l = 0.001 the maximal force that occurred during the run was 112, whereas at δt l = 0.01
it grew to 524. In both cases the average force was given by 0.45. For larger values of δt l
the maximal force grows and the fluctuations on the energy become larger (for instance,〈Ĥ〉 = −3.718439 ± 0.206469 at δt l = 0.02; for this parameter set the maximal force weencountered during the run was of 1658).
Controlling Langevin dynamics when the action has logarithmic divergences is a challenge,
and it is not a given that the results are satisfactory. For our specific problem we can solve thisissue by considering open boundary conditions. Following an argument put forward in [93],we can show, using world lines, that the determinant is always positive. In this case the action
does not have logarithmic divergences and the Langevin dynamics works beautifully well, seeFig. 1.

2.3

The Trotter error and checkerboard decomposition

2.3.1

Asymmetric Trotter decomposition

In practice, many applications are carried out at finite imaginary time steps, and it is importantto understand the consequences of the Trotter error. How does it scale with system size andwhat symmetries does it break? In particular, when investigating a critical point, one should
determine whether the potential symmetry breaking associated with the Trotter decomposition
generates relevant operators.
To best describe the workings of the ALF code, we divide the Hamiltonian into hopping

21

SciPost Phys. Codebases 1 (2022)

terms Ĥ T and interaction terms ĤV + Ĥ I + Ĥ0,I . Let

Ĥ T =

NT X
X

T̂

(k)

≡

i=1 k∈S T

NT
X

T̂i .

(72)

i=1

i

Here the decomposition follows the rule that if k and k0 belong to the same set SiT then (k) (k0 ) T̂ , T̂= 0. An important case to consider is that of the checkerboard decomposition.
For the square lattice we can decouple the nearest neighbor hopping into NT = 4 groups, eachconsisting of two site hopping processes. This type of checkerboard decomposition is activatedfor a set of predefined lattices by setting the flag Checkerboard to .true.. We will carryout the same separation for the interaction:

ĤV + Ĥ I + Ĥ0,I =

NI
X

Ôi ,

(73)

i=1

where each Ôi contains
for the Hubbard model, theP a set of commuting terms. For instance,Pabove reduces to U i n̂i,↑ n̂i,↓ such that NI = 1 and Ô1 = U i n̂i,↑ n̂i,↓ .
The default Trotter decomposition in the ALF code is based on the equation:e−∆τ(Â+B̂) = e−∆τÂ e−∆τB̂ +



∆τ2 
B̂, Â + O ∆τ3 .
2(74)

Using iteratively the above the single time step is given by:
e

−∆τH

=

NO
Y
i=1

e

−∆τÔiNTYe−∆τ T̂ j

j=1

∆τ2
+
2
|

NO X
NT
X




T̂ j , Ôi +NX
T −1 



T̂ j 0 , T̂ j>0 +

!



>


+O ∆τ3 . (75)Ôi 0 , Ôi 0

i 0 =1j0

i=1 j=1

NX
O −1

{z

}

≡∆τλ̂1In the above, we have introduced the shorthand notationT̂n> =NT
X

T̂ j and Ôn> =

j=n+1

NO
X

Ô j .

(76)

j=n+1

The full propagation then reads
ÛApprox =NOYe−∆τÔii=1= e−β Ĥ −NTY!LTrottere−∆τ T̂ j

j=1

Zβ
0

= e−β (Ĥ+λ̂1 ) + O ∆τ2(77)dτe−(β−τ)Ĥ λ̂1 e−τĤ + O(∆τ2 ) .

The last step follows from time-dependent perturbation theory. The following comments are
in order:• The error is anti-Hermitian since λ̂†1 = −λ̂1 . As a consequence, if all the operators aswell as the quantity being measured are simultaneously real representable, then the
prefactor of the linear in ∆τ error vanishes since it ultimately corresponds to computing the trace of an anti-symmetric matrix. This lucky cancellation was put forward inRef. [103]. Hence, under this assumption – which is certainly valid for the Hubbard
model considered in Fig. 2 – the systematic error is of order ∆τ2 .
22

SciPost Phys. Codebases 1 (2022)• The biggest drawback of the above decomposition is that the imaginary-time propagation is not Hermitian. This can lead to acausal features in imaginary-time correlation
functions [126]. To be more precise, the eigenvalues of HApprox = − β1 log UApprox neednot be real and thus imaginary-time displaced correlation functions may oscillate as afunction of imaginary time. This is shown in Fig. 2(a) that plots the absolute value of
local time-displaced Green function for the Honeycomb lattice at U/t = 2. Sign changesof this quantity involve zeros that, on the considered log-scale, correspond to negative
divergences. As detailed in [114], using the non-symmetric Trotter decomposition leads
to an additional non-Hermitian second-order error in the measurement of observables
O that is proportional to [T, [T, O]]. As we see next, these issues can be solved by considering a symmetric Trotter decomposition.
2.3.2

Symmetric Trotter decomposition

To address the issue described above, the ALF package provides the possibility of using a symmetric Trotter decomposition,



∆τ3 
2Â + B̂, B̂, Â + O ∆τ5 ,12e−∆τ(Â+B̂) = e−∆τA/2 e−∆τB̂ e−∆τA/2 +
ˆ

ˆ

(78)

by setting the Symm flag to .true.. Before we apply the expression above to a time step, let
us writee−∆τH = e

− ∆τ
2

PNT
j=1

T̂ j −∆τ

e

PNI
i=1

∆τ
Ôi − 2

e

PNT
j=1

T̂ j

+




∆τ3  >
2 T̂0 + Ô0> , Ô0> , T̂0> +O ∆τ5 . (79)|12{z}≡∆τλ̂ T O

Then,
e−∆τ

PNI
i

Ôi

=

NY
O −1

e

− ∆τ
2 Ôi

!
e−∆τÔNO

1
Y

e

− ∆τ
2 Ôi

!

i=NO −1

i=1

+

N0 −1



∆τ3 X 2Ôi + Ôi> , Ôi> , Ôi +O ∆τ5 , (80)12 i=1|{z}≡∆τλ̂O

e

− ∆τ
2

PNT
j

T̂ j

=

NY
T −1
j=1

e

− ∆τ
4 T̂ j!
e− ∆τ
2 T̂NT

1
Y

e

− ∆τ
4 T̂ j!

j=NT −1
NT −1



∆τ3 X +2 T̂ j + T̂ j> , T̂ j> , T̂ j +O ∆τ5 , (81)
96 j=1{z}|≡∆τλ̂ T

23

SciPost Phys. Codebases 1 (2022)

and we can derive a closed equation for the free energy density:

!
!
NY
1
T −1
Y
∆τ
∆τ
∆τ
1
fApprox = −log Tr e− 4 T̂ j ×
e− 4 T̂ j e− 2 T̂NT
βV
j=NT −1
j=1
!
!
NY
1
O −1
Y
∆τ
∆τ
e− 2 Ôi e−∆τÔNO
e− 2 Ôi ×i=NO −1

i=1
NY
T −1

∆τ

!

∆τ

e− 2 T̂NTe− 4 T̂ j∆τ! LTrottere− 4 T̂ j 

j=NT −1

j=1

=f −

1
Y

1
〈λ̂ T O + λ̂O + 2λ̂ T 〉 + O(∆τ4 ) .
V(82)

The following comments are in order:• The approximate imaginary-time propagation from which the fApprox is derived is Hermitian. Hence no spurious effects in imaginary-time correlation functions are to be expected. This is clearly shown in Fig. 2(a).
• In Fig. 2(b) we have used the ALF-library with Symm=.true. with and without checkerboard decomposition. We still expect the systematic error to be of order ∆τ2 . However
its prefactor is much smaller than that of the aforementioned anti-symmetric decomposition.
• We have taken the burden to evaluate explicitly the prefactor of the ∆τ2 error on the freeenergy density. One can see that for Hamiltonians that are sums of local operators, thequantity 〈λ̂ T O + λ̂O +2λ̂ T 〉 scales as the volume V of the system, such that the systematic
error on the free energy density (and on correlation functions that can be computedby adding source terms) will be volume independent. For model Hamiltonians that are
not sums of local terms, care must be taken. A conservative upper bound on the error
is 〈λ̂ T O + λ̂O + 2λ̂ T 〉 ∝ ∆τ2 V 3 , which means that, in order to maintain a constantsystematic error for the free energy density, we have to keep ∆τV constant. Such asituation has been observed in Ref. [74].
Alternative symmetric second order methods as well as the issues with decompositions ofhigher order have been detailed in [114].
2.3.3

The Symm flag

If the Symm flag is set to true, then the program will automatically – for the set of predefinedlattices and models – use the symmetric ∆τ time step of the interaction and hopping terms.
To save CPU time when the Symm flag is on we carry out the following approximation:


NY
T −1


j=1

e

− ∆τ
4 T̂ j!
e− ∆τ
2 T̂NT

1
Y
j=NT −1e− ∆τ4 T̂ j

! 2
 '

NY
T −1
j=1

e

− ∆τ
2 T̂ j!
e−∆τ T̂NT

1
Y

e

− ∆τ
2 T̂ j!
.

(83)

j=NT −1

The above is consistent with the overall precision of the Trotter decomposition and more importantly conserves the Hermiticity of the propagation.

24

SciPost Phys. Codebases 1 (2022)

Honeycomb,

L = 6, U/t = 2, βt = 40

Square,

10+0

−30

10−1

−30.5

10−2

−31

10−3

hĤi

|G(r = 0, τ )|L = 6, U/t = 4, βt = 5

−29.5

−31.5
−32

10−4
∆τ = 0.2
Sym N Check Y, ∆τ = 0.1
Sym Y Check Y, ∆τ = 0.2
Sym Y Check Y, ∆τ = 0.1
Sym N Check Y,

10−5
10−6
0

5

10

15

−32.5

Sym N Check N−33

Sym Y Check N

−33.5

20

Sym N Check Y
Sym Y Check Y

0

0.01

0.02

0.03

0.04

(∆τ t)2τFigure 2: Analysis of Trotter systematic error. Left: We consider a 6 × 6 Hubbard model on the Honeycomb lattice, U/t = 2, half-band filling, inverse temperature β t = 40, and we have used an HS transformation that couples to thedensity. The figure plots the local-time displaced Green function. Right: Herewe consider the 6 × 6 Hubbard model on the square lattice, at U/t = 4, halfband filling, inverse temperature β t = 5, and we have used the HS transformation that couples to the z-component of spin. We provide data for the four combinations of the logical variables Symm and Checkerboard, where Symm=.true.
(.false.) indicates a symmetric (asymmetric) Trotter decomposition has been
used, and Checkerboard=.true. (.false.) that the checkerboard decomposition for the hopping matrix has (not) been used. The large deviations between
different choices of Symm are here ∼ [T, [T, H]] as detailed in [114].

2.4

Stabilization - a peculiarity of the BSS algorithm

From the partition function in Eq. (17) it can be seen that, for the calculation of the Monte
Carlo weight and of the observables, a long product of matrix exponentials has to be formed.
In addition to that, we need to be able to extract the single-particle Green function for a given
flavor index at, say, time slice τ = 0. As mentioned above (cf. Eq. (21)), this quantity is given
by:
−1

LY
Trotter
G = 1+
Bτ
,
(84)
τ=1

which can be recast as the more familiar linear algebra problem of finding a solution for the
linear system
LY
Trotter
1+
Bτ x = b .
(85)
τ=1
n×n

The matrices Bτ ∈ C
depend on the lattice size as well as other physical parameters thatcan be chosen such that a matrix norm of Bτ can be unbound in magnitude. From standard
perturbation theory for linear systems, the computed solution x̃ would contain a relative error



LY
Trotter|x̃ − x|= O εκ p 1 +
Bτ
,
|x|
τ=1

(86)

where ε denotes the machine precision, which is 2−53 for IEEE double-precision numbers, andκ p (M) is the condition number of the matrix M with respect to the matrix p-norm. Due toQτ Bτ containing exponentially large and small scales, as can be seen in Eq. (17), a straightforward inversion is completely ill-suited, in that its condition number would grow exponentiallywith increasing inverse temperature, rendering the computed solution x̃ meaningless.
25

SciPost Phys. Codebases 1 (2022)

In order to circumvent this, more sophisticated methods have to be employed. In the realmof the BSS algorithm there has been a long history [4, 97, 127–130] of using various matrix
factorization techniques. The predominant techniques are either based on the singular value
decomposition (SVD) or on techniques using the QR decomposition. The default stabilization
strategy in the auxiliary-field QMC implementation of the ALF package is to form a product of
QR-decompositions, which is proven to be weakly backwards stable [129]. While algorithms
using the SVD can provide higher stability, though at a higher cost, we note that great carehas to be taken in the choice of the algorithm, which has to achieve a high relative accuracy[131, 132].
As a first step we assume that, for a given integer NWrap, the multiplication of NWrap B
matrices has an acceptable condition number and, for simplicity, that LTrotter is divisible by
NWrap. We can then write:−1LTrotter

NWrap
Y NWrapY
G = 1 +B(i−1)·NWrap+τ 

i=1

.

(87)

τ=1

|

{z

}

≡B i

The key idea is to efficiently separate the scales of a matrix from the orthogonal part of amatrix. This can be achieved with the QR decomposition of a matrix A in the form Ai = Q i Ri .
The matrix Q i is unitary and hence in the usual 2-norm it satisfies κ2 (Q i ) = 1. To get a handle
on the condition number of Ri we consider the diagonal matrix(Di )n,n = |(Ri )n,n |(88)and set R̃i = Di−1 Ri , which gives the decomposition
Ai = Q i Di R̃i .

(89)

The matrix Di now contains the row norms of the original Ri matrix and hence attempts toseparate off the total scales of the problem from Ri . This is similar in spirit to the so-called
matrix equilibration which tries to improve the condition number of a matrix through suitablychosen column and row scalings. Due to a theorem by van der Sluis [133] we know that the
choice in Eq. (88) is almost optimal among all diagonal matrices D from the space of diagonal
matrices D, in the sense that
κ p ((Di )−1 Ri ) ≤ n1/p min κ p (D −1 Ri ) .
D∈DNow, given an initial decomposition A j−1 =formed in the following three steps:

Q

i Bi

= Q j−1 D j−1 T j−1 , an update B j A j−1 is

1. Form M j = (B j Q j−1 )D j−1 . Note the parentheses.
2. Do a QR decomposition of M j = Q j D j R j . This gives the final Q j and D j .
3. Form the updated T matrices T j = R j T j−1 .
This is a stable but expensive method for calculating the matrix product. Here is where NWrap
comes into play: it specifies the number of plain multiplications performed between the QR
decompositions just described, so that NWrap = 1 corresponds to always performing QR decompositions whereas larger values define longer intervals where no QR decomposition will
be performed. Whenever we perform a stabilization, we compare the old result (fast updates)with the new one (recalculated from the QR stabilized matrices). The difference is documented as the stability, both for the Green function and for the sign (of the determinant) The
effectiveness of the stabilization has to be judged for every simulation from the output fileinfo (Sec. 5.7.2). For most simulations there are two values to look out for:26

SciPost Phys. Codebases 1 (2022)• Precision Green• Precision Phase
The Green function, as well as the average phase, are usually numbers with a magnitude ofO(1). For that reason we recommend that NWrap is chosen such that the mean precision isof the order of 10−8 or better (for further recommendations see Sec. 6.4). We include typicalvalues of Precision Phase and of the mean and the maximal values of Precision Greenin the example simulations discussed in Sec. 7.7.

3

Auxiliary-Field Quantum Monte Carlo: projective algorithm

The projective approach is the method of choice if one is interested in ground-state properties.
The starting point is a pair of trial wave functions, |Ψ T,L/R 〉, that are not orthogonal to theground state |Ψ0 〉:〈Ψ T,L/R |Ψ0 〉 6= 0 .
(90)
The ground-state expectation value of any observable Ô can then be computed by propagation
along the imaginary time axis:〈Ψ T,L |e−θ Ĥ e−(β−τ)Ĥ Ôe−τĤ e−θ Ĥ |Ψ T,R 〉〈Ψ0 |Ô|Ψ0 〉
= lim
,
θ →∞
〈Ψ0 |Ψ0 〉〈Ψ T,L |e−(2θ +β)Ĥ |Ψ T,R 〉(91)

where β defines the imaginary time range where observables (time displaced and equal time)
are measured and τ varies from 0 to β in the calculation of time-displace observables. The
simulations are carried out at large but finite values of θ so as to guarantee convergence tothe ground state within the statistical uncertainty. The trial wave functions are determined up
to a phase, and the program uses this gauge choice to guarantee that〈Ψ T,L |Ψ T,R 〉 > 0 .

(92)

In order to use the projective version of the code, the model’s namespace in the parameter
file must set projector=.true. and specify the value of the projection parameter Theta,
as well as the imaginary time interval Beta in which observables are measured.
Note that time-displaced correlation functions are computed for a τ ranging from 0 to β.
The implicit assumption in this formulation is that the projection parameter Theta suffices
to reach the ground state. Since the computational time scales linearly with Theta large
projections parameters are computationally not expensive.

3.1

Specification of the trial wave function

For each flavor, one needs to specify a left and a right trial wave function. In ALF, they are
assumed to be the ground state of single-particle trial Hamiltonians Ĥ T,L/R and hence correspond to a single Slater determinant each. More specifically, we consider a single-particle
Hamiltonian with the same symmetries, color and flavor, as the original Hamiltonian:Ĥ T,L/R =Ncol X
Nfl N
dim
X
X
σ=1 s=1 x, yĉ †xσs h(s,L/R)ĉ yσs .
xy(93)

Ordering the eigenvalues of the Hamiltonian in ascending order yields the ground stateN
Ncol Y
Nfl NYpart,sdim
Y
X†(s,L/R)ĉ xσs U x,n|Ψ T,L/R 〉 =
|0〉 ,
(94)
σ=1 s=1 n=1

27

x=1

SciPost Phys. Codebases 1 (2022)

where



(s,L/R)(s,L/R)U †,(s,L/R) h(s,L/R) U (s,L/R) = Diag ε1, · · · , εN
.

(95)

dim

(s,L/R)
The trial wave function is hence completely defined by the set of orthogonal vectors U x,n
for n ranging from 1 to the number of particles in each flavor sector, Npart,s . This information isstored in the WaveFunction type defined in the module WaveFunction_mod (see Sec. 5.5).
Note that, owing to the SU(Ncol ) symmetry, the color index is not necessary to define the trial
wave function. The user will have to specify the trial wave function in the following way:

Do s = 1, N_fl
Do x = 1,Ndim
Do n = 1, N_part(s)WF_L(s)%P(x,n) =WF_R(s)%P(x,n) =
Enddo
Enddo
Enddo

U (s,L)x,n
U (s,R)x,nIn the above WF_L and WF_R are WaveFunction arrays of length Nfl . ALF comes with a set ofpredefined trial wave functions, see Sec. 8.5.
Generically, the unitary matrix will be generated by a diagonalization routine such that
if the ground state for the given particle number is degenerate, the trial wave function has adegree of ambiguity and does not necessarily share the symmetries of the Hamiltonian Ĥ T,L/R .
Since symmetries are the key for guaranteeing the absence of the negative sign problem, violating them in the choice of the trial wave function can very well lead to a sign problem.
It is hence recommended to define the trial Hamiltonians Ĥ T,L/R such that the ground state
for the given particle number is non-degenerate. That can be checked using the value of
WL_L/R(s)%Degen, which stores the energy difference between the last occupied and first
un-occupied single particle state. If this value is greater than zero, then the trial wave function is non-degenerate and hence has all the symmetry properties of the trial Hamiltonians,Ĥ T,L/R . When the projector variable is set to .true., this quantity is listed in the info file.

3.2

Some technical aspects of the projective code

If one is interested solely in zero-temperature properties, the projective code offers many advantages. This comes from the related facts that the Green function matrix is a projector, andthat scales can be omitted.
In the projective algorithm, it is known [6] that
h
i

−1
>
<
>
<
,
(96)
G(x, σ, s, τ|x 0 , σ, s, τ) = 1 − U(s)(τ) U(s)(τ)U(s)
(τ)
U(s)
(τ)
x,x 0

with
>
U(s)
(τ) =

τ
Y
τ0 =1

(s)

Bτ0 P (s),R

and

<
U(s)
(τ) = P (s),L,†

τ+1Y
τ0 =LTrotter

(s)

Bτ0 ,

(97)

where Bτ(s) is given by Eq. (22) and P (s),L/R correspond to the Ndim × Npart,s submatrices ofU (s),L/R . To see that scales can be omitted, we carry out a singular value decomposition:>>
U(s)(τ) = Ũ(s)(τ)d > v >

and

<
<
U(s)
(τ) = v < d < Ũ(s)
(τ) ,

(98)

>
such that Ũ(s)(τ) corresponds to a set of column-wise orthogonal vectors. It can be readily
seen that scales can be omitted, since
h
i

−1
>
<
>
<
G(x, σ, s, τ|x 0 , σ, s, τ) = 1 − Ũ(s)(τ) Ũ(s)(τ)Ũ(s)
(τ)
Ũ(s)
(τ)
.
(99)
x,x 0

28

SciPost Phys. Codebases 1 (2022)

L = 6, U/t = 2−79.7

Finite Tt-t’
Kekule

−79.8
−79.9

−80

−80.1
−80.2

−108.6−108.7−108.8−80.3−108.9

−80.4
−80.5

Finite Tt-t’
Kekule−108.5hĤt ihĤi

L = 6, U/t = 2−108.4

0

0.05

0.1
1
1
βt , 2θt+βt

0.15

−109

0.2

0

0.05

0.1

0.15

0.2

1
1
βt , 2θt+βt

L = 6, U/t = 2
0.5
0.4

χc

0.3
0.2
0.1
Finite T

0
0

0.05

0.1

0.15

0.2

1
βt

Figure 3: Comparison between the finite-temperature and projective codes for the
Hubbard model on a 6 × 6 Honeycomb lattice at U/t = 2 and with periodic boundary conditions. For the projective code (light blue symbols) β t = 1 is fixed, whileθ is varied. In all cases we have ∆τt = 0.1, no checkerboard decomposition, and asymmetric Trotter decomposition. For this lattice size and choice of boundary conditions, the non-interacting ground state is degenerate, since the Dirac points belong to
the discrete set of crystal momenta. In order to generate the trial wave function we
have lifted this degeneracy by either including a Kékulé mass term [46] that breaks
translation symmetry (triangles), or by adding a next-next nearest neighbor hopping(circles) that breaks the symmetry nematically and shifts the Dirac points away fromthe zone boundary [135]. As apparent, both choices of trial wave functions yield thesame answer, which compares very well with the finite temperature code at temperature scales below the finite-size charge gap.
Hence, stabilization is never an issue for the projective code, and arbitrarily large projection
parameters can be reached.
The form of the Green function matrix implies that it is a projector: G 2 = G. This property
has been used in Ref. [134] to very efficiently compute imaginary-time-displaced correlation
functions.

3.3

Comparison of finite and projective codes

The finite temperature code operates in the grand canonical ensemble, whereas in the projective approach the particle number is fixed. On finite lattices, the comparison between both
approaches can only be made at a temperature scale below which a finite-sized charge gap
emerges. In Fig. 3 we consider a semi-metallic phase as realized by the Hubbard model on the
Honeycomb lattice at U/t = 2. It is evident that, at a scale below which charge fluctuations
are suppressed, both algorithms yield identical results.
29

SciPost Phys. Codebases 1 (2022)

4

Monte Carlo sampling

Error estimates in Monte Carlo simulations are based on the central limit theorem [136] andcan be a delicate matter, especially as it requires independent measurements and a finite variance. In this section we give examples of the care that must be taken to satisfy these requirements when using a Monte Carlo code. This is part of the common lore of the field and wecover them briefly in this text. For a deeper understanding of the inherent issues of Markovchain Monte Carlo methods we refer the reader to the pedagogical introduction in chapter
1.3.5 of Krauth [137], the overview article of Sokal [86], the more specialized literature byGeyer [138] and chapter 6.3 of Neal [139].
In general, one distinguishes local from global updates. As the name suggest, the local
update corresponds to a small change of the configuration, e.g., a single spin flip of one of the
LTrotter (M I + MV ) field entries (see Sec. 2.2), whereas a global update changes a significant
part of the configuration. The default update scheme of the ALF implementation are local
updates, such that there is a minimum number of moves required for generating an independent configuration. The associated time scale is called the autocorrelation time, Tauto , and isgenerically dependent upon the choice of the observables.
We call a sweep a sequential propagation from τ = 0 to τ = L Trotter and back, such that eachfield is visited twice in each sweep. A single sweep will generically not suffice to produce an
independent configuration. In fact, the autocorrelation time Tauto characterizes the required
time scale to generate independent values of 〈〈Ô〉〉C for the observable O. This has several
consequences for the Monte Carlo simulation:• First of all, we start from a randomly chosen field configuration, such that one has toinvest a time of at least one Tauto , but typically many more, in order to generate relevant, equilibrated configurations before reliable measurements are possible. This phaseof the simulation is known as the warm-up or burn-in phase. In order to keep the code as
flexible as possible (as different simulations might have different autocorrelation times),
measurements are taken from the very beginning and, in the analysis phase, the parameter n_skip controls the number of initial bins that are ignored.
• Second, our implementation averages over bins with NSWEEPS measurements before
storing the results on disk. The error analysis requires statistically independent bins inorder to generate reliable confidence estimates. If the bins are too small (averaged overa period shorter then Tauto ), then the error bars are typically underestimated. Most of
the time, however, the autocorrelation time is unknown before the simulation is started
and, sometimes, single runs long enough to generate appropriately sized bins are notfeasible. For this reason, we provide a rebinning facility controlled by the parameter
N_rebin that specifies the number of bins recombined into each new bin during theerror analysis. One can test the suitability of a given bin size by verifying whether anincrease in size changes the error estimate5 .
• The N_rebin variable can be used to control a further issue. The distribution of theMonte Carlo estimates 〈〈Ô〉〉C is unknown, while a result in the form (mean ± error)
assumes a Gaussian distribution. Every distribution with a finite variance turns into a
Gaussian one once it is folded often enough (central limit theorem). Due to the internal
averaging (folding) within one bin, many observables are already quite Gaussian. Otherwise one can increase N_rebin further, even if the bins are already independent [140].
• The last issue we mention concerns time-displaced correlation functions. Even if theconfigurations are independent, the fields within the configuration are still correlated.
5

For an explicit example, see Sec. 4.2 and the appendix of Ref. [97].

30

SciPost Phys. Codebases 1 (2022)

Hence, the data for Sα,β (k, τ) [see Sec. 5.4; Eq. (123)] and Sα,β (k, τ + ∆τ) are also
correlated. Setting the switch N_Cov=1 triggers the calculation of the covariance matrix
in addition to the usual error analysis. The covariance is defined by
COVττ0 =1
NBinSα,β (k, τ) − Sα,β (k, τ)Sα,β (k, τ0 ) − Sα,β (k, τ0 )



.

(100)

An example where this information is necessary is the calculation of mass gaps extracted
by fitting the tail of the time-displaced correlation function. Omitting the covariancematrix will underestimate the error.

4.1

The Jackknife resampling method

For each observable Â, B̂, Ĉ · · · the Monte Carlo program computes a data set of NBin (ideally)
independent values where for each observable the measurements belong to the same statistical distribution. In the general case, we would like to evaluate a function of expectation
values, f (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ) – see for example the expression (27) for the observable including
reweighting – and we are interested in the statistical estimates of its mean value and the standard error of the mean. A numerical method for the statistical analysis of a given function fwhich properly handles error propagation and correlations among the observables is the Jackknife method, which is, like the related Bootstrap method, a resampling scheme [141]. Here
we briefly review the delete-1 Jackknife scheme, which consists in generating Nbin new data
sets of size Nbin − 1 by consecutively removing one data value from the original set. By A(i) we
denote the arithmetic mean for the observable Â, without the i-th data value Ai , namely
NBin
X
1
A(i) ≡Ak .
NBin − 1 k=1, k6=i(101)

As the corresponding quantity for the function f (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ), we define
f(i) (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ) ≡ f (A(i) , B(i) , C(i) · · · ) .

(102)

Following the convention in the literature, we will denote the final Jackknife estimate of themean by f(·) and its standard error by ∆ f . The Jackknife mean is given by
NBin
1 X
f(·) (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ) =f(i) (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ) ,NBin i=1(103)

and the standard error, including bias correction, is given by(∆ f )2 =

NBin

2
NBin − 1 X
f(i) (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ) − f(·) (〈Â〉, 〈B̂〉, 〈Ĉ〉 · · · ) .
NBin i=1(104)

For f = 〈Â〉, the equations (103) and (104) reduce to the plain sample average and the standard, bias-corrected, estimate of the error.

4.2

An explicit example of error estimation

In the following we use one of our examples, the Hubbard model on a square lattice in the
Mz HS decoupling (see Sec. 9.1), to show explicitly how to estimate errors. We show aswell that the autocorrelation time is dependent on the choice of observable. In fact, different
observables within the same run can have different autocorrelation times and, of course, this31

SciPost Phys. Codebases 1 (2022)

1

b)

SŜ z

0.025

0.8

(SŜ x + SŜ y )/2

0.02

0.6

(SŜ x + SŜ y + SŜ z )/3

0.015

Error

Auto orrelation

a)

0.4
0.2

0.01

SŜ z
(SŜ x + SŜ y )/2

0.005

0
0

50

100

150

0

200

tQM C

(SŜ x + SŜ y + SŜ z )/3
0

100

200
300
NRebin400

500

Figure 4: The autocorrelation function SÔ (t Auto ) (a) and the scaling of the error witheffective bin size (b) of three equal-time, spin-spin correlation functions Ô of the
Hubbard model in the Mz decoupling (see Sec. 9.1). Simulations were done on a
6 × 6 square lattice, with U/t = 4 and β t = 6. We used N_auto = 500 (see Sec. 6)
and a total of approximately one million bins. The original bin contained only one
sweep and we calculated around one million bins on a single core. The different
autocorrelation times for the x y-plane compared to the z-direction can be detectedfrom the decay rate of the autocorrelation function (a) and from the point where
saturation of the error sets in (b), which defines the required effective bin size forindependent measurements. The improved estimator (SŜ x + SŜ y + SŜ z )/3 appears tohave the smallest autocorrelation time, as argued in the text.

time scale depends on the parameter choice. Hence, the user has to check autocorrelations ofindividual observables for each simulation! Typical regions of the phase diagram that require
special attention are critical points where length scales diverge.
In order to determine the autocorrelation time, we calculate the correlation function


NBinX
−t AutoOi − Ô Oi+t Auto − Ô ,SÔ (t Auto ) =(105)
Oi − Ô Oi − Ô
i=1
where Oi refers to the Monte Carlo estimate of the observable Ô in the i th bin. This function
typically shows an exponential decay and the decay rate defines the autocorrelation time. Figure 4(a) shows the autocorrelation functions SÔ (t Auto ) for three spin-spin-correlation functions[Eq. (123)] at momentum k = (π, π) and at τ = 0:Ô = SŜ z for the z spin direction, Ô = (SŜ x + SŜ y )/2 for the x y plane, andÔ = (SŜ x + SŜ y + SŜ z )/3 for the total spin. The Hubbard model has an SU(2) spin symmetry.
However, we chose a HS field which couples to the z-component of the magnetization, Mz ,such that each individual configuration breaks this symmetry. Of course, after Monte Carloaveraging one expects restoration of the symmetry. The model, on bipartite lattices, shows
spontaneous spin-symmetry breaking at T = 0 and in the thermodynamic limit. At finite temperatures, and within the so-called renormalized classical regime, quantum antiferromagnets
have a length scale that diverges exponentially with decreasing temperatures [142]. The parameter set chosen for Fig. 4 is non-trivial in the sense that it places the Hubbard model inthis renormalized classical regime where the correlation length is substantial. Figure 4 clearlyshows a very short autocorrelation time for the x y-plane whereas we detect a considerably
longer autocorrelation time for the z-direction. This is a direct consequence of the long magnetic length scale and the chosen decoupling. The physical reason for the long autocorrelation
time corresponds to the restoration of the SU(2) spin symmetry. This insight can be used to32

SciPost Phys. Codebases 1 (2022)

define an improved, SU(2) symmetric estimator for the spin-spin correlation function, namely(SŜ x + SŜ y + SŜ z )/3. Thereby, global spin rotations are no longer an issue and this improved
estimator shows the shortest autocorrelation time, as can be clearly seen in Fig. 4(b). Other
ways to tackle large autocorrelations are global updates and parallel tempering.
A simple method to obtain estimates of the mean and its standard error from the timeseries of Monte Carlo samples is provided by the aforementioned facility of rebinning. Also
known in the literature as rebatching, it consists in aggregating a fixed number N_rebin ofadjacent original bins into a new effective bin. In addition to measuring the decay rate of
the autocorrelation function (Eq. (105)), a measure for the autocorrelation time can be also
obtained by the rebinning method. For a comparison to other methods of estimating the autocorrelation time we refer the reader to the literature [138, 139, 143]. A reliable error analysis
requires independent bins, otherwise the error is typically underestimated. This behavior isobserved in Fig. 4 (b), where the effective bin size is systematically increased by rebinning. If
the effective bin size is smaller than the autocorrelation time the error will be underestimated.
When the effective bin size becomes larger than the autocorrelation time, converging behavior
sets in and the error estimate becomes reliable.

4.3

Pseudocode description

The Monte Carlo algorithm as implemented in ALF is summarized in Alg. 1. Key control variables include:

Projector Uses (=true) the projective instead of finite-T algorithm (see Sec. 3)
Lτ Measures (Ltau=1) time-displaced observables (see Sec. 2.1.2)
Tempering Runs (=true) in parallel tempering mode (see Tab. 1)
Global_moves Carries out (=true) global moves in a single time slice (see Tab. 1)
Sequential Carries out (=true) sequential, single spin-flip updates (see Tab. 1)
Langevin Uses (=true) Langevin dynamics instead of sequential (see Tab. 1)
Per default, the finite-temperature algorithm is used, Ltau=0, and the updating used isSequential (i.e., Global_moves, Tempering and Langevin default values are all .false).
Algorithm 1 Basic structure of the QMC implementation in Prog/main.f90. INITIALIZATION
1: call Ham_Set
2: call Fields_Init
3: call Nsigma%in
4: for n = L Trotter to 1 do
5:call Wrapul. Set the Hamiltonian and the lattice. Set the auxiliary fields. Read in an auxiliary-field configuration or generate it randomly. Fill the storage needed for the first actual MC sweep. Compute propagation matrices and store them at stabilization points

6: end for. MONTE CARLO RUN
7: for nbc = 1 to NBin do
8:

9:
10:
11:
12:
13:
14:

for nsw = 1 to NSweep do
if Tempering thencall Exchange_Step
end ifif Global_moves thencall Global_Updates
end if. Loop over bins. The bin defines the unit of Monte Carlo time
. Loop over sweeps. Each sweep updates twice (upward anddownward in imaginary time) the space-time lattice of auxiliary fields. Perform exchange step in a parallel tempering run. Perform chosen global updates

33

SciPost Phys. Codebases 1 (2022)

24:

if Langevin thencall Langevin_update
if Lτ == 1 thenif Projector thencall Tau_pelse
call Tau_m
end ifend ifend if (Langevin)25:

if Sequential then

15:
16:
17:
18:
19:
20:
21:
22:
23:

. UPDATE AND MEASURE equal-time observables. MEASURE time-displaced observables (projective code). MEASURE time-displaced observables (finite temperature). UPWARD SWEEP
26:
27:

for nτ = 1 to LTrotter docall Wrapgrup. PROPAGATE Green function from nτ − 1 to nτ , and computeits new estimate at nτ , using sequential updates

28:
29:

30:
31:
32:
33:
34:
35:
36:

if nτ == stabilization point in imaginary time then
. STABILIZE
call Wrapur. Propagate from previous stabilization point to nτ. Storage management:– Read from storage: propagation from LTrotter to nτ– Write to storage: the just computed propagation
call CGR. Recalculate the Green function at time nτ in a stable way
call Control_PrecisionG. Compare propagated and recalculated Greensend ifif nτ ∈ [Lobs_st, Lobs_en] thencall Obser
end ifend for. MEASURE the equal-time observables. DOWNWARD SWEEP
37:

for nτ = LTrotter to 1 do

. Same steps as for the upward sweep (propagation and estimate update, stabilization,equal-time measurements) now downwards in imaginary time

38:
39:
40:
41:
42:
43:

if Projector and Lτ == 1 andnτ = stabilization point in imaginary time andthe projection time θ is within the measurement interval thencall Tau_p. MEASURE time-displaced observables (projective code)end ifend for. MEASURE time-displaced observables (finite temperature)

44:
45:
46:
47:
48:

if Lτ == 1 and not Projector thencall Tau_m
end ifend if (Sequential)
end for (Sweeps)

call Pr_obs
call Nsigma%out
51: end for (Bins)
49:
50:. Calculate and write to disk measurement averages for the current bin. Write auxiliary field configuration to disk

34

SciPost Phys. Codebases 1 (2022)

5

Data Structures and Input/Output

To manipulate the relevant physical quantities in a general model, we define a set of appropriate data types. The Operator type (Sec. 5.1) is used to specify the interaction as well as
the hopping. The handling of the fields is taken care of by the Fields type (Sec. 5.2). To
define a Bravais lattice as well as a unit cell we introduce the Lattice and Unit_cell types(Sec. 5.3). General scalar, equal-time, and time-displaced correlation functions are handled by
the Observable type (Sec. 5.4). For the projective code, we provide a WaveFunction type(Sec. 5.5) to specify the left and right trial wave functions. The Hamiltonian is then specified
in the Hamiltonian module (Sec. 5.6), making use of the aforementioned types.

5.1

The Operator typeThe fundamental data structure in the code is the Operator. It is implemented as a Fortranderived data type designed to efficiently define the Hamiltonian (2).
Let the matrix X of dimension Ndim × Ndim stand for any of the typically sparse, Hermitianmatrices T (ks) , V (ks) and I (ks) that define the Hamiltonian. Furthermore, let {z1 , · · · , zN } denotethe subset of N indices such that6= 0 if x, y ∈ {z1 , · · · zN }.
(106)
X x, y=0otherwise
Usually, we have N  Ndim . We define the N × Ndim matrices P as
Pi,x = δzi ,x ,(107)

where i ∈ [1, · · · , N ] and x ∈ [1, · · · , Ndim ]. The matrix P selects the non-vanishing entries of
X , which are contained in the rank-N matrix O defined by:
X = P T OP ,and
X x, y =N
X

Pi,x Oi, j P j, y =

i, j

N
X

(108)

δzi ,x Oi j δz j , y .

(109)

i, j

Since the P matrices have only one non-vanishing entry per column, they can conveniently be
stored as a vector P, with entries
Pi = zi .
(110)
There are many useful identities which emerge from this structure. For example:
n
∞
T
X

P
OP
T
e X = e P OP == 1 + P T eO − 1 P ,
n!
n=0

(111)

since
P P T = 1N ×N .

(112)

In the code, we define a structure called Operator that makes use of the properties described above. This type Operator bundles the several components, listed in Tab. 2 and described in the remaining of this section, that are needed to define and use an operator matrix
in the program.
35

SciPost Phys. Codebases 1 (2022)

Table 2: Member variables of the Operator type. In the left column, the letter X isa placeholder for the letters T and V, indicating hopping and interaction operators,
respectively. The highlighted variables must be specified by the user. M_exp andE_exp are allocated only if type = 1, 2.
VariableType

Description

Op_X%N
Op_X%O
Op_X%P
Op_X%g
Op_X%alpha
Op_X%type

int
cmplx
int
cmplx
cmplx
int

Op_X%diag
Op_X%U
Op_X%E
Op_X%N_non_zero
Op_X%M_exp
Op_X%E_exp

logical
cmplx
dble
int
cmplx
cmplx

Effective dimension N
Matrix O of dimension N × N
Matrix P encoded as a vector of dimension N
Coupling strength gConstant α
Sets the type of HS transformation (1: Ising; 2: discrete
HS for perfect-square term; 3: continuous real field)
True if O is diagonal
Matrix containing the eigenvectors of O
Eigenvalues of O
Number of non-vanishing eigenvalues of O
Stores M_exp(:, :, s) = e gφ(s,type)O(:,:)
Stores E_exp(:, s) = e gφ(s,type)E(:)

5.2

Handling of the fields: the Fields type

The partition function (see Sec. 2.1) consists of terms which, in general, can be written as
γe gφX , where X denotes an arbitrary operator, g is a constant, and γ and φ are fields. ALF
includes three different types of fields:

t=1 This type is for an Ising field, therefore γ = 1 and φ = ±1,
t=2 This type is for the generic HS transformation of Eq. (11) where γ ≡ γ(l) and φ = η(l)with l = ±1, ±2 [see Eq. (12)],

t=3 This type is for continuous fields, i.e., γ = 1 and φ ∈ R.
For such auxiliary fields a dedicated type Fields is defined, whose components, listed in
Tab. 3, include the variables Field%f and Field%t, which store the field values and types,
respectively, and functions such as Field%flip, which flips the field values randomly. Before using this variable type, the routine Fields_init(Amplitude) should be called [itsargument is optional and the default value is of unity (see Sec. 2.2.1)], in order for internalvariables such as η(l) and γ(l) [see Eq. (12)] to be initialized.

5.3

The Lattice and Unit_cell types

ALF’s lattice module can generate one- and two-dimensional Bravais lattices. Both the lattice
and the unit cell are defined in the module Lattices_v3_mod.F90 and their components
are detailed in Tabs. 4 and 5. As its name suggests the module Predefined_Latt_mod.F90
provides predefined lattices as described in Sec. 8.1. The user who wishes to define their own
lattice has to specify: 1) unit vectors a1 and a2 , 2) the size and shape of the lattice, characterized by the vectors L1 and L2 and 3) the unit cell characterized be the number of orbitals
and their positions. The coordination number of the lattice is specified in the Unit_cell data
type. The lattice is placed on a torus (periodic boundary conditions):ĉi+L1 = ĉi+L2 = ĉi .
36

(113)

SciPost Phys. Codebases 1 (2022)

Table 3: Components of a variable of type Fields named Field. The routine
Fields_init(del) should be called before the use of this variable type, since itinitializes necessary internal variables such as η(l), γ(l) [see Eq. (12)]. Note thatdel and amplitude are private variables of the fields module. The integers n_op
and Ltrot are the number of interacting operators per time slice and time slices,
respectively, Group_Comm (integer) is an MPI communicator defined by the main
program, and the optional In_field stores the initial field configuration.

Component

Description

VariableType

Field%t(1:n_op)

int

Field%f(1:n_op,
1:Ltrot)delamplitude

Sets the HS transformation type (1: Ising; 2: discrete HSfor perfect-square term; 3: continuous real field). The index
runs through the operator sequence
dble Defines the auxiliary fields. The first index runs through theoperator sequence and the second through the time slices.
For t=1, f = ±1; for t=2, f = ±1, ±2; and for t=3, f ∈ R
dble Width ∆x of box distribution for initial t=3 fields, with adefault value of 1
dble Random flip width for fields of type t=3, defaults to 1

Method(arguments)

Field%make(n_op,Ltrot)
Field%clear()
Field%set()Field%flip(n,nt)

Field%phi(n,nt)
Field%gamma(n,nt)
Field%i(n,nt)
Field%in(Group_Comm,
In_field)

Field%out(Group_Comm)

Reserves memory for the field
Clears field from memory
Sets a random configuration
Flips the field values randomly for field n on time slice nt.
For t=1 it flips the sign of the Ising spin. For t=2 it randomly
choose one of the three other values of l. For t=3, f = f +amplitude*(ranf() -1/2)
Returns φ for the n-th operator at the time slice nt
Returns γ for the n-th operator at the time slice nt
Returns Field%f rounded to nearest integer (if t=1 or 2)
If the file confin_np exists it reads the field configurationfrom this file. Otherwise if In_field is present it sets thefields to In_field. If both confin_np and In_field are
not provided it sets a random field by calling Field%set().
Here np is the rank number of the process
Writes out the field configuration

The function call
Call Make_Lattice( L1, L2, a1, a2, Latt )generates the lattice Latt of type Lattice. The reciprocal lattice vectors g j are defined by:
a i · g j = 2πδi, j ,and the Brillouin zone BZ corresponds to the Wigner-Seitz cell of the lattice. With k =the k-space quantization follows from:

 
 
L1 · g1 L1 · g2 α1n= 2π,
L2 · g1 L2 · g2 α2
m
37

(114)
P

i αi gi ,(115)

SciPost Phys. Codebases 1 (2022)

such thatk = nb1 + mb2 , with
2π[(L2 · g2 )g1 − (L2 · g1 )g2 ] ,(L1 · g1 )(L2 · g2 ) − (L1 · g2 )(L2 · g1 )2π[(L1 · g1 )g2 − (L1 · g2 )g1 ] .
b2 =(L1 · g1 )(L2 · g2 ) − (L1 · g2 )(L2 · g1 )

(116)

b1 =

(117)

The Lattice module also handles the Fourier transformation. For example, the subroutine Fourier_R_to_K carries out the transformation:
X
1
S(k, :, :, :) =e−ik·(i− j ) S(i − j, :, :, :)(118)
Nunit-cell i, j
and Fourier_K_to_R the inverse Fourier transform
X
1
S(r , :, :, :) =e ik·r S(k, :, :, :) .
Nunit-cell k∈BZ

(119)

In the above, the unspecified dimensions of the structure factor can refer to imaginary-timeand orbital indices.
The position of an orbital i is given by Ri + δi . Ri is a point of the Bravais lattice thatdefines a unit cell, and δi labels the orbital in the unit cell. This information is stored in thearray Unit_cell%Orb_pos detailed in Tab. 5.
Table 4: Components of the Lattice type for two-dimensional lattices using as
example the default lattice name Latt. The highlighted variables must be specified by the user. Other components of Lattice are generated upon calling: Call
Make_Lattice(L1, L2, a1, a2, Latt).
VariableType Description

Latt%a1_p, Latt%a2_p
Latt%L1_p, Latt%L2_p

dble Unit vectors a1 , a2
dble Vectors L1 , L2 that define the topology of the lattice.

Latt%N
Latt%list

int Number of lattice points, Nunit-cellint Maps each lattice point i = 1, · · · , Nunit-cell to a real

Latt%invlist
Latt%nnlist
Latt%imj
Latt%BZ1_p, Latt%BZ2_p
Latt%b1_p, Latt%b2_p
Latt%listk
Latt%invlistk
Latt%b1_perp_p,
Latt%b2_perp_p

Tilted lattices are thereby possible to implement

space vector denoting the position of the unit cell:
Ri = list(i,1)a1 + list(i,2)a2 ≡ i1 a1 + i2 a2
int Return lattice point from position: Invlist(i1 , i2 ) = i
int Nearest neighbor indices: j = nnlist(i, n1 , n2 ),n1 , n2 ∈ [−1, 1], R j = Ri + n1 a1 + n2 a2
int Rimj(i, j) = Ri − R j , with imj, i, j ∈ 1, · · · , Nunit-celldble Reciprocal space vectors gi [See Eq. (114)]
dble k-quantization [See Eq. (117)]
int Maps each reciprocal lattice point k = 1, · · · , Nunit-cellto a reciprocal space vectork k = listk(k,1) b1 + listk(k,2) b2 ≡ k1 b1 + k2 b2
int Invlistk(k1 , k2 ) = k

dble Orthonormal vectors to bi (for internal use)

38

SciPost Phys. Codebases 1 (2022)

Table 5: Components of an instance Latt_unit of the Unit_cell type. The highlighted variables have to be specified by the user. Note that for bilayer lattices thesecond index of the Orb_pos array ranges from 1 to 3.
VariableType

Description

Norb
N_coordOrb_pos(1..Norb,2[3])int Number of orbitals
int Coordination number
dble Orbitals’ positions, measured from the lattice site

The total number of orbitals is then given by Ndim=Lattice%N*Unit_cell%Norb. To
keep track of the orbital and unit cell structure, it is useful to define arrays List(Ndim,2)and Inv_list(Latt%N, Unit_cell%Norb). For a superindex x = (i, n) labeling the unit
cell, i, and the orbital, n, of a site on the lattice, we have List(x,1)=i, List(x,2)=n and
Inv_list(i,n)=x.

5.4

The observable types Obser_Vec and Obser_LattOur definition of the model includes observables [Eq. (27)]. We define two observable types:
Obser_vec for an array of scalar observables such as the energy, and Obser_Latt for correlation functions that have the lattice symmetry. In the latter case, translation symmetry canbe used to provide improved estimators and to reduce the size of the output. We also obtain improved estimators by taking measurements in the imaginary-time interval [LOBS_ST, LOBS_EN](see the parameter file in Sec. 5.7.1) thereby exploiting the invariance under translation in
imaginary-time. Note that the translation symmetries in space and in time are broken for agiven configuration C but restored by the Monte Carlo sampling. In general, the user defines
size and number of bins in the parameter file, each bin containing a given amount of sweeps.
Within a sweep we run sequentially through the HS and bosonic fields, from time slice 1 totime slice LTrotter and back. The results of each bin are written to a file and analyzed at theend of the run.
To accomplish the reweighting of observables (see Sec. 2.1.3), for each configuration themeasured value of an observable is multiplied by the factors ZS and ZP:

ZS = sgn(C) ,
ZP =

(120)

e−S(C)
.
Re e−S(C)(121)

They are computed from the Monte Carlo phase of a configuration,phase =e−S(C)e−S(C),(122)

which is provided by the main program. Note that each observable structure also includes theaverage sign [Eq. (28)].
5.4.1

Scalar observables

Scalar observables are stored in the data type Obser_vec, described in Tab. 6. Consider a variable Obs of type Obser_vec. At the beginning of each bin, a call to Obser_Vec_Init in themoduleobservables_mod.F90 will set Obs%N=0,
Obs%Ave_sign=0 and
Obs%Obs_vec(:)=0. Each time the main program calls the routine Obser in the39

SciPost Phys. Codebases 1 (2022)

Hamiltonian module, the counter Obs%N is incremented by one, the sign [see Eq. (26)]is accumulated in the variable Obs%Ave_sign, and the desired observables (multiplied by the−S(C)sign and Ree e−S(C) , see Sec. 2.1.2) are accumulated in the vector Obs%Obs_vec. At the end of][
Table 6: Components of a variable of type Obser_vec. The contribution listed isthat of each configuration C.
VariableType

Description

Contribution

N
Ave_sign
Obs_vec(:)

int
Number of measurements+1
dble Cumulated average sign [Eq. (28)]sgn(C)−S(C)cmplx Cumulated vector of observables 〈〈Ô(:)〉〉C Re[e e−S(C) ] sgn(C)File_Vec
analysis_mode

char
char

[Eq. (27)]Name of output file
How to analyze the observable
Default value: "identity"
Optional description.
Arbitrarynumber of 64-character lines

description(:) charthe bin, a call to Print_bin_Vec in module observables_mod.F90 will append the resultof the bin in the file File_Vec_scal. Note that this subroutine will automatically append thesuffix _scal to the the filename File_Vec. This suffix is important to facilitate automatic analyses of the data at the end of the run. Furthermore, the file File_Vec_scal_info is created (ifit does not exist yet), which contains a string that specifies how to analyze the observable andan optional description.
5.4.2

Equal-time and time-displaced correlation functions

The data type Obser_latt (see Tab. 7) is useful for dealing with both equal-time and imaginary time-displaced correlation functions of the form:
Sα,β (k, τ) =1

X

Nunit-cell i, je−ik·(i− j ) 〈Ôi,α (τ)Ô j,β 〉 − 〈Ôi,α 〉〈Ô j ,β 〉 ,(123)where α and β are orbital indices and i and j lattice positions. Here, translation symmetry of
the Bravais lattice is explicitly taken into account. The correlation function splits in a correlated(corr)(back)
part Sα,β (k, τ) and a background part Sα,β (k):(corr)

Sα,β (k, τ) =(back)

Sα,β

(k) =

1

X

Nunit-cell i, j
X
1
Nunit-cell i, je−ik·(i− j) 〈Ôi,α (τ)Ô j ,β 〉 ,(124)

e−ik·(i− j) 〈Ôi,α 〉〈Ô j,β 〉(125)= Nunit-cell 〈Ôα 〉〈Ôβ 〉 δ(k) ,where translation invariance in space and time has been exploited to obtain the last line. The
background part depends only on the expectation value 〈Ôα 〉, for which we use the following
estimatorX
1〈Ôα 〉 ≡〈Ôi,α 〉 .
(126)
Nunit-cell i40

SciPost Phys. Codebases 1 (2022)

Table 7: Components of a variable of type Obser_latt named Obs. Be aware:
The types marked with asterisks, ∗, are actually pointers, i.e., when the subroutine
Obser_Latt_make creates an observable Obs, the variables Latt and Latt_unit
do not get copied but linked, meaning modifying them after the creation of Obs stillaffects the observable.
Variable

Type

Obs%N
int
Obs%Ave_sign
dble
Obs%Obs_latt(i - j , cmplx
τ, α, βObs%Obs_latt0(α) cmplx
Obs%File_Latt
Obs%Latt
Obs%Latt_unit
Obs%dtau
Obs%ChannelcharLattice∗
Unit_cell∗
dble
char

Description

Contribution

Number of measurements
Cumulated sign [Eq. (28)]
Cumulated correlation function [Eq. (27)]+1
sgn(C)〈〈Ôi,α (τ)Ô j ,β 〉〉C ×

Cumulated expected value[Eq. (27)]〈〈Ôi,α 〉〉C ×

Name of output file
Bravais lattice [Tab. 4]
Unit cell [Tab. 5]
Imaginary time step
Channel for Maximum Entropye−S(C)
sgn(C)
Re[e−S(C) ]e−S(C)
sgn(C)
Re[e−S(C) ]Consider a variable Obs of type Obser_latt. At the beginning of each bin a call to
Obser_Latt_Init in the module observables_mod.F90 will initialize the elements of
Obs to zero. Each time the main program calls the Obser or ObserT routines one accumu−S(C)−S(C)
lates 〈〈Ôi,α (τ)Ô j,β 〉〉C Ree e−S(C) sgn(C) in Obs%Obs_latt(i − j , τ, α, β ) and 〈〈Ôi,α 〉〉C Ree e−S(C) ·[][]sgn(C) in Obs%Obs_latt0(α). At the end of each bin, a call to Print_bin_Latt in the module observables_mod.F90 will append the result of the bin in the specified file
Obs%File_Latt. Note that the routine Print_bin_Latt carries out the Fourier transformation and prints the results in k-space. We have adopted the following naming conventions. For
equal-time observables, defined by having the second dimension of the array
Obs%Obs_latt(i − j , τ, α, β ) set to unity, the routine Print_bin_Latt attaches the suffix _eq to Obs%File_Latt. For time-displaced correlation functions we use the suffix _tau.
Furthermore, Print_bin_Latt will create a corresponding info file with suffix _eq_info or_tau_info, if not already present. The info file contains the channel, number of imaginary time
steps, length of one imaginary time step, unit cell and the vectors defining the Bravais lattice.

5.5

The WaveFunction type

The projective algorithm (Sec. 3) requires a pair of trial wave functions, |Ψ T,L/R 〉, for which
there is the dedicated WaveFunction type, defined in the module WaveFunction_mod as
described in Tab. 8.
The module WaveFunction_mod also includes the routine WF_overlap(WF_L, WF_R,
Z_norm) for normalizing the right trial wave function WF_R by the factor Z_norm, such that〈Ψ T,L |Ψ T,R 〉 = 1.

41

SciPost Phys. Codebases 1 (2022)

Table 8: Components of a variable of type WaveFunction named WF.
VariableTy pe

Description

WF%P(:,:) cmplx P is an Ndim × N_part matrix, where N_part is the number of particles
WF%Degen dble It stores the energy difference between the last occupied and first unoccupied single particle state and can be used to check for degeneracy

5.6

Specification of the Hamiltonian: the Hamiltonian module

The modules Hamiltonian in the directory $ALF_DIR/Prog/Hamiltonians define specificHamiltonians. This module must contain a set of subroutines that define the lattice, the hopping, the interaction, the observables, the trial wave function, and optionally updating schemes(see Sec. 2.2). In order to implement a user-defined model, only the module Hamiltonian
has to be set up. Accordingly, this documentation focuses almost entirely on this module andthe subprograms it includes. The remaining parts of the code may hence be treated as a blackbox. The mandatory elements of the Hamiltonian module are defined in Tab. 9. To simplify the
implementation of a new Hamiltonian, ALF comes with a set of predefined structures (Sec. 8)
which the user can combine together or use as templates.
In order to specify a Hamiltonian,
we have to set the matrix representation of the imaginaryp(ks)−∆τT (ks)−∆τUk ηkτ V (ks)time propagators, e,e
and e−∆τskτ I , that appear in the partition function (17). For each pair of indices (k, s), these terms have the general form
Matrix Exponential = e g φ(type) X .

(127)

In case of the perfect-square term, we additionally have to set the constant α, see the definitionof the operators V̂ (k) in Eq. (4). The data structures which hold all the above information arevariables of the type Operator (see Tab. 2). For each pair of indices (k, s), we store thefollowing parameters in an Operator variable:• P and O defining the matrix X [see Eq. (108)],• the constants g, α,• optionally: the type type of the discrete fields φ.
The latter parameter can take one of three values: Ising (1), discrete HS (2), and real (3), as
detailed in Sec. 5.2. Note that we have dropped the color index σ, since the implementation
uses the SU(Ncol ) invariance of the Hamiltonian.
Accordingly, the following data structures fully describe the Hamiltonian (2):• For the hopping Hamiltonian (3), we have to set the exponentiated hopping matrices(ks)e−∆τT :In this case X (ks) = T (ks) , and a single variable Op_T describes the operator matrix
N
dim
X

ĉ †xs Tx(ks)y ĉ ys


,

(128)

x, y

where k = [1, M T ] and s = [1, Nfl ]. In the notation of the general expression (127), we
set g = −∆τ (and α = 0). In case of the hopping matrix, the type variable takes its
default value Op_T%type = 0. All in all, the corresponding array of structure variables
is Op_T(M T ,Nfl ).
42

SciPost Phys. Codebases 1 (2022)

Table 9: Overview of the subprograms of the module Hamiltonian, contained in the
Hamiltonian files used to define various Hamiltonians. The highlighted subroutines
may have to be modified by the user.
Subprogram

Description

Section

Ham_Set5.6, 9

Alloc_obs
Obser

Reads in model and lattice parameters from the fileparameters. Sets the Hamiltonian calling the necessary subprograms: Ham_Latt, Ham_Hop, Ham_V
and Ham_Trial
Sets the Lattice and the Unit_cell as well as thethe arrays List and Inv_list required for multiorbital problems
Sets the hopping term Ĥ T (i.e., operator Op_T) by
calling Op_make and Op_set
Sets the interaction term ĤV (i.e., operator Op_V) by
calling Op_make and Op_set
Sets the trial wave function for the projective code|Ψ T,L/R 〉 specified by the Wavefunction type
Assigns memory storage to the observable
Computes the scalar and equal-time observables

ObserT

Computes time-displaced correlation functions

S0
Global_move_tau

Returns the ratio eS0 (C ) /e−S0 (C) for a single spin flip
Generates a global move on a given time slice τ. Thisroutine is only called if Global_tau_moves=Trueand N_Global_tau>0
Allows setting global_tau parameters at run time

Ham_Latt
Ham_hop
Ham_V
Ham_Trial

Overide_global_tau_
sampling_parameters
Hamiltonian_
set_nsigma
Global_move
Delta_S0_global
Init_obs
Pr_obs0

Sets the initial field configuration. This routine is tobe modified if one wants to specify the initial configuration. By default the initial configuration is assumed
to be random
Handles global moves in time and space0Computes eS0 (C ) /e−S0 (C) for a global move
Initializes the observables to zero
Writes the observables to disk by calling Print_binof the Observables module

5.3, 7.2 8.1

5.1,
7.3,
8.2
5.1,
7.4,
8.3
5.5,
7.5,
8.5
5.4 , 7.6.1
5.4, 7.6.2,
8.4
5.4, 7.6.3,
8.4
2.2.2
2.2.3

2.2.3

2.2.4
2.2.4

• For the interaction Hamiltonian(4), which is of perfect-square type, we have to set thep(ks)exponentiated matrices e −∆τUk ηkτ V :In this case, X = V (ks) and a single variable Op_V describes the operator matrix:
N


dim
X
†
(ks)
ĉ xs Vx, y ĉ ys + αks ,
(129)
x, y

p
where k = [1, MV ] and s = [1, Nfl ], g = −∆τUk and α = αks . The discrete HS
decomposition which is used for the perfect-square interaction, is selected by setting thetype variable to Op_V%type = 2. All in all, the required structure variables Op_V aredefined using the array Op_V(MV ,Nfl ).
43

SciPost Phys. Codebases 1 (2022)• For the bosonic interaction Hamiltonian (5), we have to set the exponentiated matrices(ks)e−∆τskτ I :In this case, X = I (k,s) and a single variable Op_V then describes the operator matrix:
N
dim
X

ĉ †xs I x(ks)y ĉ ys


,

(130)

x, y

where k = [1, M I ] and s = [1, Nfl ] and g = −∆τ (and α = 0). It this operator couples
to an Ising field, we specify the type variable Op_V%type=1. On the other hand, if itcouples to a scalar field (i.e. real numbers) then we specify Op_V%type=3. All in all,the required structure variables are contained in the array Op_V(M I ,Nfl ).
• In case of a full interaction [perfect-square term (4) and bosonic term (5)], we define
the corresponding doubled array Op_V(MV +M I ,Nfl ) and set the variables separately forboth ranges of the array according to the above.

5.7

File structure
Table 10: Overview of the directories included in the ALF package.

Directory

Description

Prog/
Libraries/
Analysis/
Scripts_and_Parameters_
files/
Documentation/
Mathematica/

Main program and subroutines
Collection of mathematical routines
Routines for error analysis
Helper scripts and the Start/ directory, which contains the files required to start a run
This documentation
Mathematica notebooks to evaluate higher order correlation functions with Wicks theorem
An automatic test suite for various parts of the code

testsuite/

The code package, summarized in Tab. 10, consists of the program directories Prog/,
Libraries/, Analysis/, and the directory Scripts_and_Parameters_files/, whichcontains supporting scripts and, in its subdirectory Start, the input files necessary for a run,described in the Sec. 5.7.1 as well as Mathematica/ that contains Mathematica notebooks toevaluate higher order correlation functions with Wick’s theorem as described in Appendix A.
The routines available in the directory Analysis/ are described in Sec. 6.3, and the testsuitein Sec. 6.2.
Below we describe the structure of ALF’s input and output files. Notice that the input/output files for the Analysis routines are described in Sec. 6.3.
5.7.1

Input files

The package’s two input files are described in Tab. 11. The parameter file Start/parameters
has the following form – using as an example the Hubbard model on a square lattice (seeSec. 9.1 for the general SU(N) Hubbard and Sec. 7 for a detailed walk-through on its plain
vanilla version):

44

SciPost Phys. Codebases 1 (2022)

Table 11: Overview of the input files required for a simulation, which can be foundin the subdirectory Scripts_and_Parameters_files/Start/.
File

Description

parameters Sets the parameters for: lattice, model, QMC process, and error analysis
seeds
List of integer numbers to initialize the random number generator andto start a simulation from scratch!========================================================! Input variables for a general ALF run!-------------------------------------------------------&VAR_lattice
L1
= 6
L2
= 6
Lattice_type = "Square"Model= "Hubbard"/&VAR_Model_Generic
Checkerboard = .T.
Symm
= .T.
N_SUN
= 2
N_FL
= 1
Phi_X
= 0.d0Phi_Y= 0.d0

Bulk

= .T.

N_Phi
Dtau
Beta
Projector
Theta
/

= 0
= 0.1d0= 5.d0= .F.
= 10.d0&VAR_QMC
Nwrap
NSweep
NBin
Ltau
LOBS_ST
LOBS_EN
CPU_MAX
Propose_S0
Global_moves
N_GlobalGlobal_tau_moves
N_Global_tau!! Parameters defining the specific lattice and base! model! Length in direction a_1! Length in direction a_2! Sets a_1 = (1,0), a_2=(0,1), Norb=1, N_coord=2! Sets the Hubbard model, to be specified in! &VAR_Hubbard!! Common model parameters! Whether checkerboard decomposition is used
! Whether symmetrization takes place! Number of colors! Number of flavors! Twist along the L_1 direction, in units of the flux
! quanta! Twist along the L_2 direction, in units of the flux
! quanta! Twist as a vector potential (.T.); at the boundary! (.F.)! Total number of flux quanta traversing the lattice! Thereby Ltrot=Beta/dtau! Inverse temperature! Whether the projective algorithm is used
! Projection parameter!! Variables for the QMC run! Stabilization. Green functions will be computed from! scratch after each time interval Nwrap*Dtau= 20 ! Number of sweeps= 5! Number of bins
= 1
! 1 to calculate time-displaced Green functions;! 0 otherwise= 0! Start measurements at time slice LOBS_ST= 0! End measurements at time slice LOBS_EN= 0.0 ! Code stops after CPU_MAX hours, if 0 or not! specified, the code stops after Nbin bins
= .F. ! Proposes single spin flip moves with probability! exp(-S0)= .F. ! Allows for global moves in space and time
= 1
! Number of global moves per sweep= .F. ! Allows for global moves on a single time slice.
= 1! Number of global moves that will be carried out on a
! single time slice
= 10

45

SciPost Phys. Codebases 1 (2022)

Nt_sequential_start! One can combine sequential & global moves on a
! time slice
Nt_sequential_end= -1 ! The program then carries out sequential local moves! in the range [Nt_sequential_start,Nt_sequential_end]! followed by N_Global_tau global moves
Langevin= .F. ! Langevin update
Delta_t_Langevin_HMC = 0.01 ! Default time step for Langevin and HMC updates
Max_Force= 1.5 ! Max Force for Langevin/&VAR_errors
n_skip = 1
N_rebin = 1
N_Cov = 0
N_autoN_Back

= 0
= 1

/

= 0

!! Variables for analysis programs! Number of bins that to be skipped! Rebinning! If set to 1 covariance computed for non-equal-time! correlation functions! If > 0 triggers calculation of autocorrelation! If set to 1, substract background in correlation! functions&VAR_TEMP!! Variables for parallel tempering
N_exchange_steps= 6! Number of exchange moves [see Eq. (39)]
N_Tempering_frequency = 10 ! The frequency in units of sweeps at which the! exchange moves are carried out
mpi_per_parameter_set = 2 ! Number of mpi-processes per parameter set
Tempering_calc_det= .T. ! Specifies whether the fermion weight has to be taken! into account while tempering. The default is .true.,! and it can be set to .F. if the parameters that! get varied only enter the free bosonic action S_0/&VAR_Max_Stoch
Ngamma= 400
Om_st= -10.d0
Om_en= 10.d0
NDis= 2000Nbins= 250
Nsweeps
= 70
NWarm
= 20
N_alpha= 14
alpha_st = 1.d0
R
= 1.2d0
Checkpoint = .F.
Tolerance = 0.1d0/&VAR_Hubbard
Mz
= .T.

Continuous = .F.
ham_T= 1.d0ham_chem = 0.d0
ham_U
= 4.d0
ham_T2= 1.d0ham_U2= 4.d0
ham_Tperp = 1.d0/!! Variables for Stochastic Maximum entropy! Number of Dirac delta-functions for parametrization! Frequency range lower bound! Frequency range upper bound! Number of boxes for histogram! Number of bins for Monte Carlo! Number of sweeps per bin! The Nwarm first bins will be ommitted! Number of temperatures! Smallest inverse temperature increment for inverse! temperature (see above)! Whether to produce dump files, allowing the! simulation! to be resumed later on! Data points for which the relative error exceeds the! tolerance threshold will be omitted.
!! Variables for the specific model! When true, sets the M_z-Hubbard model: Nf=2, demands! that N_sun is even, HS field couples to the! z-component of magnetization; otherwise, HS field! couples to the density! Uses (T: continuous; F: discrete) HS transformation! Hopping parameter! Chemical potential! Hubbard interaction! For bilayer systems! For bilayer systems! For bilayer systems

46

SciPost Phys. Codebases 1 (2022)

The program allows for a number of different updating schemes. If no other variables are
specified in the VAR_QMC name space, then the program will run in its default mode, namely
the sequential single spin-flip mode. In particular, note that if Nt_sequential_start and
Nt_sequential_end are not specified and that the variable Global_tau_moves is set totrue, then the program will carry out only global moves, by setting Nt_sequential_start=1
and Nt_sequential_end=0.
5.7.2

Output files – observables

The standard output files are listed in Tab. 12. Notice that, besides these files, which containdirect QMC outputs, ALF can also produce a number of analysis output files, discussed inSec. 6.3.
The output of the measured data is organized in bins. One bin corresponds to the arithmetic average over a fixed number of individual measurements which depends on the chosenmeasurement interval [LOBS_ST,LOBS_EN] on the imaginary-time axis and on the number
NSweep of Monte Carlo sweeps. If the user runs an MPI parallelized version of the code, theaverage also extends over the number of MPI threads.
Table 12: Overview of the standard output files. See Sec. 5.4 for the definitions ofobservables and correlation functions.
File

Description

info

After completion of the simulation, this file documents the parameters of the model, as well as the QMC run and simulation
metrics (precision, acceptance rate, wallclock time)
Results of equal-time measurements of scalar observables
The placeholder X stands for the observables Kin, Pot, Part,and Ener
Contains info on how to analyze the observable and optionallya description.
Results of equal-time and time-displaced measurements of correlation functions. The placeholder Y stands for Green, SpinZ,
SpinXY, Den, etc.
Additional info, like Bravais lattice and unit cell, for equal-timeand time-displaced observables
Output files (one per MPI instance) for the HS and bosonic configuration

X_scalX_scal_info
Y_eq,Y_tau
Y_eq_info,Y_tau_info
confout_<threadnumber>

The formatting of a single bin’s output depends on the observable type, Obs_vec or Obs_
Latt:
• Observables of type Obs_vec: For each additional bin, a single new line is added to the
output file. In case of an observable with N_size components, the formatting is

N_size+1 <measured value, 1>...<measured value, N_size> <measured sign>
The counter variable N_size+1 refers to the number of measurements per line, including the phase measurement. This format is required by the error analysis routine (seeSec. 6.3). Scalar observables like kinetic energy, potential energy, total energy and particle number are treated as a vector of size N_size=1.

47

SciPost Phys. Codebases 1 (2022)• Observables of type Obs_Latt: For each additional bin, a new data block is added tothe output file. The block consists of the expectation values [Eq. (126)] contributing
to the background part [Eq. (125)] of the correlation function, and the correlated part[Eq. (124)] of the correlation function. For imaginary-time displaced correlation functions, the formatting of the block is given by:<measured sign> <N_orbital> <N_unit_cell> <N_time_slices> <dtau> <Channel>
do alpha = 1, N_orbital〈Ôα 〉

enddo
do i = 1, N_unit_cell<reciprocal lattice vector k(i)>do tau = 1, N_time_slices
do alpha = 1, N_orbital
do beta = 1, N_orbital(corr)〈Sα,β (k(i), τ)〉

enddo
enddo
enddo
enddo

The same block structure is used for equal-time correlation functions, except for theentries <N_time_slices> , <dtau> and <Channel> , which are then omitted. Using
this structure for the bins as input, the full correlation function Sα,β (k, τ) [Eq. (123)] isthen calculated by calling the error analysis routine (see Sec. 6.3).

6Using the CodeIn this section we describe the steps for compiling and running the code from the shell, anddescribe how to search for optimal parameter values as well as how to perform the error
analysis of the data.
The source code of ALF 2.0 is available at https://git.physik.uni-wuerzburg.de/ALF/ALF/-/tree/ALF-2.0 and can be cloned with git or downloaded from the repository (make sure tochoose the appropriate release, 2.0).
A Python interface, pyALF, is also available and can be found, together with a number ofJupyter notebooks exploring the interface’s capabilities, at https://git.physik.uni-wuerzburg.
de/ALF/pyALF/-/tree/ALF-2.0/. This interface facilitates setting up simple runs and is ideal
for setting benchmarks and getting acquainted with ALF. Some of pyALF’s notebooks form thecore of the introductory part of the ALF Tutorial, where pyALF’s usage is described in moredetail.
We start out by providing step-by-step instructions that allow a first-time user to go fromzero to performing a simulation and reading out their first measurement using ALF.

6.1

Zeroth step

The aim of this section is to provide a fruitful and stress-free first contact with the package.
Ideally, it should be possible to copy and paste the instructions below to a Debian/Ubuntubased Linux shell without further thought6 . Explanations and further options and details arefound in the remaining sections and in the Tutorial.
6

For other systems and distributions see the package’s README.

48

SciPost Phys. Codebases 1 (2022)

Prerequisites: You should have access to a shell and the permissions to install – or havealready installed – the numerical packages Lapack and Blas, a Fortran compiler and the tools
make and git.
The following commands can be executed in a Debian-based shell in order to install ALF
2.0 and its dependencies, run a demonstration simulation and output one of the measurements
performed:
•
•
•
•
•
•
•
•
•

sudo apt-get install gfortran liblapack-dev make git
git clone -b ALF-2.0 https://git.physik.uni-wuerzburg.de/ALF/ALF.git
cd ALFsource configure.sh GNU noMPI
make Hubbard_Plain_Vanilla ana
cp -r ./Scripts_and_Parameters_files/Start ./Run && cd ./Run/$ALF_DIR/Prog/Hubbard_Plain_Vanilla.out$ALF_DIR/Analysis/ana.out Ener_scal
cat Ener_scalJ

The last command will output a few lines, including one similar to:

OBS :

1

-30.009191

0.110961

which is listing the internal energy of the system and its error.

6.2

Compiling and running

The necessary environment variables and the directives for compiling the code are set by the
script configure.sh:source configure.sh [MACHINE] [MODE] [STAB]
If run with no arguments, it lists the available options and sets a generic, serial GNU compiler with minimal flags -cpp -O3 -ffree-line-length-none -ffast-math. The predefined machine configurations and parallelization modes available, as well as the options forstabilization schemes for the matrix multiplications (see Sec. 2.4) are shown Tab. 13. The
stabilization scheme choice, in particular, is critical for performance and is discussed further
in Sec. 6.4.
In order to compile the libraries, the analysis routines and the QMC program at once, justexecute the single command:

make
Related auxiliary directories, object files and executables can be removed by executing thecommand make clean. The accompanying Makefile also provides rules for compilingand cleaning up the library, the analysis routines and the QMC program separately.
A suite of tests for individual parts of the code (subroutines, functions, operations, etc.)
is available at the directory testsuite. The tests can be run by executing the following
sequence of commands (the script configure.sh sets environment variables as describedabove):

source configure.sh Devel serial
gfortran -v
make lib
49

SciPost Phys. Codebases 1 (2022)

make anamake Examples
cd testsuite
cmake -E make_directory tests
cd tests
cmake -G "Unix Makefiles" -DCMAKE_Fortran_FLAGS_RELEASE=${F90OPTFLAGS} \-DCMAKE_BUILD_TYPE=RELEASE ..
cmake --build . --target all --config Release
ctest -VV -O log.txt
which will output test results and total success rate.
Table 13: Available arguments for the script configure.sh, called before compilation of the package: predefined machines, parallelization modes, and stabilization
schemes (see also Sec. 6.4).
Argument

Selected feature

MACHINE
GNU
Intel
PGI
SuperMUC-NG
JUWELS
Development

GNU compiler (gfortran or mpifort) for a generic machine (default)Intel compiler (ifort or mpiifort) for a generic machine7
PGI compiler (pgfortran or mpifort) for a generic machineIntel compiler (mpiifort) and loads modules for SuperMUC-NG8Intel compiler (mpiifort) and loads modules for JUWELS9
GNU compiler (gfortran or mpifort) with debugging flags

MODE
noMPI|Serial No parallelization
MPI
MPI parallelization (default – if a machine is selected)
Tempering
Parallel tempering (Sec. 2.2.5) and the required MPI as well
STAB
STAB1
STAB2
STAB3
LOG

Simplest stabilization, with UDV (QR-, not SVD-based) decompositions
QR-based UDV decompositions with additional normalizations
Newest scheme, additionally separates large and small scales (default)
Log storage for internal scales, increases accessible ranges

Starting a simulation
In order to start a simulation from scratch, the following files have to be present: parametersand seeds (see Sec. 5.7.1). To run serially the simulation for a given model, for instance theplain vanilla Hubbard model included in Hamiltonian_Hubbard_Plain_Vanilla_mod.F90,
described in Sec. 9.1, issue the command
A known issue with the alternative Intel Fortran compiler ifort is the handling of automatic, temporary arrays
which ifort allocates on the stack. For large system sizes and/or low temperatures this may lead to a runtime
error. One solution is to demand allocation of arrays above a certain size on the heap instead of the stack. Thisis accomplished by the ifort compiler flag -heap-arrays [n] where [n] is the minimal size (in kilobytes, forexample n=1024) of arrays that are allocated on the heap.
8Supercomputer at the Leibniz Supercomputing Centre.
9Supercomputer at the Jülich Supercomputing Centre.
750

SciPost Phys. Codebases 1 (2022)./Prog/Hubbard_Plain_Vanilla.out
In order to run a different model, the corresponding executable should be used and, for running with parallelization, the appropriate MPI execution command should be called. For instance, a Kondo model (Sec. 9.3) compiled with OpenMPI can be run in parallel by issuingorterun -np <number of processes> $ALF_DIR/Prog/Kondo_Honey.out
To restart the code using the configuration from a previous simulation as a starting point,
first run the script out_to_in.sh, which copies outputted field configurations into input files,
before calling the ALF executable. This file is located in the directory $ALF_DIR/Scripts_

and_Parameters_files/Start/
6.3

Error analysis

The ALF package includes the analysis program ana.out for performing simple error analysis
and correlation function calculations on the three observable types. To perform an error analysis based on the jackknife resampling method [141] (Sec. 4.1) of the Monte Carlo bins for alist of observables run$ALF_DIR/Analysis/ana.out <list of files>
or run$ALF_DIR/Analysis/ana.out *for all observables.
The program ana.out is based on the included module ana_mod, which provides subroutines for reading an analyzing ALF Monte Carlo bins, that can be used to implement more
specialized analysis. The three high-level analysis routines employed by ana_mod are listed
in Tab. 14. The files taken as input, as well as the output files are listed in Tab. 15.
Table 14: Overview of analysis subroutines called within the program ana.out.
ProgramDescription

cov_vec(name) The bin file name, which should have suffix _scal, is read in, and the corresponding file with suffix _scalJ is produced. It contains the result of the
jackknife rebinning analysis (see Sec. 4)
cov_eq(name) The bin file name, which should have suffix _eq, is read in, and the corresponding files with suffix _eqJR and _eqJK are produced. They correspondto correlation functions in real and Fourier space, respectively
cov_tau(name) The bin file name, which should have suffix _tau, is read in, and the directories X_kx_ky are produced for all kx and ky greater or equal to zero.
Here X is a place holder from Green, SpinXY, etc., as specified in
Alloc_obs(Ltau) (See section 7.6.1). Each directory contains a fileg_dat containing the time-displaced correlation function traced over theorbitals. It also contains the covariance matrix if N_cov is set to unity inthe parameter file (see Sec. 5.7.1). Besides, a directory X_R0 for the local
time-displaced correlation function is generated.
For particle-hole, imaginary-time correlation functions (Channel = "PH")such as spin and charge, we use the fact that these correlation functions are
symmetric around τ = β/2 so that we can define an improved estimator by
averaging over τ and β − τ51SciPost Phys. Codebases 1 (2022)

The error analysis is based on the central limit theorem, which requires bins to be statistically independent, and also the existence of a well-defined variance for the observable
under consideration (see Sec. 4). The former will be the case if bins are longer than the
autocorrelation time – autocorrelation functions are computed by setting the parameter N_
auto to a nonzero value – which has to be checked by the user. In the parameter file described in Sec. 5.7.1, the user can specify how many initial bins should be omitted (variable
n_skip). This number should be comparable to the autocorrelation time. The rebinning variable N_rebin will merge N_rebin bins into a single new bin. If the autocorrelation time issmaller than the effective bin size, the error should become independent of the bin size andthereby of the variable N_rebin. The analysis output files listed in Tab. 15 and are formatted
Table 15: Standard input and output files of the error analysis program ana.out.
File

Description

Input

parameters
X_scal,
Y_tau

Y_eq,

Includes error analysis variables N_skip, N_rebin, and N_Cov (seeSec. 5.7.1)
Monte Carlo bins (see Tab. 12)

OutputX_scalJ
Y_eqJR and Y_eqJK
Y_R0/g_R0
Y_kx_ky/g_kx_ky
Part_scal_Auto

Jackknife mean and error of X, where X stands for Kin, Pot, Part,or Ener
Jackknife mean and error of Y, which stands for Green, SpinZ,
SpinXY, or Den. The suffixes R and K refer to real and reciprocal
space, respectively
Time-resolved and spatially local jackknife mean and error of Y, where
Y stands for Green, SpinZ, SpinXY, and Den
Time resolved and k-dependent jackknife mean and error of Y, where
Y stands for Green, SpinZ, SpinXY, and Den
Autocorrelation functions SÔ (t Auto ) in the range t Auto = [0, N_auto]
for the observable Ôin the following way:
• For the scalar quantities X, the output files X_scalJ have the following formatting:

Effective number of bins, and bins: <N_bin - N_skip>/<N_rebin>
OBS : 1<mean(X)><error(X)>
OBS : 2<mean(sign)> <error(sign)><N_bin>• For the equal-time correlation functions Y, the formatting of the output files Y_eqJR and
Y_eqJK follows the structure:

do i = 1, N_unit_cell<k_x(i)> <k_y(i)>do alpha = 1, N_orbital
do beta = 1, N_orbitalalpha beta Re<mean(Y)> Re<error(Y)> Im<mean(Y)> Im<error(Y)>
enddo
enddo
enddo
52

SciPost Phys. Codebases 1 (2022)

where Re and Im refer to the real and imaginary part, respectively.
• The imaginary time-displaced correlation functions Y are written to the output files g_R0
inside folders Y_R0, when measured locally in space; and to the output files g_kx_ky
inside folders Y_kx_ky when they are measured k-resolved (where k = (kx, ky)). The
first line of each file contains the number of imaginary times, the effective number ofbins, β, the number of orbitals and the channel. Both output files have the following
formatting:do i = 0, Ltau
tau(i) <mean(Tr[Y])>enddo<error(Tr[Y])>where Tr corresponds to the trace over the orbital degrees of freedom. For particle-hole
quantities at finite temperature, τ runs from 0 to β/2. In all other cases it runs from 0
to β.
• The file Y_tauJK contains the susceptibilities defined as:
χ(q ) =Norb
X Zβn,n0 =1

dτ 〈Yn (q , τ)Yn0 (−q , 0)〉 − 〈Yn (q )〉 〈Yn0 (−q )〉 δq,0 .

(131)

0

The output file has the following formatting:do i = 0, Ltau
q_x, q_y, <mean(Re(chi(q)))>, <error(Re(chi(q)))>, && <mean(Im(chi(q)))>, <error(Im(chi(q)))>enddo• Setting the parameter N_auto to a finite value triggers the computation of autocorrelation functions SÔ (t Auto ) in the range t Auto = [0, N_auto]. The output is written to thefile Part_scal_Auto, where the data in organized in three columns:
t AutoSÔ (t Auto )error

Since these computations are quite time consuming and require many Monte Carlo bins,
our default is N_auto=0.

6.4

Parameter optimization

The finite-temperature, auxiliary-field QMC algorithm is known to be numerically unstable, as
discussed in Sec. 2.4. The numerical instabilities arise from the imaginary-time propagation,
which invariably leads to exponentially small and exponentially large scales. As shown in
Ref. [6], scales can be omitted in the ground state algorithm – thus rendering it very stable –but have to be taken into account in the finite-temperature code.
Numerical stabilization of the code is a delicate procedure that has been pioneered inRef. [2] for the finite-temperature algorithm and in Refs. [3, 4] for the zero-temperature, projective algorithm. It is important to be aware of the fragility of the numerical stabilization andthat there is no guarantee that it will work for a given model. It is therefore crucial to always
check the file info, which, apart from runtime data, contains important information concerning the stability of the code, in particular Precision Green. If the numerical stabilization
fails, one possible measure is to reduce the value of the parameter Nwrap in the parameter
file, which will however also impact performance – see Tab. 16 for further optimization tips
for the Monte Carlo algorithm (Sec. 4). Typical values for the numerical precision ALF canachieve can be found in Sec. 9.1.
53

SciPost Phys. Codebases 1 (2022)

Table 16: Rules of thumb for obtaining best results and performance from ALF. It
is important to fine tune the parameters to the specific model under considerationand perform sanity checks throughout. Most suggestions can severely impact performance and numerical stability if overdone.
Element

Precision
Green, Precision
Phase
theta
dtau
Nwrap
NsweepNbin
nskip
NrebinStabilization scheme

Parallelism

Suggestion
Should be found to be small, of order < 10−8 (see Sec. 2.4)
Should be large enough to guarantee convergence to ground state
Should be set small enough to limit Trotter errors
Should be set small enough to keep Precisions small
Should be set large enough for bins to be of the order of the autocorrelation time
Should be set large enough to provide desired statistics
Should be set large enough to allow for equilibration (∼ autocorrelation time)
Can be set to 1 when Nsweep is large enough; otherwise, and fortesting, larger values can be used
Use the default STAB3 – newest and fastest, if it works for your model;
alternatives are: STAB1 – simplest, for reference only; STAB2 – withadditional normalizations; and LOG – for dealing with more extreme
scales (see also Tab. 13)
For some models and systems, restricting parallelism in your
BLAS library can improve performance: for OpenBLAS try setting
OPENBLAS_NUM_THREADS=1 in the shellIn particular, for the stabilization of the involved matrix multiplications we rely on routines from LAPACK. Notice that results are very likely to change depending on the specificimplementation of the library used10 . In order to deal with this possibility, we offer a simple
baseline which can be used as a quick check as tho whether results depend on the library used
for linear algebra routines. Namely, we have included QR-decomposition related routines of
the LAPACK-3.7.0 reference implementation from http://www.netlib.org/lapack/, which you
can use by running the script configure.sh, (described in Sec. 6), with the flag STAB1 andrecompiling ALF11 . The stabilization flags available are described in Tabs. 13 and 16. The
performance of the package is further discussed in Sec. B.

7

The plain vanilla Hubbard model on the square lattice

All the data structures necessary to implement a given model have been introduced in theprevious sections. Here we show how to implement the Hubbard model by specifying thelattice, the hopping, the interaction, the trial wave function (if required), and the observables.
10

The linked library should implement at least the LAPACK-3.4.0 interface.
This flag may trigger compiling issues, in particular, the Intel ifort compiler version 10.1 fails for all optimizationlevels.
1154

SciPost Phys. Codebases 1 (2022)

Consider the plain vanilla Hubbard model written as:

H = −tX〈i, j 〉,σ=↑,↓X
 U X
2
†
†
†
†
ĉi,σ
ĉ j ,σ + H.c. −ĉi,↑ĉi,↑ − ĉi,↓ĉi,↓ − µĉi,σĉi,σ .
2 i
i,σ

(132)

Here 〈i, j 〉 denotes nearest neighbors. We can make contact with the general form of the
Hamiltonian [see Eq. (2)] by setting: Nfl = 2, Ncol ≡ N_SUN = 1, M T = 1,
 −t if x, y are nearest neighbors−µ if x = y
Tx(ks)
=
,
(133)
y
 0
otherwise= δ x, y δ x,k , Vx(k,s=2)= −δ x, y δ x,k , αks = 0 and M I = 0.
MV = Nunit-cell , Uk = U2 , Vx(k,s=1)yyThe coupling of the HS fields to the z-component of the magnetization breaks the SU(2) spinsymmetry. Nevertheless, the z-component of the spin remains a good quantum number suchthat the imaginary-time propagator – for a given HS field – is block diagonal in this quantum
number. This corresponds to the flavor index running from 1 to 2, labeling spin up and spin
down degrees of freedom. We note that in this formulation the hopping matrix can be flavor
dependent such that a Zeeman magnetic field can be introduced. If the chemical potential isset to zero, this will not generate a negative sign problem [78, 144, 145]. The code that we
describe below can be found in the module Prog/Hamiltonians/Hamiltonian_plain_
vanilla_hubbard_mod.F90. This file may be a good starting point for implementing a newmodel Hamiltonian.

7.1

Setting the Hamiltonian: Ham_set

The main program will call the subroutine Ham_set in the module Hamiltonian_plain_
vanilla_hubbard_mod.F90. The latter subroutine defines the public variables
Type(Operator),dimension(:,:), allocatable :: Op_V ! Interaction
Type(Operator),dimension(:,:), allocatable :: Op_T ! HoppingType(WaveFunction), dimension(:), allocatable :: WF_L ! Left trial wave function
Type(WaveFunction), dimension(:), allocatable :: WF_R ! Right trial wave function
Type(Fields):: nsigma! Fields
Integer:: Ndim! Number of sites
Integer:: N_FL! Number of flavors
Integer:: N_SUN! Number of colors
Integer:: Ltrot! Total number of trotter slices
Integer:: Thtrot! Number of trotter slices! reserved for projection
Logical:: Projector! Projector code
Integer:: Group_Comm! Group communicator for MPI
Logical:: Symm! Symmetric trotter

which specify the model. The routine Ham_set will first read the parameter file parameters(see Sec. 5.7.1); then set the lattice: Call Ham_latt; set the hopping: Call Ham_hop; set
the interaction: call Ham_V; and if required, set the trial wave function: call Ham_trial.

7.2

The lattice: Ham_latt

The routine, which sets the square lattice, reads:
a1_p(1) = 1.0 ; a1_p(2) = 0.d0
a2_p(1) = 0.0 ; a2_p(2) = 1.d0
L1_p
= dble(L1)*a1_p
L2_p= dble(L2)*a2_p

55

SciPost Phys. Codebases 1 (2022)

Call Make_Lattice(L1_p, L2_p, a1_p, a2_p, Latt)
Latt_unit%Norb = 1
Latt_unit%N_coord = 2
allocate(Latt_unit%Orb_pos_p(Latt_unit%Norb,2))
Latt_unit%Orb_pos_p(1, :) = [0.d0, 0.d0]
Ndim = Latt%N*Latt_unit\%Norb

In its last line, the routine sets the total number of single particle states per flavor and color:
Ndim = Latt%N*Latt_unit%Norb.

7.3

The hopping: Ham_hop

The hopping matrix is implemented as follows. We allocate an array of dimension 1×1 of type
operator called Op_T and set the dimension for the hopping matrix to N = Ndim . The operator
allocation and initialization is performed by the subroutine Op_make:call Op_make(Op_T(1,1),Ndim);call Op_make(Op_T(1,2),Ndim)

Since the hopping does not break down into small blocks, we have P = 1 andDo nf = 1, N_FL
Do i = 1,Latt%N
Op_T(1,nf)%P(i) = i
Enddo
Enddo

We set the hopping matrix with
Do nf = 1, N_FL
Do I = 1, Latt%N
Ix = Latt%nnlist(I,1,0)
Iy = Latt%nnlist(I,0,1)
Op_T(1,nf)%O(I, Ix) = cmplx(-Ham_T,
0.d0, kind(0.D0))
Op_T(1,nf)%O(Ix, I ) = cmplx(-Ham_T,
0.d0, kind(0.D0))
Op_T(1,nf)%O(I, Iy) = cmplx(-Ham_T,
0.d0, kind(0.D0))
Op_T(1,nf)%O(Iy, I ) = cmplx(-Ham_T,
0.d0, kind(0.D0))
Op_T(1,nf)%O(I, I ) = cmplx(-Ham_chem, 0.d0, kind(0.D0))
Enddo
Op_T(1,nf)%g= -Dtau
Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0))
Call Op_set(Op_T(1,nf))
Enddo

Here, the integer function Latt%nnlist(I,n,m) is defined in the lattice module and returns
the index of the lattice site I + na1 + ma2 . Note that periodic boundary conditions are already taken into account. The hopping parameter Ham_T, as well as the chemical potential
Ham_chem are read from the parameter file. To completely define the hopping we further set:
Op_T(1,nf)%g = -Dtau , Op_T(1,nf)%alpha = cmplx(0.d0,0.d0, kind(0.D0))
and call the routine Op_set(Op_T(1,nf)) so as to generate the unitary transformation andeigenvalues as specified in Tab. 2.
Recall that for the hopping, the variable
Op_set(Op_T(1,nf))%type takes its default value of 0. Finally, note that, although acheckerboard decomposition is not used here, it can be implemented by considering a larger
number of sparse hopping matrices.

7.4

The interaction: Ham_V

To implement the interaction, we allocate an array of Operator type. The array is called
Op_V and has dimensions Ndim × Nfl = Ndim × 2. We set the dimension for the interaction term

56

SciPost Phys. Codebases 1 (2022)

to N = 1, and allocate and initialize this array of type Operator by repeatedly calling thesubroutine Op_make:
Allocate(Op_V(Ndim,N_FL))
do nf = 1,N_FL
do i = 1, Ndim
Call Op_make(Op_V(i,nf), 1)
enddo
enddo
Do nf = 1,N_FL
X = 1.d0
if (nf == 2) X = -1.d0
Do i = 1,Ndim
nc = nc + 1
Op_V(i,nf)%P(1)= I
Op_V(i,nf)%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0))
Op_V(i,nf)%g= X*SQRT(CMPLX(DTAU*ham_U/2.d0, 0.D0, kind(0.D0)))
Op_V(i,nf)%alpha = cmplx(0.d0, 0.d0, kind(0.D0))
Op_V(i,nf)%type= 2Call Op_set( Op_V(i,nf) )
Enddo
Enddo

The code above makes it explicit that there is a sign difference between the coupling of the HS
field in the two flavor sectors.

7.5

The trial wave function: Ham_Trial

As argued in Sec. 3.1, it is useful to generate the trial wave function from a non-interacting trial
Hamiltonian. Here we will use the same left and right flavor-independent trial wave functions
that correspond to the ground state of:i XXhĉi† hi, j ĉi .
(134)
1 + (−1)i x +i y δ ĉi† ĉi+a + (1 − δ) ĉi† ĉi+a + H.c. ≡Ĥ T = −t
y

x

i, j

i

For the half-filled case, the dimerization δ = 0+ opens up a gap at half-filling, thus generating
the desired non-degenerate trial wave function that has the same symmetries (particle-holefor instance) as the trial Hamiltonian.

Diagonalization of hi, j , U † hU = Diag ε1 , · · · , εNdim with εi < ε j for i < j, allows us todefine the trial wave function. In particular, for the half-filled case, we set
Do s = 1, N_fl
Do x = 1,Ndim
Do n = 1, N_part
WF_L(s)%P(x,n) =WF_R(s)%P(x,n) =
Enddo
Enddo
Enddo

U x,n
U x,n

with N_part = Ndim/2. The variable Degen belonging to the WaveFunction type is given
by Degen= εNPart +1 − εNPart . This quantity should be greater than zero for non-degenerate trial
wave functions.

7.6

Observables

At this point, all the information for starting the simulation has been provided. The code willsequentially go through the operator list Op_V and update the fields. Between time slices
57

SciPost Phys. Codebases 1 (2022)

LOBS_ST and LOBS_EN the main program will call the routine Obser(GR,Phase,Ntau),
which handles equal-time correlation functions, and, if Ltau=1, the routine ObserT(NT,GT0,G0T,G00,GTT, PHASE) which handles imaginary-time displaced correlation functions.
Both Obser and ObserT should be provided by the user, who can either implement themselves the observables they want to compute or use the predefined structures of Chap. 8. Here
we describe how to proceed in order to define an observable.
7.6.1

Allocating space for the observables: Alloc_obs(Ltau)

For four scalar or vector observables, the user will have to declare the following:
Allocate ( Obs_scal(4) )Do I = 1,Size(Obs_scal,1)
select case (I)case (1)N = 2; Filename ="Kin"case (2)N = 1; Filename ="Pot"case (3)N = 1; Filename ="Part"
case (4)N = 1, Filename ="Ener"case default
Write(6,*) ' Error in Alloc_obs 'end selectCall Obser_Vec_make(Obs_scal(I), N, Filename)
enddo

Here, Obs_scal(1) contains a vector of two observables so as to account for the x- andy-components of the kinetic energy, for example.
For equal-time correlation functions we allocate Obs_eq of type Obser_Latt. Here we
include the calculation of spin-spin and density-density correlation functions alongside equaltime Green functions.
Allocate ( Obs_eq(5) )Do I = 1,Size(Obs_eq,1)
select case (I)case (1)Filename = "Green"case (2)Filename = "SpinZ"
case (3)Filename = "SpinXY"
case (4)Filename = "SpinT"
case (5)Filename = "Den"case default
Write(6,*) "Error in Alloc_obs"
end selectNt = 1Channel = "--"
Call Obser_Latt_make(Obs_eq(I), Nt, Filename, Latt, Latt_unit, Channel, dtau)
Enddo

Be aware that Obser_Latt_make does not copy the Bravais lattice Latt and unit cell
Latt_unit, but links them through pointers to be more memory efficient. One can have different lattices attached to different observables by declaring additional instances ofType(Lattice) and Type(Unit_cell). For equal-time correlation functions, we set
Nt = 1 and Channel specification is not necessary.
58

SciPost Phys. Codebases 1 (2022)

If Ltau = 1, then the code allocates space for time displaced quantities. The same structure as for equal-time correlation functions is used, albeit with Nt = Ltrot + 1 and thechannel should be set. Whith Channel="PH", for instance, the analysis algorithm assumes
the observable to be particle-hole symmetric. For more details on this parameter see Sec. 10.
At the beginning of each bin, the main program will set the bin observables to zero bycalling the routine Init_obs(Ltau). The user does not have to edit this routine.
7.6.2

Measuring equal-time observables: Obser(GR,Phase,Ntau)

Having allocated the necessary memory, we proceed to define the observables. The equal-timeGreen function,
GR(x,y, σ) = 〈ĉ x,σ ĉ †y,σ 〉 ,(135)
the phase factor phase [Eq. (122)], and time slice Ntau are provided by the main program.
Here, x and y label both unit cell as well as the orbital within the unit cell. For the Hubbard
model described here, x corresponds to the unit cell. The Green function does not depend on
the color index, and is diagonal in flavor. For the SU(2) symmetric implementation there is
only one flavor, σ = 1 and the Green function is independent on the spin index. This renders
the calculation of the observables particularly easy. P
An explicit calculation of the potential energy 〈U i n̂i,↑ n̂i,↓ 〉 reads
Obs_scal(2)%N= Obs_scal(2)%N + 1
Obs_scal(2)%Ave_sign = Obs_scal(2)%Ave_sign + Real(ZS,kind(0.d0))
Do i = 1,Ndim
Obs_scal(2)%Obs_vec(1) = Obs_scal(2)%Obs_vec(1) + && (1-GR(i,i,1)) * (1-GR(i,i,2)) * Ham_U*ZS*ZP
Enddo
−S(C)

Here ZS = sgn(C) [see Eq. (26)], ZP = Ree e−S(C) [see Eq. (122)] and Ham_U corresponds to[]the Hubbard U term.
Equal-time correlations are also computed in this routine. As an explicit example, we
consider the equal-time density-density correlation:〈n̂i n̂ j 〉 − 〈n̂i 〉〈n̂ j 〉 ,

(136)

X

(137)

with
n̂i =

σ

†
ĉi,σ
ĉi,σ .

For the calculation of such quantities, it is convenient to define:GRC(x,y,s) = δ x, y − GR(y,x,s) ,(138)such that GRC(x,y,s) corresponds to 〈〈ĉ †x,s ĉ y,s 〉〉. In the program code, the calculation of theequal-time density-density correlation function looks as follows:
Obs_eq(4)%N = Obs_eq(4)%N + 1! Even if it is redundant, each observable! carries its own counter and sign.
Obs_eq(4)%Ave_sign = Obs_eq(4)%Ave_sign + Real(ZS,kind(0.d0))
Do I = 1,Ndim
Do J = 1,Ndim
imj = latt%imj(I,J)
Obs_eq(4)%Obs_Latt(imj,1,1,1) = Obs_eq(4)%Obs_Latt(imj,1,1,1) + && ( (GRC(I,I,1)+GRC(I,I,2)) * (GRC(J,J,1)+GRC(J,J,2))+ &&GRC(I,J,1)*GR(I,J,1) + GRC(I,J,2)*GR(I,J,2) ) * ZP * ZS
Enddo
Obs_eq(4)%Obs_Latt0(1) = Obs_eq(4)%Obs_Latt0(1) + (GRC(I,I,1)+GRC(I,I,2))*ZP*ZS
Enddo

59

SciPost Phys. Codebases 1 (2022)

At the end of each bin the main program calls the routine Pr_obs(LTAU). This routine
appends the result for the current bins to the corresponding file, with the appropriate suffix.
7.6.3

Measuring time-displaced observables: ObserT(NT, GT0, G0T, G00, GTT, PHASE)

This subroutine is called by the main program at the beginning of each sweep, provided that
LTAU is set to 1. The variable NT runs from 0 to Ltrot and denotes the imaginary timedifference. For a given time displacement, the main program provides:

GT0(x,y,s) = 〈〈ĉ x,s (N t∆τ)ĉ †y,s (0)〉〉 = 〈〈T ĉ x,s (N t∆τ)ĉ †y,s (0)〉〉 ,G0T(x,y,s) = −〈〈ĉ †y,s (N t∆τ)ĉ x,s (0)〉〉 = 〈〈T ĉ x,s (0)ĉ †y,s (N t∆τ)〉〉 ,G00(x,y,s) = 〈〈ĉ x,s (0)ĉ †y,s (0)〉〉 ,(139)

GTT(x,y,s) = 〈〈ĉ x,s (N t∆τ)ĉ †y,s (N t∆τ)〉〉 .
In the above we have omitted the color index since the Green functions are color independent.
The time-displaced spin-spin correlations 4〈〈Ŝiz (τ)Ŝ zj (0)〉〉 are then given by:
4〈〈Ŝiz (τ)Ŝ zj (0)〉〉 = (GTT(I,I,1) − GTT(I,I,2)) ∗ (G00(J,J,1) − G00(J,J,2))− G0T(J,I,1) ∗ GT0(I,J,1) − G0T(J,I,2) ∗ GT0(I,J,2) . (140)The handling of time-displaced correlation functions is identical to that of equal-time correlations.

7.7

Numerical precision

Information on the numerical stability is included in the following lines of the corresponding
file info. For a short simulation on a 4 × 4 lattice at U/t = 4 and β t = 10 we obtain

Precision Green
Precision Phase
Precision tau

Mean, Max : 5.0823874429126405E-011 5.8621144596315844E-006
Max: 0.0000000000000000
Mean, Max : 1.5929357848647394E-011 1.0985132530727526E-005

showing the mean and maximum difference between the wrapped and from scratch computed
equal and time-displaced Green functions [6]. A stable code should produce results where themean difference is smaller than the stochastic error. The above example shows a very stable
simulation since the Green function is of order one.

7.8

Running the code and testing

To test the code, one can carry out high precision simulations. After compilation, the executable Hubbard_Plain_Vanilla.out is found in the directory $ALF_DIR/Prog/ and canbe run from any directory containing the files parameters and seeds (See Sec. 5.7).
Alternatively, as we do bellow, it may be convenient to use pyALF to compile and run thecode, especially when using one of the scripts or notebooks available.
One-dimensional case
The pyALF python script Hubbard_Plain_Vanilla.py runs the projective version of thecode for the four-site Hubbard model. At θ t = 10, ∆τt = 0.05 with the symmetric Trotter
decomposition, we obtain after 40 bins of 2000 sweeps each the total energy:〈Ĥ〉 = −2.103750 ± 0.004825 ,and the exact result is〈Ĥ〉Exact = −2.100396 .
60

SciPost Phys. Codebases 1 (2022)

Table 17: Test results for the Hubbard_Plain_Vanilla code on a two-dimensionallattice with default parameters.

Total energy
Q = (π, π) spin correlations

QMC

Exact

-13.618 ± 0.002
3.630 ± 0.006-13.6224
3.64

Two-dimensional case
For the two-dimensional case, with similar parameters, we obtain the results listed in Tab. 17.
The exact results stem from Ref. [146] and the slight discrepancies from the exact results canbe assigned to the finite value of ∆τ. Note that all the simulations were carried out with thedefault value of the Hubbard interaction, U/t = 4.

8Predefined Structures

The ALF package includes predefined structures, which the user can combine together or use
as templates for defining new ones. Using the data types defined in the Sec. 5 the following
modules are available:• lattices and unit cells – Predefined_Latt_mod.F90• hopping Hamiltonians – Predefined_Hop_mod.F90• interaction Hamiltonians – Predefined_Int_mod.F90• observables – Predefined_Obs_mod.F90• trial wave functions – Predefined_Trial_mod.F90
which we describe in the remaining of this section.

8.1

Predefined lattices

The types Lattice and Unit_cell, described in Section 5.3, allow us to define arbitrary
one- and two-dimensional Bravais lattices. The subroutine Predefined_Latt provides someof the most common lattices, as described bellow.
The subroutine is called as:
Predefined_Latt(Lattice_type, L1, L2, Ndim, List, Invlist, Latt, Latt_Unit)

which returns a lattice of size L1×L2 of the given Lattice_type, as detailed in Tab. 18.
Notice that the orbital position Latt_Unit%Orb_pos_p(1,:) is set to zero unless otherwise
specified.
In order to easily keep track of the orbital and unit cell, List and Invlist make use of asuper-index, defined as shown below:
nc = 0Do I = 1,Latt%N
Do no = 1,Norbnc = nc + 1
List(nc,1) = I
List(nc,2) = no

! Super-index labeling unit cell and orbital! Unit-cell index! Orbital index! Unit-cell of super index nc! Orbital of super index nc

61

SciPost Phys. Codebases 1 (2022)

Invlist(I,no) = nc
Enddo
Enddo

! Super-index for given unit cell and orbital

With the above-defined lists one can run through all the orbitals while keeping track of theunit-cell and orbital index. We note that when translation symmetry is completely absent one
can work with a single unit cell, and the number of orbitals will then correspond to the numberof lattice sites.

Figure 5: Predefined lattices in ALF: (a) square, (b) bilayer square, (c) 3-leg ladder,(d) honeycomb, and (e) bilayer honeycomb. Nontrivial unit cells are shown as grayregions, while gray sites belong to the second layer in bilayer systems. The links
between the orbitals denote the hopping matrix elements and we have assumed,
for the purpose of the plot, the absence of hopping in the second layer for bilayer
systems. The color coding of the links denotes the checkerboard decomposition.

8.1.1

Square lattice, Fig. 5(a)The choice Lattice_type = "Square" sets a1 = (1, 0) and a2 = (0, 1) and for an L1 × L2
lattice L1 = L1 a1 and L2 = L2 a2 :Latt_Unit%N_coord= 2
Latt_Unit%Norb= 1
Latt_Unit%Orb_pos_p(1,:) = 0.d0
a1_p(1) = 1.0 ; a1_p(2) = 0.d0
a2_p(1) = 0.0 ; a2_p(2) = 1.d0
L1_p
= dble(L1)*a1_p
L2_p= dble(L2)*a2_p
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )Also, the number of orbitals per unit cell is given by NORB=1 such that
Ndim ≡ Nunit-cell · NORB = Latt%N · NORB, since Nunit-cell = Latt%N.
8.1.2

Bilayer Square lattice, Fig. 5(b)The "Bilayer_square" configuration sets:
62

SciPost Phys. Codebases 1 (2022)

Latt_Unit%Norb= 2
Latt_Unit%N_coord = 2
do no = 1,2
Latt_Unit%Orb_pos_p(no,1) = 0.d0
Latt_Unit%Orb_pos_p(no,2) = 0.d0
Latt_Unit%Orb_pos_p(no,3) = real(1-no,kind(0.d0))
enddo
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )Latt%a1_p(1) = 1.0 ; Latt%a1_p(2) = 0.d0
Latt%a2_p(1) = 0.0 ; Latt%a2_p(2) = 1.d0
Latt%L1_p= dble(L1)*a1_p
Latt%L2_p= dble(L2)*a2_p

8.1.3

N-leg Ladder lattice, Fig. 5(c)The "N_leg_ladder" configuration sets:
Latt_Unit%Norb= L2
Latt_Unit%N_coord = 1
do no = 1,L2
Latt_Unit%Orb_pos_p(no,1) = 0.d0
Latt_Unit%Orb_pos_p(no,2) = real(no-1,kind(0.d0))
enddo
a1_p(1) = 1.0; a1_p(2) = 0.d0
a2_p(1) = 0.0; a2_p(2) = 1.d0
L1_p
= dble(L1)*a1_p
L2_p
=
a2_p
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )Table 18: Arguments of the subroutine Predefined_Latt. Note that the Pi_Flux
lattice is deprecated, since it can be emulated with the Square lattice with half a flux
quanta piercing each plaquette.
Argument

Type

Role

Description

Lattice_type char

Input

Lattice configuration, which can take the values:- Square- Honeycomb- Pi_Flux (deprecated)- N_leg_ladder- Bilayer_square- Bilayer_honeycomb

L1, L2
Ndim
List

int
int
int

Input
OutputOutputInvlistint

OutputLatt
Latt_Unit

Lattice
Output
Unit_cell Output

Lattice sizes (set L2=1 for 1D lattices)
Total number of orbitals
For every site index I ∈ [1, Ndim], stores the corresponding lattice position, List(I,1), and the(local) orbital index, List(I,2)
For every lattice_position ∈ [1, Latt%N] andorbital ∈ [1, Norb] stores the corresponding site
index I(lattice_position,orbital)
Sets the lattice
Sets the unit cell

63

SciPost Phys. Codebases 1 (2022)

8.1.4

Honeycomb lattice, Fig. 5(d)In order to carry out simulations on the Honeycomb lattice, which is a triangular Bravais latticewith two orbitals per unit cell, choose Lattice_type="Honeycomb", which sets
a1_p(1) = 1.D0
; a1_p(2) = 0.d0
a2_p(1) = 0.5D0 ; a2_p(2) = sqrt(3.D0)/2.D0
L1_p= Dble(L1) * a1_p
L2_p
= dble(L2) * a2_p
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )Latt_Unit%Norb= 2
Latt_Unit%N_coord = 3
Latt_Unit%Orb_pos_p(1,:) = 0.d0
Latt_Unit%Orb_pos_p(2,:) = (a2_p(:) - 0.5D0*a1_p(:)) * 2.D0/3.D0

The coordination number of this lattice is N_coord=3 and the number of orbitals per unit
cell, NORB=2. The total number of orbitals is therefore Ndim =Latt%N*NORB.
8.1.5

Bilayer Honeycomb lattice, Fig. 5(e)The "Bilayer_honeycomb" configuration sets:
Latt_Unit%Norb= 4
Latt_Unit%N_coord= 3
Latt_unit%Orb_pos_p = 0.d0
do n = 1,2
Latt_Unit%Orb_pos_p(1,n) = 0.d0
Latt_Unit%Orb_pos_p(2,n) = (a2_p(n) - 0.5D0*a1_p(n)) * 2.D0/3.D0
Latt_Unit%Orb_pos_p(3,n) = 0.d0
Latt_Unit%Orb_pos_p(4,n) = (a2_p(n) - 0.5D0*a1_p(n)) * 2.D0/3.D0
enddo
Latt_Unit%Orb_pos_p(3,3) = -1.d0
Latt_Unit%Orb_pos_p(4,3) = -1.d0
a1_p(1) = 1.D0
; a1_p(2) = 0.d0
a2_p(1) = 0.5D0 ; a2_p(2) = sqrt(3.D0)/2.D0
L1_p= dble(L1)*a1_p
L2_p= dble(L2)*a2_p
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )8.1.6 π-Flux lattice (deprecated)
The "Pi_Flux" lattice has been deprecated, since it can be emulated with the Square latticewith half a flux quanta piercing each plaquette. Nonetheless, the configuration is still available,
and sets:
Latt_Unit%Norb= 2
Latt_Unit%N_coord = 4
a1_p(1) = 1.D0
; a1_p(2) =1.d0
a2_p(1) = 1.D0
; a2_p(2) = -1.d0
Latt_Unit%Orb_pos_p(1,:) = 0.d0
Latt_Unit%Orb_pos_p(2,:) = (a1_p(:) - a2_p(:))/2.d0
L1_p= dble(L1) * (a1_p - a2_p)/2.d0
L2_p= dble(L2) * (a1_p + a2_p)/2.d0
Call Make_Lattice( L1_p, L2_p, a1_p, a2_p, Latt )8.2

Generic hopping matrices on Bravais lattices

The module Predefined_Hopping provides a generic way to specify a hopping matrix on amulti-orbital Bravais lattice. The only assumption that we make is translation symmetry. We
64

SciPost Phys. Codebases 1 (2022)

allow for twisted boundary conditions in the L1 and L2 lattice directions. The twist is given by
Phi_X and Phi_Y respectively. If the flag bulk=.true., then the twist is implemented witha vector potential. Otherwise, if bulk=.false., the twist is imposed at the boundary. The
routine also accounts for the inclusion of a total number of N_Phi flux quanta traversing thelattice. All phase factors mentioned above can be flavor dependent. Finally, the checkerboard
decomposition can also be specified in this module.
8.2.1

Setting up the hopping matrix: the Hopping_Matrix_type

All information for setting up a generic hopping matrix on a lattice, including the checkerboard
decomposition, is specified in the Hopping_Matrix_type type, which we describe in theremaining of this section. The information stored in this type (see Tab. 19) fully defines thearray of operator type OP_T that accounts for the single particle propagation in one time step,from which the kinetic energy can be derived as well.
Generic hopping matrices
The generic Hopping Hamiltonian reads:
2πi

(s)

X

Ĥ T =(i,δ),( j,δ0 ),s,σ†T(i,δ),( j,δ0 ) ĉ(i,δ),s,σe Φ0

R j+δ0i+δA(s) (l)d lĉ( j,δ0 ),s,σ ,(141)with boundary conditionsΦ(s)−2πi Φi†0ĉ(i+L=ei ,δ),s,σ

2πi

e Φ0

(s)

χ L (i+δ) †iĉ(i,δ),s,σ .

(142)

Here i labels the unit cell and δ the orbital. Both the twist and vector potential can have aflavor dependency. These and the other components of the generic Hopping Hamiltonian are
described bellow. For now onwards we mostly omit the flavor index s.
Phase factors. The vector potential accounts for an orbital magnetic field in the z direction thatis implemented in the Landau gauge: A(x ) = −B( y, 0, 0) with x = (x, y, z). Φ0 corresponds
to the flux quanta and the scalar function χ is defined through:A(x + Li ) = A(x ) + ∇χ L i (x ) .

(143)

Provided that the bare hopping Hamiltonian, T (i.e., without phases, see Eq. (149)), is
invariant under lattice translations, Ĥ T commutes with magnetic translations that satisfy thealgebra:2πi

T̂a T̂b = e Φ0

B·(a×b)T̂b T̂a .

(144)

On the torus, the uniqueness of the wave functions requires that T̂L1 T̂L2 = T̂L2 T̂L1 such that
B · (L1 × L2 )= NΦ ,
Φ0(145)

with NΦ an integer. The variable N_Phi, specified in the parameter file, denotes the numberof flux quanta piercing the lattice. The variables Phi_X and Phi_Y also in the parameter filedenote the twists – in units of the flux quanta – along the L1 and L2 directions. There aregauge equivalent ways to insert the twist in the boundary conditions. In the above we have

65

SciPost Phys. Codebases 1 (2022)

inserted the twist as a boundary condition such that for example setting Phi_1=0.5 corresponds to anti-periodic boundary conditions along the L1 axis. Alternatively we can consider
the Hamiltonian:Ĥ T =

2πi(s)X(i,δ),( j,δ0 ),s,σ†T(i,δ),( j,δ0 ) c̃(i,δ),s,σe Φ0

R j+δ0i+δ(A(l)+Aφ )dl c̃

( j,δ0 ),s,σ

,

(146)

with boundary conditions
2πi†c̃(i+L= e Φ0,δ),s,σ
i

Here
Aφ =

χ L i (i+δ) †c̃(i,δ),s,σ .

φ1 |a1 |φ |a |
b1 + 2 2 b2
2π|L1 |
2π|L2 |

(147)

(148)

and bi are the reciprocal lattice vectors satisfying a i · b j = 2πδi, j . The logical variable bulk
chooses between these two gauge equivalent ways of inserting the twist angle. If bulk=.true.
then we use periodic boundary conditions – in the absence of an orbital field – otherwise
twisted boundaries are used. The above phase factors are computed in the module function:complex function Generic_hopping(i, no_i, n_1, n_2, no_j, N_Phi, Phi_1, Phi_2,
Bulk, Latt, Latt_Unit)

which returns the phase factor involved in the hopping of a hole from lattice site i + δnoi to
i + n1 a1 + n2 a2 + δno j . Here δnoi is the position of the noi orbital in the unit cell i. The information for the phases is encoded in the type Hopping_matrix_type.
The Hopping matrix elements. The hopping matrix is specified assuming only translation
invariance. (The point group symmetry of the lattice can be broken.) That is, we assume thatfor each flavor index:
(s)

(s)

T(i, δ),(i+n a +n a , δ0 ) = T(0, δ),(n a +n a , δ0 ) .
1 1

2 2

1 1

2 2

(149)

The right hand side of the above equation is given the type Hopping_matrix_type.
The checkerboard decomposition. Aside from the hopping phases and hopping matrix elements, the Hopping_matrix_type type contains information concerning the checkerboard
decomposition. In Eq. (72) we wrote the hopping Hamiltonian as:

Ĥ T =NT X
X

T̂ (k) ,(150)

i=1 k∈S Ti
0 
with the rule that if k and k0 belong to the same set SiT then T̂ (k) , T̂ (k ) = 0. In the checkerboard decomposition, T̂ (k) corresponds to hopping on a bond. The checkerboard decomposition depends on the lattice type, as well as on the hopping matrix elements. The required
information is stored in Hopping_matrix_type. In this data type, N_FAM corresponds to thenumber of sets (or families) (NT in the above equation). L_FAM(1:N_FAM) corresponds tothe number of bonds in the set, and finally, LIST_FAM(1:N_FAM, 1:max(L_FAM(:)), 2)
contains information concerning the two legs of the bonds. In the checkerboard decomposition, care has to be taken for local terms: each site occurs multiple times in the list of bonds.
Since we have postulated translation symmetry, a one-dimensional array, Multiplicity, of
length given by the number of orbitals per unit cell suffices to encode the required information. Finally, to be able to generate the imaginary time step of length ∆τ we have to know by
66

SciPost Phys. Codebases 1 (2022)

which fraction of ∆τ we have to propagate each set. This information is given in the array
Prop_Fam.
As an example we can consider the three-leg ladder lattice of Figure 5(c). Here the numberof sets (or families) N_FAM is equal to four, corresponding to the red, green, black and blue
bonds. It is clear from the figure that bonds in a given set do not have common legs, so that
hopping instances on the bonds of a given set commute. For this three-leg ladder, we see thatthe middle orbital in a unit cell appears in each set or family. It hence has a multiplicity offour. On the other hand, the top and bottom orbitals have a multiplicity of 3 since they appear
in only three of the four sets.
Usage: the Hopping_Matrix_type
There are N_bonds hopping matrix elements emanating from a given unit cell, defined sothat looping over all of the elements does not overcount the bonds. For each bond, the array
List contains the full information to define the RHS of Eq. (149). The hopping amplitudes
are stored in the array T and the local potentials in the array T_loc (See Tab. 19). The
Hopping_Matrix_type type also contains the information for the checkerboard decomposition.
Table 19: Member variables of the Hopping_Matrix_type type.
VariableTypeN_bonds

int

Description

Number of hopping matrix elements
within and emanating from a unit cellList(N_bonds,4)int
List(•,1) = δ
List(•,2) = δ0
List(•,3) = n1
List(•,4) = n2
T(N_bonds)
cmplx
Hopping amplitude
T_loc(Norb)cmplx
On site potentials (e.g., chemical potential, Zeeman field)
N_Phi
int
Number of flux quanta piercing thelattice
Phi_X
dble
Twist in a1 direction
Phi_Y
dble
Twist in a2 direction
Bulk
logical Twist as vector potential (T)or boundary condition (F)
N_Fam
int
Number of sets, NT in Eq. (72)
L_Fam(N_FAM)
int
Number of bonds per set S T
List_Fam(N_FAM,max(L_FAM(:)),2) int
List_Fam(•, •,1) = Unit cell
List_Fam(•, •,2) = Bond number
Multiplicity(Norb)
int
Number of times a given orbital
occurs in the list of bonds
Prop_Fam(N_FAM)
dble
The fraction of ∆τ with which the set
will be propagated67SciPost Phys. Codebases 1 (2022)

Figure 6: The single particle spectrum of the tight binding model on the honeycomb(a) and square (b) lattices as a function of the flux NΦ . This corresponds to the wellknown Hofstadter butterflies.

The data in the Hopping_matrix_type type suffices to uniquely define the unit step
propagation for the kinetic energy, and for any combinations of the Checkerboard and Symm
options (see Sec. 2.3). The propagation is set through the call:
Call Predefined_Hoppings_set_OPT(Hopping_Matrix, List, Invlist, Latt, Latt_unit,
Dtau, Checkerboard, Symm, OP_T)

in which the operator array OP_T(*,N_FL) is allocated and defined. In the simplest case,where no checkerboard is used, the array’s first dimension is unity.
The data in the Hopping_matrix_type type equally suffices to compute the kinetic energy. This is carried out in the routine Predefined_Hoppings_Compute_Kin.
8.2.2

An example: nearest neighbor hopping on the honeycomb lattice

For the honeycomb lattice of Fig. 5(d) the number of bonds within and emanating from a unit
cell is N_bonds = 3. The list array of the Hopping_matrix_type reads:list(1,1) =1; list(1,2) =2; list(1,3) =0;
list(2,1) =2; list(2,2) =1; list(2,3) =0:
list(3,1) =1; list(3,2) =2; list(3,3) =1:
T(1) = -1.0; T(2) = -1.0; T(3) = -1.0
T_loc(1) = 0.0; T_loc(2) = 0.0

list(1,4) =0 ! Intra unit-cell hopping
list(2,4) =1 ! Inter unit-cell hopping
list(3,4) =-1 ! Inter unit-cell hopping! Hopping! Chemical potential

In the last two lines, we have set the hopping matrix element for each bond to −1 and thechemical potential to zero. The fields can then be specified with the variables N_phi, Phi_x,
Phi_y. Setting the twists, Phi_x, Phi_y to zero and looping over N_phi from 1 · · · L 2 produces the single particle spectrum of Fig. 6(a).
For the honeycomb lattice the checkerboard decomposition for the nearest neighbor hopping consists of three sets, N_Fam = 3, each of size equal to the number of unit cells. In
Fig. 5(d) these sets are denoted by different colors. In the code, the elements of the sets are
specified as:
do I = 1,Latt%N
do nf = 1,N_FAM
List_Fam(nf,I,1) = I ! Unit cell
List_Fam(nf,I,2) = nf ! The bond
enddo
enddo
Multiplicity = 3

68

SciPost Phys. Codebases 1 (2022)

Since each site of the honeycomb lattice occurs in the three sets, their multiplicity is equal to
3.
8.2.3

Predefined hoppings

The module provides hopping and checkerboard decompositions, defining a Hopping_Matrix(an array of length N_FL of type Hopping_Matrix_type, see Sec. 8.2.1) for each of the following predefined lattices.
Square
The call:Call Set_Default_hopping_parameters_square(Hopping_Matrix, T_vec, Chem_vec,
Phi_X_vec, Phi_Y_vec, Bulk, N_Phi_vec, N_FL, List, Invlist, Latt, Latt_unit)

defines the Hopping_Matrix for the square lattice:



R
X
X
i+δ
2πi
A(s) (l)d l††e Φ0 iĉi+δ,s,σ + H.c. − µ(s) ĉi,s,σ−t (s) ĉi,s,σĉi,s,σ  .
Ĥ T =(151)

δ={a1 ,a2 }i,σ,sThe vectors T_vec and Chem_vec have length N_FL and specify the hopping and the chemical
potentials, while the vectors Phi_X_vec, Phi_Y_vec and N_Phi_vec, also of length N_FL,
define the vector potential.
Honeycomb
The call:Call Set_Default_hopping_parameters_honeycomb(Hopping_Matrix,T_vec, Chem_vec,
Phi_X_vec, Phi_Y_vec, Bulk, N_Phi_vec, N_FL, List, Invlist, Latt, Latt_unit)

defines the Hopping_Matrix for the honeycomb lattice:Ĥ T =

X

X

i,σ,s

δ={δ1 ,δ2 ,δ3 }†−t (s) ĉi,s,σ
e

2πi
Φ0

R i+δ
i

!

(s)

A (l)d l+ĉi+δ,s,σ + H.c.

X
i,σ,s



†
†
ĉi,s,σ + ĉi+δĉ, (152)−µ(s) ĉi,s,σ,s,σ i+δ ,s,σ11where the T_vec and Chem_vec have length N_FL and specify the hopping and the chemical
potentials, while the vectors Phi_X_vec, Phi_Y_vec and N_Phi_vec, also of length N_FL,
define the vector potential. Here i runs over sublattice A, and i + δ over the three nearest
neighbors of site i.
Square bilayer
The call:Call Set_Default_hopping_parameters_Bilayer_square(Hopping_Matrix, T1_vec, T2_vec,
Tperp_vec, Chem_vec, Phi_X_vec, Phi_Y_vec, Bulk, N_Phi_vec, N_FL, List,
Invlist, Latt, Latt_unit)

69

SciPost Phys. Codebases 1 (2022)

defines the Hopping_Matrix for the bilayer square lattice:




X

Ĥ T =

X


R
2πi i+δ†−t n(s) ĉi,s,σ,ne Φ0iA(s) (l)d l†ĉi+δ,s,σ,n + H.c. − µ(s) ĉi,s,σ,nĉi,s,σ,n δ={a1 ,a2 }i,σ,s,n

+

X

(s)

−t ⊥




†
ĉi,s,σ,1ĉi,s,σ,2 + H.c. , (153)i,σ,swhere the additional index n labels the layers.
Honeycomb bilayer
The call:Call Set_Default_hopping_parameters_Bilayer_honeycomb(Hopping_Matrix, T1_vec,
T2_vec, Tperp_vec, Chem_vec, Phi_X_vec, Phi_Y_vec, Bulk, N_Phi_vec,
N_FL, List, Invlist, Latt, Latt_unit)

defines the Hopping_Matrix for the bilayer honeycomb lattice:Ĥ T =X

X

i,σ,s,nδ={δ1 ,δ2 ,δ3 }

+

X

(s)

−t ⊥



†
e
−t n(s) ĉi,s,σ,n

X

R i+δ
i

!

(s)

A (l)d lĉi+δ,s,σ,n + H.c.


†
†
ĉ
+
H.c.
ĉi,s,σ,2 + ĉi+δĉi,s,σ,1,s,σ,1 i+δ ,s,σ,2
1

1

i,σ,s

+

2πi
Φ0



†
†
ĉ
.
ĉi,s,σ,n + ĉi+δ
−µ(s) ĉi,s,σ,ni+δ,s,σ,n,s,σ,n1i,σ,s,n(154)

1Here, the additional index n labels the layer. i runs over the unit cells and δ = {δ1 , δ2 , δ3 }over the three nearest neighbors.
N-leg ladder
The call:Call Set_Default_hopping_parameters_n_lag_ladder(Hopping_Matrix, T_vec, Tperp_vec,
Chem_vec, Phi_X_vec, Phi_Y_vec, Bulk, N_Phi_vec, N_FL,
List, Invlist, Latt, Latt_unit)

defines the Hopping_Matrix for the the N-leg ladder lattice:R
X NorbX
2πi i+a1 (s)A (l)d l
(s) †
(s) †
Φ0 i
Ĥ T =−t ĉi,s,σ,n eĉi+a ,s,σ,n + H.c. − µ ĉi,s,σ,n ĉi,s,σ,n1i,σ,s n=1+

X Norb
X−1
i,σ,s

n=1

(s)
−t ⊥



2πi

†
ĉi+δ
e Φ0
1 ,s,σ,nR (n)a2(n−1)a2

A(s) (l)dlĉi+δ ,s,σ,n+1 + H.c. . (155)1Here, the additional index n defines the orbital. Note that this lattice has open boundary
conditions in the a2 direction.

8.3

Predefined interaction vertices

In its most general form, an interaction Hamiltonian, expressed in terms of sums of perfectsquares, can be written, as presented in Section 1, as a sum of MV vertices:70

SciPost Phys. Codebases 1 (2022)

ĤV =
≡

MV
X
k=1
MV
X
k=1

Uk

¨ N N N
col X
dim
fl
X
X
σ=1 s=1ĉ †xσs Vx(ks)y ĉ yσs

«2


+ αks

x, y

≡

MV
X

Uk V̂ (k)

2

(4)

k=1

(k)

ĤV ,

which are encoded in one or more variables of type Operator, described in Sec. 5.1. We often
use arrays of Operator type, which should be initialized by repeatedly calling the subroutine
Op_make.
The module Predefined_Int_mod.F90 implements some of the most common of such(k)interaction vertices ĤV , as detailed in the remainder of this section, where we drop the superscript (k) when unambiguous.
8.3.1

SU(N) Hubbard interaction

The SU(N) Hubbard interaction on a given site i is given by
2
N
col

U X †
ĤV,i = +.
ĉ ĉ − 1/2
Ncol σ=1 iσ iσ(156)

Assuming that no other term in the Hamiltonian breaks the SU(N) color symmetry, then thisinteraction term conveniently corresponds to a single operator, obtained by calling, for eachof the Ndim sites i:
Call Predefined_Int_U_SUN(OP, I, N_SUN, DTAU, U)

which defines:
Op%P(1) = I
Op%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0))
Op%alpha = cmplx(-0.5d0,0.d0, kind(0.D0))
Op%g= SQRT(CMPLX(-DTAU*U/(DBLE(N_SUN)), 0.D0, kind(0.D0)))
Op%type = 2
1
U
To relate to Eq. (4), we have Vx(is)y = δ x, y δ x,i , αis = − 2 and Uk = Ncol . Here the flavor
index, s, plays no role.

8.3.2

Mz -Hubbard interaction

Call Predefined_Int_U_MZ(OP_up, Op_do, I, DTAU, U)

The Mz -Hubbard interaction is given by

ĤV = −

2
U X ††ĉi↑ ĉi↑ − ĉi↓ĉi↓ ,
2 i(157)

which corresponds to the general form of Eq. (4) by setting: Nfl = 2, Ncol ≡ N_SUN = 1,
MV = Nunit-cell , Uk = U2 , Vx(i,s=1)= δ x, y δ x,i , Vx(i,s=2)= −δ x, y δ x,i , and αis = 0; and which isyydefined in the subroutine Predefined_Int_U_MZ by two operators:
Op_up%P(1) = I
Op_up%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0))
Op_up%alpha = cmplx(0.d0, 0.d0, kind(0.D0))
Op_up%g= SQRT(CMPLX(DTAU*U/2.d0, 0.D0, kind(0.D0)))71

SciPost Phys. Codebases 1 (2022)

Op_up%type= 2

Op_do%P(1) = I
Op_do%O(1,1) = cmplx(1.d0, 0.d0, kind(0.D0))
Op_do%alpha = cmplx(0.d0, 0.d0, kind(0.D0))
Op_do%g= -SQRT(CMPLX(DTAU*U/2.d0, 0.D0, kind(0.D0)))
Op_do%type = 2

8.3.3

SU(N) V -interaction

Call Predefined_Int_V_SUN(OP, I, J, N_SUN, DTAU, V)

The interaction term of the generalized t-V model, given by
N
2
col

V X †ĉ ĉ + ĉ †jσ ĉiσ,ĤV,i, j = −Ncol σ=1 iσ jσ(158)

is coded in the subroutine Predefined_Int_V_SUN by a single symmetric operator:
Op%P(1) = I
Op%P(2) = J
Op%O(1,2) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op%O(2,1) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op%g= SQRT(CMPLX(DTAU*V/real(N_SUN,kind(0.d0)), 0.D0, kind(0.D0)))
Op%alpha = cmplx(0.d0, 0.d0, kind(0.D0))
Op%type = 2

8.3.4

Fermion-Ising coupling

Call Predefined_Int_Ising_SUN(OP, I, J, DTAU, XI)

The interaction between the Ising and a fermion degree of freedom, given by

ĤV,i, j = Ẑi, j ξ

Ncol 
Xσ=1

†ĉ jσ + ĉ †jσ ĉiσ ,ĉiσwhere ξ determines the coupling strength,
Predefined_Int_Ising_SUN:(159)

is implemented in the subroutine

Op%P(1) = I
Op%P(2) = J
Op%O(1,2) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op%O(2,1) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op%g= cmplx(-DTAU*XI,0.D0,kind(0.D0))
Op%alpha = cmplx(0d0,0.d0, kind(0.D0))
Op%type = 1

8.3.5

Long-Range Coulomb repulsion

Call Predefined_Int_LRC(OP, I, DTAU)

The Long-Range Coulomb (LRC) interaction can be written as




1X
N
N
ĤV =
n̂i −
Vi, j n̂ j −,N i, j
2
2
72

(160)

SciPost Phys. Codebases 1 (2022)

where
n̂i =

N
X
σ=1

†
ĉi,σ
ĉi,σ

and i corresponds to a super-index labelling the unit cell and orbital.
The code uses the following HS decomposition:
Z YP− N ∆τ φ V −1 φ −i∆τφi (n̂i − N2 )−∆τĤ V,ke=dφ e 4 i i, j j i
.
i

(161)

(162)

i

The above holds only provided that the matrix V is positive definite and the implementation
follows Ref. [51].
The LRC interaction is implemented in the subroutine Predefined_Int_LRC:
Op%P(1) = I
Op%O(1,1) = cmplx(1.d0 ,0.d0, kind(0.D0))
Op%alpha = cmplx(-0.5d0,0.d0, kind(0.D0))
Op%g= cmplx(0.d0 ,DTAU, kind(0.D0))
Op%type = 3

8.3.6

Jz -Jz interaction

Call Predefined_Int_Jz(OP_up, Op_do, I, J, DTAU, Jz)

Another predefined vertex is:

ĤV,i, j = −2|Jz | z 2 |Jz | z 2|Jz |  z
Si − sgn |Jz |S zj = Jz Siz S zj −(Si ) −(S j ) ,
2
2
2

(163)

which, if particle fluctuations are frozen on the i and j sites, then (Siz )2 = 1/4 and the interaction corresponds to a Jz -Jz ferromagnetic or antiferromagnetic coupling.
The implementation of the interaction in Predefined_Int_Jz defines two operators:
Op_up%P(1) = I
Op_up%P(2) = J
Op_up%O(1,1) = cmplx(1.d0,
0.d0, kind(0.D0))
Op_up%O(2,2) = cmplx(-Jz/Abs(Jz),
0.d0, kind(0.D0))
Op_up%alpha = cmplx(0.d0,
0.d0, kind(0.D0))
Op_up%g= SQRT(CMPLX(DTAU*Jz/8.d0, 0.d0, kind(0.D0)))
Op_up%type = 2
Op_do%P(1) = I
Op_do%P(2) = J
Op_do%O(1,1) = cmplx(1.d0,
0.d0, kind(0.d0))
Op_do%O(2,2) = cmplx(-Jz/Abs(Jz),
0.d0, kind(0.d0))
Op_do%alpha = cmplx(0.d0,
0.d0, kind(0.d0))
Op_do%g= -SQRT(CMPLX(DTAU*Jz/8.d0, 0.d0, kind(0.d0)))
Op_do%type = 2

8.4

Predefined observables

The types Obser_Vec and Obser_Latt described in Section 5.4 handle arrays of scalar observables and correlation functions with lattice symmetry respectively.
The module
Predefined_Obs provides a set of standard equal-time and time-displaced observables, as73

SciPost Phys. Codebases 1 (2022)

described below. It contains procedures and functions. Procedures provide a complete handling of the observable structure, i.e., they take care, for example, of incrementing the counterand of the average sign. On the other hand, functions only provide the Wick decomposition
result, and the handling of the observable structure is left to the user.
The predefined measurements methods take as input Green functions GR, GT0, G0T, G00,
and GTT, defined in Sec. 7.6.2 and 7.6.3, as well as N_SUN, time slice Ntau, lattice information,and so on – see Tab. 20.
Table 20: Arguments taken by the subroutines in the module Predefined_Obs.
Note that a given method makes use of only a subset of this list, as described in thissection. Note also that we use the superindex i = (i, ni ) where i denotes the unit celland ni the orbital.
Argument

Type

Description

Latt
Latt_Unit

Lattice
Unit_cellList(Ndim,2)

int

Lattice as a variable of type Lattice, see Sec. 5.3
Unit cell as a variable of type Unit_cell, seeSec. 5.3
For every site index I, stores the corresponding lattice position, List(I,1), and the (local) orbital index, List(I,2)
Imaginary time τ
Equal-time Green function GR(i,j,s) = 〈ci,s c †j,s 〉NT
int
GR(Ndim,Ndim,N_FL) cmplx†
GRC(Ndim,Ndim,N_FL) cmplx
GRC(i,j,s) = 〈ci,sc j,s 〉 = δi, j − GR(j,i,s)GT0(Ndim,Ndim,N_FL) cmplx
Time-displaced Green function 〈〈T ĉi,s (τ)ĉ †j,s (0)〉〉G0T(Ndim,Ndim,N_FL) cmplx
Time-displaced Green function 〈〈T ĉi,s (0)ĉ †j,s (τ)〉〉
G00(Ndim,Ndim,N_FL) cmplx
Time-displaced Green function 〈〈T ĉi,s (0)ĉ †j,s (0)〉〉GTT(Ndim,Ndim,N_FL) cmplx
Time-displaced Green function 〈〈T ĉi,s (τ)ĉ †j,s (τ)〉〉
N_SUN
int
Number of fermion colors Ncol
ZS
cmplx
ZS = sgn(C), see Sec. 5.4

ZP
cmplx
ZP = e−S(C) / Re e−S(C) , see Sec. 5.4
Obs
Obser_Latt Output: one or more measurement result

8.4.1

Equal-time SU(N) spin-spin correlations

A measurement of SU(N) spin-spin correlations can be obtained through:Call Predefined_Obs_eq_SpinSUN_measure(Latt, Latt_unit, List, GR, GRC, N_SUN, ZS,
ZP, Obs)

If N_FL = 1 then this routine returns
N 2 −12N X†
Obs(i − j , ni , n j ) = 2〈〈ĉi,nT a ĉi,n ĉ †j ,n T a ĉ j,n 〉〉C ,iijj
N − 1 a=1

Ta

where

(164)

are the generators of SU(N)satisfying the normalization conditions
††aTr[T T ] = δa,b /2 , Tr[T ] = 0, ĉ j ,n = ĉ j ,n ,1 , · · · , ĉ †j,n ,N is an N-flavored spinor, j cora

b

j

j

responds to the unit-cell index and n j labels the orbital.

74

jSciPost Phys. Codebases 1 (2022)

Using Wick’s theorem, valid for a given configuration of fields, we obtainN 2 −1N
2N X Xaa
Obs = 2Tα,βTγ,δ×N − 1 a=1 α,β,γ,δ=1


†
†
†
†
. (165)〈〈ĉi,n
ĉ
〉〉
〈〈ĉ
ĉ
〉〉
+
〈〈ĉ
ĉ
〉〉
〈〈ĉ
ĉ
〉〉
C
C
C
C
,α i,n ,βj ,n ,γ j,n ,δ
i,n ,α j ,n ,δ
i,n ,β j,n ,γ
i

j

i

i

j

j

j

i

For this SU(N) symmetric code, the Green function is diagonal in the spin index and spin
independent:††〈〈ĉi,nĉ〉〉 = δα,β 〈〈ĉi,nĉ j ,n 〉〉C .
(166),α j,n ,β C
j

i

i

j

Hence,
N 2 −1
2N X 
†Obs = 2
[TrT a ]2 〈〈ĉi,nĉ 〉〉C 〈〈ĉ †j ,n ĉ j ,n 〉〉C
i i,nijj
N − 1 a=1
a

+ Tr [T Ta†] 〈〈ĉi,nĉ 〉〉C 〈〈ĉi,n ĉ †j,n 〉〉C
i j ,n jij†ĉ j ,n 〉〉C 〈〈ĉi,n ĉ †j ,n 〉〉C .
= N 〈〈ĉi,n

(167)

j

i

j

i

Note that we can also define the generators of SU(N) as
NŜ µν (x) = ĉ †x,µ ĉ x,ν − δµ,ν

1 X †ĉ ĉ .
N α=1 x,α x,α(168)With this definition, the spin-spin correlations read:
N
X
µ,ν=1

〈〈Ŝ µν (x)Ŝ νµ ( y)〉〉C = (N 2 − 1)〈〈ĉ x† ĉ y 〉〉C 〈〈ĉ x ĉ †y 〉〉C .

(169)

In the above x denotes a super index defining site and orbital. Aside from the normalization,
this formulation gives the same result.
8.4.2

Equal-time spin correlations

A measurement of the equal-time spin correlations can be obtained by:Call Predefined_Obs_eq_SpinMz_measure(Latt, Latt_unit, List, GR, GRC, N_SUN,ZS, ZP, ObsZ, ObsXY, ObsXYZ)

If N_FL=2 and N_SUN=1, then the routine returns:
†ObsZ i − j, ni , n j = 4〈〈ĉi,nS z ĉi,n ĉ †j ,n S z ĉ j,n 〉〉C
i

i

j

j

†
− 4〈〈ĉi,nS z ĉi,n 〉〉C 〈〈 ĉ †j,n S z ĉ j ,n 〉〉C ,
i
i
j
j





†
†
ObsXY i − j, ni , n j = 2 〈〈ĉi,nS x ĉi,n ĉ †j ,n S x ĉ j ,n 〉〉C + 〈〈ĉi,nS y ĉi,n c †j ,n S y ĉ j ,n 〉〉C ,
i
i
j
j
i
i
j
j



2 · ObsXY + ObsZ
.
3


†
†
†
Here ĉi,n= ĉi,n,ĉ
is a two component spinor and S = 21 σ, with,↑ i,n ,↓ObsXYZ =
i

i

(170)

i

σ=



 
 

0 1
0 −i
1 0
,
,
,
1 0
i 0
0 −1

the Pauli spin matrices.
75

(171)

SciPost Phys. Codebases 1 (2022)

8.4.3

Equal-time Green function

A measurement of the equal-time Green function can be obtained by:Call Predefined_Obs_eq_Green_measure(Latt, Latt_unit, List, GR, GRC, N_SUN,ZS, ZP, Obs)

Which returns:
Ncol X
NflX†
Obs(i − j, ni , n j ) =〈ĉi,nĉ
〉.
,σ,s j ,n ,σ,si

σ=1 s=1

8.4.4

j

(172)

Equal-time density-density correlations

A measurement of equal-time density-density correlations can be obtained by:Call Predefined_Obs_eq_Den_measure(Latt, Latt_unit, List, GR, GRC, N_SUN,ZS, ZP, Obs)

Which returns:

Obs(i − j , ni , n j ) = 〈〈N̂i,ni N̂ j,n j 〉 − 〈N̂i,ni 〉〈N̂ j ,n j 〉〉C ,

(173)

where
N̂i,ni =8.4.5

Ncol X
Nfl
X
σ=1 s=1

†
ĉ
.
ĉi,n
,σ,s i,n ,σ,s

(174)

i

i

Time-displaced Green function

A measurement of the time-displaced Green function can be obtained by:Call Predefined_Obs_tau_Green_measure(Latt, Latt_unit, List, NT, GT0, G0T, G00,
GTT, N_SUN, ZS, ZP, Obs)

Which returns:
Ncol X
NflX†
Obs(i − j , τ, ni , n j ) =〈〈ĉi,n(τ)ĉ j,n ,σ,s 〉〉C .
,σ,sσ=1 s=1

8.4.6

i

j

(175)

Time-displaced SU(N) spin-spin correlations

A measurement of time-displaced spin-spin correlations for SU(N) models (Nfl = 1) can beobtained by:Call Predefined_Obs_tau_SpinSUN_measure(Latt, Latt_unit, List, NT, GT0, G0T, G00,
GTT, N_SUN, ZS, ZP, Obs)
N 2 −1
2N X †〈ĉ (τ)T a ĉi,n (τ) ĉ †j,n T a ĉ j,n 〉〉C ,Obs(i − j , τ, ni , n j ) = 2
ijj
N − 1 a=1 i,ni

where T a are the generators of SU(N) (see Sec. 8.4.1 for more details).

76

(176)

SciPost Phys. Codebases 1 (2022)

8.4.7

Time-displaced spin correlations

A measurement of time-displaced spin-spin correlations for Mz models (Nfl = 2, Ncol = 1) isreturned by:Call Predefined_Obs_tau_SpinMz_measure(Latt, Latt_unit, List, NT, GT0, G0T, G00,
GTT, N_SUN, ZS, ZP, ObsZ, ObsXY, ObsXYZ)

Which calculates the following observables:†
ObsZ(i − j , τ, ni , n j ) = 4〈〈ĉi,n(τ)S z ĉi,n (τ) ĉ †j ,n S z ĉ j,n 〉〉C
j
i
i
j
†
− 4〈〈ĉi,nS z ĉi,n 〉〉C 〈〈 ĉ †j ,n S z ĉ j,n 〉〉C ,
j
i
j
i

†
ObsXY(i − j , τ, ni , n j ) = 2 〈〈ĉi,n(τ)S x ĉi,n (τ) ĉ †j ,n S x ĉ j,n 〉〉C
i

i

j

j


†
+ 〈〈ĉi,n(τ)S y ĉi,n (τ) c †j ,n S y ĉ j ,n 〉〉C ,i

ObsXYZ =8.4.8

2 · ObsXY + ObsZ
.
3

i

j

j

(177)

Time-displaced density-density correlations

A measurement of time-displaced density-density correlations for general SU(N) models is
given by:Call Predefined_Obs_tau_Den_measure(Latt, Latt_unit, List, NT, GT0, G0T, G00,
GTT, N_SUN, ZS, ZP, Obs)

Which returns:

Obs(i − j , τ, ni , n j ) = 〈〈N̂i,ni (τ)N̂ j ,n j 〉 − 〈N̂i,ni 〉〈N̂ j ,n j 〉〉C .

(178)

The density operator is defined in Eq. (174).
8.4.9

Dimer-Dimer correlations

Let
1
Ŝ µν (x) = ĉ †x,µ ĉ x,ν − δµ,νNXĉ † ĉN α=1 x,α x,α(179)

be the generators of SU(N). Dimer-Dimer correlations are defined as:γ〈〈Ŝ µν (x, τ)Ŝ νµ ( y, τ)Ŝ δ (w)Ŝ δγ (z)〉〉C ,(180)

where the sum over repeated indices from 1 · · · N is implied. The calculation
is carried out forPN†
the self-adjoint antisymmetric representation of SU(N) for which α=1 ĉ x,α ĉ x,α = N /2, suchthat the generators can be replaced by:1Ŝ µν (x) = ĉ †x,µ ĉ x,ν − δµ,ν .
2

(181)

The function
Complex (Kind=Kind(0.d0)) function Predefined_Obs_dimer_tau(x, y, w, z, GT0, G0T,
G00, GTT, N_SUN, N_FL)

returns the value of the time-displaced dimer-dimer correlation function. The function
Complex (Kind=Kind(0.d0)) function Predefined_Obs_dimer_eq(x, y, w, z, GR, GRC,
N_SUN, N_FL)

77

SciPost Phys. Codebases 1 (2022)

returns the value of the equal-time dimer-dimer correlation function:
γ〈〈Ŝ µν (x, τ)Ŝ νµ ( y, τ)Ŝ δ (w, τ)Ŝ δγ (z, τ)〉〉C .

(182)

Here, both GR and GRC are on time slice τ.
To compute the background terms, the function
Complex (Kind=Kind(0.d0)) function Predefined_Obs_dimer0_eq(x, y, GR, N_SUN, N_FL)

returns〈〈Ŝ µν (x, τ)Ŝ νµ ( y, τ)〉〉C .

(183)

All routines are programmed for N_SUN = 2,4,6,8 at N_FL=1. The routines also handle
the case of broken SU(2) spin symmetry corresponding to N_FL=2 and N_SUN=1. To carryout the Wick decomposition and sums over spin indices, we use the Mathematica notebooks
DimerDimer_SU2_NFL_2.nb and DimerDimer_SUN_NFL_1.nb.
8.4.10

Cotunneling for Kondo models

The Kondo lattice model (KLM), ĤKLM is obtained by carrying out a canonical SchriefferWolf [147] transformation of the periodic Anderson model (PAM), ĤPAM . Hence, eŜ ĤPAM
e−S = ĤKLM with Ŝ † = −Ŝ. Let fˆx,σ create an electron on the correlation f-orbital of the PAM.
Then,
 2V
0
2V  †
˜
†
z
0 †
−Ŝ
eŜ fˆx,σ'ĉ x,−σ0 Ŝ σfˆ† 0 .
(184)0ex + σ ĉ x,σ0 Ŝ x ≡U
U x,σ
In the above, it is understood that σ0 takes thePvalue 1 (−1) for up (down) spin degrees of
†
†
†
1
σ0
z
ˆ
ˆ
freedom, that Ŝ x = f x,σ0 f x,−σ0 and that Ŝ x = 2 σ0 σ0 fˆx,σ0 f x,σ0 . Finally, ĉ x,σ0 corresponds tothe conduction electron that hybridizes with fˆ† 0 . This form matches that derived in Ref. [148]x,σand a calculation of the former equation can be found in Ref. [149]. An identical, but moretransparent formulation is given in Ref. [150] and reads:X˜†ĉ †x,σ0 σσ0 ,σ · Ŝ x ,
(185)
=
fˆx,σ
σ0

where σ denotes the vector of Pauli spin matrices. With the above, one will readily show that˜
the fˆ† transforms as fˆ† under an SU(2) spin rotation. The function
x,σ

x,σ

Complex (Kind=Kind(0.d0)) function Predefined_Obs_Cotunneling(x_c, x, y_c, y,GT0, G0T, G00, GTT, N_SUN, N_FL)

returns the value of the time displaced correlation function:X˜†˜〈〈 fˆx,σ(τ) fˆy,σ (0)〉〉C .

(186)

σ

Here, x c and yc correspond to the conduction orbitals that hybridize with the x and y forbitals. The routine works for SU(N) symmetric codes corresponding to N_FL=1 and N_SUN= 2,4,6,8. For the larger N-values, we have replaced the generators of SU(2) with that of
SU(N). The routine also handles the case where spin-symmetry is broken by, for instance, aZeeman field. This corresponds to the case N_FL=2 and N_SUN=1. Note that the function
only carries out the Wick decomposition and the handling of the observable type corresponding to this quantity has to be done by the user. To carry out the Wick decomposition andsums over spin indices, we use the Mathematica notebooks Cotunneling_SU2_NFL_2.nb
and Cotunneling_SUN_NFL_1.nb.

78

SciPost Phys. Codebases 1 (2022)

8.4.11

Rényi Entropy

The module entanglement_mod.F90 allows one to compute the 2nd Rényi entropy, S2 , fora subsystem. Using Eq. (24), S2 can be expressed as a stochastic average of an observable
constructed from two independent simulations of the model [60]:X
e−S2 =
P(C2 )P(C1 ) det [GA(τ0 ; C1 )GA(τ0 ; C2 ) − (1 − GA(τ0 ; C1 ))(1 − GA(τ0 ; C2 ))] ,C1 ,C2(187)
where GA(τ0 ; Ci ), i = 1, 2 is the Green function matrix restricted to the desired subsystem A
at a given time-slice τ0 , and for the configuration Ci of the replica i. The degrees of freedom
defining the subsystem A are lattice site, flavor index, and color index.
Notice that, due to its formulation, sampling S2 requires an MPI simulation with at least 2
processes. Also, only real-space partitions are currently supported.
A measurement of the 2nd Rényi entropy can be obtained by:Call Predefined_Obs_scal_Renyi_Ent(GRC, List, Nsites, N_SUN, ZS, ZP, Obs)

which returns the observable Obs, for which 〈Obs〉 = e−S2 . The subsystem A can be defined in a
number of different ways, which are handled by what we call specializations of the subroutine,
described as follows.
In the most general case, List(:, N_FL, N_SUN) is a three-dimensional array that contains the list of lattice sites in A for every flavor and color index; Nsites(N_FL, N_SUN) isthen a bidimensional array that provides the number of lattice sites in the subsystem for every
flavor and color index; and the argument N_SUN must be omitted in the call.
For a subsystem whose degrees of freedom, for a given flavor index, have a common valueof color indexes, Predefined_Obs_scal_Renyi_Ent can be called by providing List(:,N_FL) as a bidimensional array that contains the list of lattice sites for every flavor index. In
this case, Nsites(N_FL) provides the number of sites in the subsystem for any given flavor
index, while N_SUN(N_FL) contains the number of color indexes for a given flavor index.
Finally, a specialization exists for the simple case of a subsystem whose lattice degrees of
freedom are flavor- and color-independent. In this case, List(:) is a one-dimensional array
containing the lattice sites of the subsystem. Nsites is the number of sites, and N_SUN is
the number of color indexes belonging to the subsystem. Accordingly, for every element I of
List, the subsystem contains all degrees of freedom with site index I, any flavor index, and
1 . . . N_SUN color index.
Mutual Information
The mutual information between two subsystems A and B is given by
I2 = − ln〈Renyi_A〉 − ln〈Renyi_B〉 + ln〈Renyi_AB〉 ,(188)

where Renyi_A, Renyi_B, and Renyi_AB are the second Rényi entropies of A, B, and A ∪ B,
respectively.
The measurements necessary for computing I2 are obtained by:Call Predefined_Obs_scal_Mutual_Inf(GRC, List_A, Nsites_A, List_B, Nsites_B,
N_SUN, ZS, ZP, Obs)

which returns the 2nd Rényi entropies defined above, stored in the variable Obs. Here, List_A
and Nsites_A are input parameters describing the subsystem A – with the same conventions
and specializations described above – and List_B and Nsites_B are the corresponding input
parameters for the subsystem B, while N_SUN is assumed to be identical for A and B.

79

SciPost Phys. Codebases 1 (2022)

8.5

Predefined trial wave functions

When using the projective algorithm (see Sec. 3), trial wave functions must be specified. These
are stored in variables of the WaveFunction type (Sec. 5.5). The ALF package provides a setof predefined trial wave functions |Ψ T,L/R 〉=WF_L/R, returned by the call:
Call Predefined_TrialWaveFunction(Lattice_type, Ndim, List, Invlist, Latt,
Latt_unit, N_part, N_FL, WF_L, WF_R)

Twisted boundary conditions (Phi_X_vec=0.01) are implemented for some lattices in orderto generate non-degenerate trial wave functions. Here the marker “_vec” indicates the variable may assume different values depending on the flavor (e.g., spin up and down). Currently
predefined trial wave functions are flavor independent.
The predefined trial wave functions correspond to the solution of the non-interacting tightbinding Hamiltonian on each of the predefined lattices. These solutions are the ground statesof the predefined hopping matrices (Sec. 8.2) with default parameters, for each lattice, as
follows.
8.5.1

SquareParameter values for the predefined trial wave function on the square lattice:
Checkerboard
Symm
Bulk
N_Phi_vec
Phi_X_vec
Phi_Y_vec
Ham_T_vec
Ham_Chem_vec
Dtau

8.5.2

= .false.
= .false.
= .false.
= 0= 0.01d0= 0.d0= 1.d0= 0.d0= 1.d0Honeycomb

The twisted boundary condition for the square lattice lifts the degeneracy present at half-band
filling, but breaks time reversal symmetry as well as the C4 lattice symmetry. If time reversal
symmetry is required to avoid the negative sign problem (that would be the case for the attractive Hubbard model at finite doping), then this choice of the trial wave function will introduce
a negative sign. One should then use the trial wave function presented in Sec. 7.5. For the
Honeycomb case, the trial wave function we choose is the ground state of the tight binding
model with small next-next-next nearest hopping matrix element t 0 [135]. This breaks the C3
symmetry and shifts the Dirac cone away from the zone boundary. Time reversal symmetry is
however not broken. Alternatively, one could include a small Kekule mass term. As shown inSec. 3.3, both choices of trial wave function produce good results.
8.5.3

N-leg ladderParameter values for the predefined trial wave function on the N-leg ladder lattice:
Checkerboard = .false.
Symm= .false.
Bulk= .false.
N_Phi_vec= 0
Phi_X_vec= 0.01d0
Phi_Y_vec= 0.d0
Ham_T_vec= 1.d0
Ham_Tperp_vec = 1.d080

SciPost Phys. Codebases 1 (2022)

Ham_Chem_vec = 0.d0
Dtau
= 1.d0

8.5.4

Bilayer square

Parameter values for the predefined trial wave function on the bilayer square lattice:
Checkerboard = .false.
Symm= .false.
Bulk= .false.
N_Phi_vec= 0
Phi_X_vec= 0.d0
Phi_Y_vec= 0.d0
Ham_T_vec= 1.d0
Ham_T2_vec= 0.d0
Ham_Tperp_vec = 1.d0
Ham_Chem_vec = 0.d0
Dtau
= 1.d0

8.5.5

Bilayer honeycomb

Parameter values for the predefined trial wave function on the bilayer honeycomb lattice:
Checkerboard = .false.
Symm= .false.
Bulk= .false.
N_Phi_vec= 0
Phi_X_vec= 0.d0
Phi_Y_vec= 0.d0
Ham_T_vec= 1.d0
Ham_T2_vec= 0.d0
Ham_Tperp_vec = 1.d0
Ham_Chem_vec = 0.d0
Dtau
= 1.d09Model Classes

The ALF library comes with five model classes: (i) SU(N) Hubbard models, (ii) O(2N) t-V
models, (iii) Kondo models, (iv) long-range Coulomb models, and (v) generic Z2 lattice gauge
theories coupled to Z2 matter and fermions. Below we detail the functioning of these classes.

9.1

SU(N) Hubbard models Hamiltonian_Hubbard_mod.F90

The parameter space for this model class reads:&VAR_Hubbard
Mz
= .T.
ham_T
= 1.d0ham_chem = 0.d0
ham_U
= 4.d0
ham_T2= 1.d0ham_U2= 4.d0
ham_Tperp = 1.d0
Continuous = .F.

!! Variables for the Hubbard class! Whether to use the M_z-Hubbard model: Nf=2;! N_SUN must be even. HS field couples to the! z-component of magnetization! Hopping parameter! Chemical potential! Hubbard interaction! For bilayer systems! For bilayer systems! For bilayer systems! For continuous HS decomposition

81

SciPost Phys. Codebases 1 (2022)/

In the above listing, ham_T and ham_T2 correspond to the hopping in the first and second
layers respectively and ham_Tperp is to the interlayer hopping. The Hubbard U term hasan orbital index, ham_U for the first and ham_U2 for the second layers. Finally, ham_chem
corresponds to the chemical potential. If the flag Mz is set to .False., then the code simulates
the following SU(N) symmetric Hubbard model:
Ĥ =

X

N
X

(i,δ),( j,δ0 ) σ=1

+

2πi

†
T(i,δ),( j ,δ0 ) ĉ(i,δ),σ
e Φ0

XX U
i

δ

δ

 N
X

N

σ=1

R j+δ0i+δ

A(l)d lĉ( j,δ0 ),σ


N
XX
 2
†
†
ĉ(i,δ),σ ĉ(i,δ),σ − 1/2−µĉ(i,δ),σĉ(i,δ),σ . (189)(i,δ) σ=1

The generic hopping is taken from Eq. (141) with appropriate boundary conditions given by
Eq. (142). The index i runs over the unit cells, δ over the orbitals in each unit cell and σfrom 1 to N and encodes the SU(N) symmetry. Note that N corresponds to N_SUN in the code.
The flavor index is set to unity such that it does not appear in the Hamiltonian. The chemical
potential µ is relevant only for the finite temperature code.
If the variable Mz is set to .True., then the code requires N_SUN to be even and simulates
the following Hamiltonian:
N /2 X
X

X

Ĥ =

2πi

(i,δ),( j ,δ0 ) σ=1 s=1,2

−

XX U
i

−µ

δ

δ

N

†
T(i,δ),( j,δ0 ) ĉ(i,δ),σ,se Φ0

N /2 
X
σ=1

N /2 XXX(i,δ) σ=1 s=1,2

R j+δ0i+δ

A(l)d lĉ( j,δ0 ),σ,s!2††ĉ(i,δ),σ,2ĉ(i,δ),σ,2 − ĉ(i,δ),σ,1ĉ(i,δ),σ,1†ĉ(i,δ),σ,sĉ(i,δ),σ,s .



(190)

In this case, the flavor index N_FL takes the value 2. Cleary at N = 2, both modes correspondto the Hubbard model. For N even and N > 2 the models differ. In particular in the latter
Hamiltonian the U(N) symmetry is broken down to U(N/2) ⊗ U(N/2).
It the variable Continuous=.T. then the code will use the generic HS transformation:
Z
p
2
1
αÂ2
e
=p
dφe−φ /2+ 2αÂ ,(191)
2π
as opposed to the discrete version of Eq. 11. If the Langevin flag is set to false, the code will
use the single spin-flip update:
φ → φ + Amplitude (ξ − 1/2) ,(192)

where ξ is a random number ∈ [0, 1] and Amplitude is defined in the Fields_mod.F90
module. Since this model class works for all predefined lattices (see Fig. 5) it includes the
SU(N) periodic Anderson model on the square and Honeycomb lattices. Finally, we note thatthe executable for this class is given by Hubbard.out.
As an example, we can consider the periodic Anderson model. Here we choose theBilayer_square lattice Ham_U = Ham_T2 = 0, Ham_U2= U f , Ham_tperp= V and Ham_T= 1.
The pyALF based python script Hubbard_PAM.py produces the data shown in Fig. 7 for the
L=8 lattice.
82

SciPost Phys. Codebases 1 (2022)

θ = 10, Uf /t = 4.0
25

L=10
L=8
L=6
L=4

S f f (π, π)

20
15
10
5
0
0.4

0.6

0.8

1

1.2

1.4

1.6

V /t

Figure 7: The periodic Anderson model. Here we plot the equal-time spin structure
factor of the f-electrons at q = (π, π). This quantity is found in the file SpinZ_eqJK.
The pyALF based python script Hubbard_PAM.py produces the data shown for the
L = 8 lattice. One sees that for the chosen value of U f /t the competition between
the RKKY interaction and Kondo screening drives the system through a magnetic
order-disorder transition at Vc /t ' 1 [151].

9.2

SU(N) t-V models tV_mod.F90

The parameter space for this model class reads:&VAR_tV
ham_T= 1.d0ham_chem = 0.d0
ham_V
= 0.5d0
ham_T2= 1.d0
ham_V2= 0.5d0
ham_Tperp = 1.d0
ham_Vperp = 0.5d0/!! Variables for the t-V class! Hopping parameter! Chemical potential! interaction strength! For bilayer systems! For bilayer systems! For bilayer systems! For bilayer systems

In the above ham_T and ham_T2 and ham_Tperp correspond to the hopping in the first andsecond layers respectively and ham_Tperp is to the interlayer hopping. The interaction term
has an orbital index, ham_V for the first and ham_V2 for the second layers, and ham_Vperp forinterlayer coupling. Note that we use the same sign conventions here for both the hopping parameters and the interaction strength. This implies a relative minus sign between here and theUδ interaction strength of the Hubbard model (see Sec. 9.1). Finally ham_chem corresponds
to the chemical potential. Let us introduce the operatorb̂〈(i,δ),( j ,δ0 )〉 =

N
X
σ=1

2πi

†
ĉ(i,δ),σe Φ0The model is then defined as follows:XĤ =T(i,δ),( j ,δ0 ) b̂〈(i,δ),( j ,δ0 )〉 +〈(i,δ),( j ,δ0 )〉

−µ

N
XX
(i,δ) σ=1

R j+δ0i+δ

A(l)dlX〈(i,δ),( j ,δ0 )〉†ĉ(i,δ),σĉ(i,δ),σ .

ĉ( j,δ0 ),σ + H.c. .

V(i,δ),( j,δ0 )Nb̂〈(i,δ),( j ,δ0 )〉

(193)

2

(194)

The generic hopping is taken from Eq. (141) with appropriate boundary conditions given by
Eq. (142). The index i runs over the unit cells, δ over the orbitals in each unit cell and σ
83

SciPost Phys. Codebases 1 (2022)

from 1 to N , encoding the SU(N) symmetry. Note that N corresponds to N_SUN in the code.
The flavor index is set to unity such that it does not appear in the Hamiltonian. The chemical
potential µ is relevant only for the finite temperature code. An example showing how to run
this model class can be found in the pyALF based Jupyter notebook tV_model.ipynb.
As a concrete example, we can consider the Hamiltonian of the t-V model of SU(N) fermionson the square lattice,Ĥ = − tXNb̂〈i, j 〉 −〈i, j〉

XX
2
V X
†
ĉi,σ
ĉi,σ ,b̂〈i, j〉 − µ
N
i σ=1

(195)

〈i, j 〉

which can be simulated by setting ham_T = t, ham_V = V , and ham_chem = µ. At half-band
filling µ = 0, the sign problem is absent for V > 0 and for all values of N [79, 152]. For evenvalues of N no sign problem occurs for V > 0 and arbitrary chemical potentials [78].
Note that in the absence of orbital magnetic fields, the model has an O(2N ) symmetry.
This can be seen by writing the model in a Majorana basis (see, for instance, Ref. [21]).

9.3

SU(N) Kondo lattice models Kondo_mod.F90

The Kondo lattice model we consider is an SU(N) generalization of the SU(2) Kondo-model
discussed in [31, 32]. Here we follow the work of Ref. [50]. Let T a be the N 2 − 1 generatorsof SU(N) that satisfy the normalization condition: 1
Tr T a T b = δa,b .
2

(196)

For the SU(2) case, T a corresponds to the T = 21 σ with σ a vector of the three Pauli spin
matrices, Eq. (171). The Hamiltonian is defined on bilayer square or honeycomb lattices, withhopping restricted to the first layer (i.e conduction orbitals ci† ) and spins, f-orbitals, on thesecond layer.
Ĥ = −tN XX〈i, j〉 σ=1

2πi

†
ĉi,σ
e Φ0

Rj
i

A·d l



ĉ j,σ + H.c. − µ

X

†
ĉi,σ
ĉi,σ

i,σ



N 2 −1
Uc X c N 2 2J X a,c a, f
+
n̂i −
+
T̂ T̂i . (197)
N i
2
N i,a=1 i
In the above, i is a super-index accounting for the unit cell and orbital,
a,c

T̂i

=

N
X
σ,σ0 =1

a, f

†
a
ĉi,σ
Tσ,σ
0 ĉ i,σ0 , T̂i=

NXσ,σ0 =1

†
a
c
ˆ
fˆi,σ
Tσ,σ
0 f i,σ0 , and n̂ i =

N
X
σ=1

†
ĉi,σ
ĉi,σ .

(198)

Finally, the constraint
N
X

N
f
† ˆ
fˆi,σ
f i,σ ≡ n̂i =
2
σ=1

(199)

holds. Some rewriting has to be carried out so as to implement the model. First, we use therelation:


X
1
1
a
a
Tα,β Tα0 ,β 0 =δα,β 0 δα0 ,β − δα,β δα0 ,β 0 ,2Nato show that in the unconstrained Hilbert space,
N 2 −1 J
J X †2J X a,c a, f
T̂i T̂i = −D̂i D̂i + D̂i D̂i† +
N a=1
2N i
N
84



n̂ci
2

f

+

n̂i

2

f 

−

n̂ci n̂i
N,

SciPost Phys. Codebases 1 (2022)withD̂i† =

N
X
σ=1

† ˆ
ĉi,σ
f i,σ .

f
In the constrained Hilbert space, n̂i = N /2, the above gives:
N 2 −12  J
2J  †2J X a,c a, f
T̂i T̂i = −+ .
D̂i + D̂i + i D̂i† − i D̂i
N a=1
4N
4

(200)

The perfect square form complies with the requirements of ALF. We still have to impose theconstraint. To do so, we work in the unconstrained Hilbert space and add a Hubbard U-termon the f-orbitals. With this addition, the Hamiltonian we simulate reads:

ĤQMC = −tN XX〈i, j〉 σ=1

2πi

†
ĉi,σ
e Φ0

Rj
i

A·d l



ĉ j,σ + H.c. − µ

X

Uc
†
ĉi,σ
ĉi,σ +

XNn̂ci −

22
2  U f X f N 2
2
J  †
†
+
D̂i + D̂i + i D̂i − i D̂in̂i −. (201)
−
4N
N i
2
i,σ

N

i

The key point for the efficiency of the code, is to see that


 
N 2
f
ĤQMC , n̂i −
= 0,
2

(202)

such that the constraint is implemented efficiently. In fact, for the finite temperature code atinverse temperature β, the unphysical Hilbert space is suppressed by a factor e−β U f /N .
The SU(2) case
The SU(2) case is special and allows for a more efficient implementation than the one describedabove. For the SU(2) case, the Hubbard term is related to the fermion parity,f2 (−1)n̂i + 1fn̂i − 1 =
,

(203)

2

2
such that we can omit the current-term i D̂i† − i D̂i without violating Eq. (202). As in Refs. [31,32, 153], the Hamiltonian that one simulates reads:

Ĥ = −t

X 

2πi

†
ĉi,σ
e Φ0

Rj

A·d l
i



ĉ j,σ + H.c. +〈i, j〉,σ|{z≡Ĥ t Uc

2
Uc X cn̂i − 1
2 i
}


2
2
Uf X  f
JX X † ˆ†ˆ−ĉi,σ f i,σ + f i,σ ĉi,σ +n̂i − 1 . (204)
4 i
2 i
σ
|
{z
}
≡ĤU f

The relation to the Kondo lattice model follows from expanding the square of the hybridization
to obtain:
X

f
z, f
x, f
y,c
y, f
z,c
x,c
Ĥ = Ĥ t Uc + J
Ŝic · Ŝi + η̂i · η̂i − η̂i · η̂i − η̂i · η̂i+ ĤU f ,
(205)
i

85

SciPost Phys. Codebases 1 (2022)

where the η-operators relate to the spin-operators via a particle-hole transformation in one
spin sector:†η̂αi = P̂ −1 Ŝiα P̂ with P̂ −1 ĉi,↑ P̂ = (−1)i x +i y ĉi,↑and P̂ −1 ĉi,↓ P̂ = ĉi,↓ .

(206)

f

Since the η̂ f and Ŝ f operators do not alter the parity [(−1)n̂i ] of the f -sites,Ĥ, ĤU f = 0 .

(207)

Thereby, and for positive values of U, doubly occupied or empty f -sites – corresponding toeven parity sites – are suppressed by a Boltzmann factor e−β U f /2 in comparison to odd parity
sites. Thus, essentially, choosing β U f adequately allows one to restrict the Hilbert space to
odd parity f -sites. In this Hilbert space, η̂ x, f = η̂ y, f = η̂z, f = 0 such that the Hamiltonian(204) reduces to the Kondo lattice model.
QMC implementation
The name space for this model class reads:&VAR_Kondo
ham_T= 1.d0ham_chem = 0.d0
ham_Uc= 0.d0ham_Uf= 2.d0
ham_JK= 2.d0/Aside!! Variables for the Kondo! Hopping parameter! Chemical potential! Hubbard interaction on! Hubbard interaction on! Kondo Coupling J

from

class
c-orbitals Uc
f-orbials Uf

the usual observables we have included
Constraint_scal that measures
®
 ¸
X
N 2
f
n̂i −
.
2
i

the

scalarobservable(208)

U f has to be chosen large enough such that the above quantity vanishes within statisticaluncertainty. For the square lattice, Fig.
8 plots the aforementioned
quantity as a function of
¬P
2 ¶
f
−β U f /2
U f for the SU(2) model. As apparent∝e.
i n̂i − N /2

9.4

Models with long range Coulomb interactions LRC_mod.F90

The model we consider here is defined for N_FL=1, arbitrary values of N_SUN and all thepredefined lattices. It reads:
Ĥ =

N
XX
i, j σ=1

2πi†
Ti, j ĉi,σ
e Φ0

Rj
i

A(l)d lĉ j,σ +





X
1X
N
N
n̂i −
Vi, j n̂ j −−µn̂i .
N i, j
2
2
i

(209)

In the above, i = (i, δi ) and j = ( j , δ j ) are super-indices encoding the unit-cell and orbital
PN†
and n̂i = σ=1 ĉi,σĉi,σ For simplicity, the interaction is specified by two parameters, U andα that monitor the strength of the onsite interaction and the magnitude of the Coulomb tailrespectively:¨
1
if i = j
Vi, j ≡ V (i + δi , j + δ j ) = U.
(210)
α dminotherwise||i− j +δ −δ ||
i

86

j

SciPost Phys. Codebases 1 (2022)

L = 4, βt = 5, Jk /t = 2

L = 4, βt = 5, Jk /t = 22e−βUf /2

1.8
1.6



i

Sf f (π, π)

2 

0.1

P  f

1

n̂i − N2

10

1.4
1.2
1

0.01

0.8
0.001

0.6
0

0.5

1

1.5

2

2.5

0

3

0.5

1

Uf /t

1.5

2

2.5

3

Uf /t

Figure 8: Left: Suppression of charge fluctuations of the f-orbitals as a function of
U f . Right: When charge fluctuations on the f-orbitals vanish, quantities such as theFourier transform of the f spin-spin correlations at q = (π, π) converge to their KLM
value. Typically, for the SU(2) case, β U f > 10 suffices to reach convergent results.
The pyALF script used to produce the data of the plot can be found in Kondo.py.
Here dmin is the minimal distance between two orbitals. On a torus, some care has to be taken
in defining the distance. Namely, with the lattice size given by the vectors L1 and L2 (seeSec. 8.1),||i|| = min |i − n1 L1 − n2 L2 | .
(211)
n1 ,n2 ∈Z

The implementation of the model follows Ref. [51], but supports various lattice geometries.
We use the following HS decomposition:
Z YPP− N ∆τ
φ V −1 φ −i∆τφi (n̂i − N2 )−∆τĤ V∝dφ e 4 i, j i i, j j i
e
,
(212)
i

i

where φi is a real variable, V is symmetric and, importantly, has to be positive definite for theGaussian integration to be defined. The partition function reads:

Z∝

Z Y

z
dφi,τ e− N ∆τ4

WB (φ)
}|
{
P
−1
φ
V
φ
j,τ
i, j i,τ i, j

Tr

Y

e

−∆τĤ T −eP

Ni i∆τφi,τ ( n̂i − 2 )


,

(213)

τ

i

|

{z

WF (φ)}

such that the weight splits into bosonic and fermionic parts.
For the update, it is convenient to work in a basis where V is diagonal:

with O T O = 1 and define:

Diag (λ1 , · · · , λNdim ) = O T V O

(214)

X

(215)

ηi,τ =

Oi,T j φ j,τ .

j

On a given time slice τu we propose a new field configuration with the probability:

¨ Q 
0
0
P
P
(η
)
+
(1
−
P)δ(η
−
η
)
for τ = τu
B
i,τu
i
i,τu
i,τu
,
T 0 (η → η0 ) =0δ(ηi,τ − ηi,τ )for τ 6= τu
where
PB (ηi,τ ) ∝ e
87

∆τ 2
− N4λ
ηi,τ
i

,

(216)

(217)

SciPost Phys. Codebases 1 (2022)

P ∈ [0, 1] and δ denotes the Dirac δ-function. That is, we carry out simple sampling of the
field with probability P and leave the field unchanged with probability (1 − P). P is a freeparameter that does not change the final result but that allows one to adjust the acceptance
rate. We then use the Metropolis-Hasting acceptance-rejection scheme and accept the movewith probability
 0 0



T (η → η)WB (η0 )WF (η0 )WF (η0 )min, 1 = min
,1 ,
(218)
T 0 (η → η0 )WB (η)WF (η)
WF (η)
where
WB (η) = e− N ∆τ
4P

2i,τ ηi,τ /λi

and WF (η) = TrYe−∆τĤ T −ePNi, j i∆τOi, j η j,τ ( n̂i − 2 )


.

(219)

τ

Since a local change on a single time slice in the η basis corresponds to a non-local space
update in the φ basis, we use the routine for global updates in space to carry out the update(see Sec. 2.2.3).
QMC implementation
The name space for this model class reads:&VAR_LRC
ham_T
= 1.0
ham_T2= 1.0
ham_Tperp= 1.0
ham_chem
= 1.0
ham_U
= 4.0
ham_alpha= 0.1
Percent_change = 0.1/!! Variables for the Long Range Coulomb class! Specifies the hopping and chemical potential! For bilayer systems! For bilayer systems! Chemical potential! On-site interaction! Coulomb tail magnitude! Parameter P

By setting α to zero we can test this code against the Hubbard code. For a 4 × 4 squarelattice at β t = 5, U/t = 4, and half-band filling, Hamiltonian_Hubbard_mod.F90 gives
E = −13.1889 ± 0.0017 and Hamiltonian_LRC_mod.F90, E = −13.199 ± 0.040. Note thatfor the Hubbard code we have used the default Mz = .True.. This option breaks SU(2) spinsymmetry for a given HS configuration, but produces very precise values of the energy. On theother hand, the LRC code is an SU(2) invariant code (as would be choosing Mz = .False.)
and produces more fluctuations in the double occupancy. This partly explains the difference inerror bars between the two codes. To produce this data, one can run the pyALF Python script
LRC.py.

9.5

Z2 lattice gauge theories coupled to fermion and Z2 matter Z2_mod.F90

The Hamiltonian we will consider here reads
X
X
X


†
†
z
x
Ĥ = − t Z2
σ̂〈i,
Ψ̂
Ψ̂
+
H.c.
−
µ
Ψ̂
Ψ̂
−
g
σ̂〈i,
j〉
i,σ j ,σi,σ i,σj〉i,σ〈i, j 〉,σ

+K

X Y

z
σ̂〈i,
+J
j〉

 〈i, j 〉∈∂ −tXτ̂iz τ̂zjXzτ̂iz σ̂〈i,τ̂z − hj〉 j

〈i, j〉Xτ̂ix

i〈i, j 〉†
Ψ̂i,σΨ̂ j ,σ + H.c.

〈i, j 〉,σ

U
+
N

X X
i

σ



†
Ψ̂i,σ
Ψ̂i,σ − 1/2

The model is defined on a square lattice, and describes fermions,
¦
©
¦
©
†
Ψ̂i,σ
, Ψ̂ j,σ0 = δi, j δσ,σ0 , Ψ̂i,σ , Ψ̂ j,σ0 = 0 ,
88


 2

.

(220)

(221)

SciPost Phys. Codebases 1 (2022)

coupled to bond gauge fields,




©
 z
1 0
0 1 ¦ zzx
σ̂〈i, j 〉 =, σ̂〈i, j 〉 =, σ̂〈i, j〉 , σ̂〈ix 0 , j 0 〉 = 2 1 − δ〈i, j〉,〈i 0 , j 0 〉 σ̂〈i,σ̂ xj 〉 〈i 0 , j 0 〉0 −1
1 0
and Z2 matter fields:τ̂zi =


1 0
,
0 −1

τ̂ix =




0 1
,
1 0

 z x

τ̂i , τ̂i 0 = 2 1 − δi,i 0 τ̂zi τ̂ix0 .

(222)

(223)

Fermions, gauge fields and Z2 matter fields commute with each other.
Importantly, the model has a local Z2 symmetry. Consider:†σ Ψ̂i,σ Ψ̂i,σPQ̂ i = (−1)

xxxτ̂ix σ̂i,i+a
σ̂i,i−aσ̂i,i+aσ̂ix .
x

x

y

(224)

One can then show that Q̂2i = 1 and thatQ̂ i , Ĥ = 0 .

(225)

¦
©
†
The above allows us to assign Z2 charges to the operators. Since Q̂ i , Ψ̂i,σ= 0, we canzz
assign a Z2 charge to the fermions. Equivalently τ̂i has a Z2 charge and σ̂i, j carries Z2 charges
at its ends. Since the total fermion number is conserved, we can assign an electric charge
to the fermions. Finally, the model has an SU(N) color symmetry. In fact, at zero chemical
potential and U = 0, the symmetry is enhanced to O(2N ) [21]. Aspects of this Hamiltonian
were investigated in Refs. [21, 25, 26, 28–30] and we refer the interested user to these papers
for a discussion of the phases and phase transitions supported by the model.
QMC implementation
The name space for this model class reads:&VAR_Z2_Matter
ham_T
= 1.0
ham_TZ2= 1.0
ham_chem
= 0.0
ham_U
= 0.0
Ham_J
= 1.0
Ham_K
= 1.0
Ham_h
= 1.0
Ham_g
= 1.0
Dtau
= 0.1d0
Beta= 10.d0
Projector= .False.
Theta= 10.0/!! Variables for the Z_2 class! Hopping for fermions! Hopping for orthogonal fermions! Chemical potential for fermions! Hubbard for fermions! Hopping Z2 matter fields! Plaquette term for gauge fields! sigma^x-term for matter! tau^x-term for gauge! Thereby Ltrot=Beta/dtau! Inverse temperature! To enable projective code
! Projection parameter

We note that the implementation is such that if Ham_T=0 (Ham_TZ2=0) then all the terms
involving the matter field (Z2 gauge field) are automatically set to zero. We warn the userthat autocorrelation and warmup times can be large for this model class. At this point, themodel is only implemented for the square lattice and does not support a symmetric Trotter
decomposition.
An essential point to implement the model is to define a new bond variable:µ̂z〈i, j〉 = τ̂zi τ̂zj .

89

(226)

SciPost Phys. Codebases 1 (2022)

By construction, the µ̂z〈i, j〉 bond variables have a zero flux constraint:µ̂z〈i,i+a 〉 µ̂z〈i+a ,i+a +a 〉 µ̂z〈i+a +a ,i+a 〉 µ̂z〈i+a ,i〉 = 1 .
x

x

x

y

x

y

y

(227)

y

Consider a basis where µ̂z〈i, j 〉 and τ̂zi are diagonal with eigenvalues µ〈i, j 〉 and τi respectively.
The map from {τi } to µ〈i, j 〉 is unique. The reverse however is valid only up to a global sign.
To pin down this sign (and thereby the relative signs between different time slices) we store
the fields µ〈i, j〉 at every time slice as well as the value of the Ising field at a reference site
τi=0 . Within the ALF, this can be done by adding a dummy operator in the Op_V list to carry
this degree of freedom. With this extra degree of freedom we can switch between the two
representations without loosing any information. To compute the Ising part of the action it iscertainly more transparent to work with the {τi } variables. For the fermion determinant, theµ〈i, j 〉 are more convenient.
Since flipping τ̂zi amounts to changing the sign of the four bond variables emanating fromsite i, the identity:xτ̂ix = µ̂i,i+a
µ̂ x
µ̂ x
(228)
x i+a x ,i+a x +a y i+a x +a y ,i+a y¦©
xholds. Note that µ̂z〈i, j 〉 , µ̂〈ix 0 , j 0 〉 = 2 1 − δ〈i, j〉,〈i 0 , j 0 〉 µ̂z〈i, j 〉 µ̂〈ix 0 , j 0 〉 , such that applying µ̂〈i,onj〉z
an eigenstate of µ̂〈i, j〉 flips the field.
The model can then be written as:
X
X Y
X
X


†
†
x
z
z
Ψ̂
−
g
σ̂
+
K
σ̂〈i,
Ψ̂
Ψ̂
+
H.c.
−
µ
Ĥ = − t Z2σ̂〈i,Ψ̂〈i, j〉i,σ i,σi,σ j ,σj〉j〉i,σ〈i, j 〉,σX+Jz
µ̂z〈ii , j 〉 σ̂〈i,
−h
j〉

X

−t

 〈i, j 〉∈∂ i〈i, j〉

X〈i, j 〉xµ̂i,i+a
µ̂ x
µ̂ x
µ̂ x
x i+a x ,i+a x +a y i+a x +a y ,i+a y i+a y ,iµ̂iz, j†Ψ̂i,σΨ̂ j ,σ + H.c.

〈i, j〉,σ
2
UX X †+(Ψ̂i,σ Ψ̂i,σ − 1/2) ,
N i
σ

(229)

subject to the constraint of Eq. (227).
z
To formulate the Monte Carlo Hamiltonian, we work in a basis in which µ̂z〈i, j 〉 , τ̂z0 and σ̂〈i,j〉are diagonal:µ̂z〈i, j 〉 |s〉 = µ〈i, j 〉 |s〉,with s =



z
σ̂〈i,
|s〉 = σ〈i, j 〉 |s〉,j〉τ̂z0 |s〉 = τ0 |s〉 ,

(230)



µ〈i, j 〉 , σ〈i, j 〉 , τ0 . In this basis,XZ=

s1 ,··· ,s L

e−S0 ({sτ }) Tr F

L
τ
Y



e−∆τĤ F (sτ ) ,

τ=1

τ

where
L

τ
Y

S0 ( sτ ) = − ln〈sτ+1 |e−∆τĤ I |sτ 〉 ,τ=1Ĥ I = − g

X

−h

X

x
σ̂〈i,
+K
j〉

〈i, j 〉X Y
 〈i, j 〉∈∂ 

z
σ̂〈i,
+J
j〉

X
〈i, j 〉

x
µ̂ x
µ̂ x
µ̂i,i+ax i+a x ,i+a x +a y i+a x +a y ,i+a y

i

90

z
µ̂z〈ii , j〉 σ̂〈i,
j〉

(231)

SciPost Phys. Codebases 1 (2022)

andĤ F (s) = − t Z2

X

X


†
†
Ψ̂ j ,σ + H.c. − µ
Ψ̂i,σ
Ψ̂i,σ
σ〈i, j 〉 Ψ̂i,σi,σ〈i, j〉,σ−tXµi , j†Ψ̂i,σΨ̂ j ,σ + H.c.

〈i, j〉,σ
2
UX X †+(Ψ̂i,σ Ψ̂i,σ − 1/2) .
N i
σIn the above, |s L +1 〉 = |s1 〉. With a further HS transformation of the Hubbard term (seeτSec. 8.3.1) the model is readily implemented in the ALF. Including this HS field, l, [see Eq. (11)]yields the configuration space:





C = µ〈i, j〉,τ , σ〈i, j〉,τ , τ0,τ , l i,τ ,(232)
where the variables µ, τ and σ take the values ±1 and l the values ±1, ±2.
The initial configuration as well as the moves have to respect the zero flux constraint of
Eq. (227). Therefore, single spin flips of the µ fields are prohibited and the minimal move
one can carry out on a given time slice is the following. We randomly choose a site i andpropose a move where: µi,i+a x → −µi,i+a x , µi,i−a x → −µi,i−a x , µi,i+a y → −µi,i+a y andµi,i−a y → −µi,i−a y . One can carry out such moves by using the global move in real space
option presented in Sec. 2.2.3 and 5.7.1.
9.5.1

Projective approach

The program also supports a zero temperature implementation. Our choice of the trial wave
function does not break any symmetries of the model and reads:|Ψ T 〉 = |Ψ TF 〉 ⊗〈i, j 〉 |+〉〈i, j〉 ⊗i |+〉i .

(233)

For the fermion part we use a Fermi sea with small dimerization to avoid the negative sign
problem at half-filling (see Sec. 7.5). For the Ising part the trial wave function is diagonal inx
the σ̂〈i,and τ̂ix operators:
j〉
x
σ̂〈i,
|+〉〈i, j〉 = |+〉〈i, j 〉j〉and τ̂ix |+〉i = |+〉i .

(234)

An alternative choice would be a charge density wave fermionic trial wave function. Thisviolates the partial particle-hole symmetry of the model at U = µ = 0 and effectively imposes
the constraint Q̂ i = 1.
9.5.2

Observables

Apart from the standard observables discussed in Sec. 8.4 the code computes additionally:
x
σ̂〈i,
j〉

τ̂ xj ,

andwhich are written to file X_scal;z
σ̂〈i,i+a
σ̂z
σ̂z
σ̂z
〉 〈i+a ,i+a +a 〉 〈i+a +a ,i+a 〉 〈i+a ,i〉
x

x

x

y

x

y

y

y

and
µ̂z〈i,i+a 〉 µ̂z〈i+a ,i+a +a 〉 µ̂z〈i+a +a ,i+a 〉 µ̂z〈i+a ,i〉 ,
x

x

x

y

x

y

y

y

written to file Flux_scal; and also 〈Q̂ i 〉 (file Q_scal). Note that the flux over a plaquette ofthe µ̂z〈i, j〉 is equal to unity by construction so that this observable provides a sanity check. The
file Q_eq contains the two-point correlation 〈Q̂ i Q̂ j 〉−〈Q̂ i 〉〈Q̂ j 〉 and Greenf_eq the equal-time†
fermion Green function 〈τ̂zi Ψ̂i,στ̂zj Ψ̂ j ,σ 〉.
91

SciPost Phys. Codebases 1 (2022)

9.5.3

A test case: Z2 slave spin formulation of the SU(2) Hubbard model

In this subsection, we demonstrate that the code can be used to simulate the attractive Hubbard
model in the Z2 -slave spin formulation [154]:
X
X


†
Ĥ = −tĉi,σĉ j ,σ − Un̂i,↑ − 1/2 n̂i,↓ − 1/2 .
(235)
i〈i, j〉,σIn the Z2 slave spin representation, the physical fermion, ĉi,σ , is fractionalized into an Ising
spin carrying Z2 charge and a fermion, Ψ̂i,σ , carrying Z2 and global U(1) charge:
†
†
.
ĉi,σ
= τ̂zi Ψ̂i,σ(236)

To ensure that we remain in the correct Hilbert space, the constraint:†τ̂ix − (−1) σ Ψ̂i,σ Ψ̂i,σ = 0
2
has to be imposed locally. Since τix = 1, the latter is equivalent toP†σ Ψ̂i,σ Ψ̂i,σPQ̂ i = τix (−1)

(237)

= 1.

(238)

Using
†
σ Ψ̂i,σ Ψ̂i,σ

P

(−1)

=

Y
Y
†
†
ĉi,σ − 1/2) ,(1 − 2Ψ̂i,σΨ̂i,σ ) = 4(ĉi,σ

(239)

σ

σ

the Z2 slave spin representation of the Hubbard model now reads:
X
UX x
†
τ̂ .
Ψ̂ j ,σ −ĤZ2 = −tτ̂zi τ̂zj Ψ̂i,σ
4 i i

(240)

〈i, j 〉,σImportantly, the constraint commutes with Hamiltonian:
ĤZ2 , Q̂ i = 0 .

(241)Hence one can foresee that the constraint will be dynamically imposed (we expect a finitetemperature Ising phase transition below which Q̂ i orders) and that at T = 0 on a finite latticeboth models should give the same results.
A test run for the 8 × 8 lattice at U/t = 4 and β t = 40 gives:k〈nk 〉H〈nk 〉HZ(0, 0)(π/4, π/4)
(π/2, π/2)
(3π/4, 3π/4)(π, π)

1.93348548 ± 0.00011322
1.90120688 ± 0.00014854
0.99942957 ± 0.00091377
0.09905425 ± 0.00015940
0.06651452 ± 0.00011321

1.93333895 ± 0.00010405
1.90203726 ± 0.00017943
1.00000000 ± 0.00000000
0.09796274 ± 0.00017943
0.06666105 ± 0.00010405

2

Here a Trotter time step of ∆τt = 0.05 was used in order to minimize the systematic error
which should be different between the two codes. The Hamiltonian is invariant under a partial particle-hole transformation (see Ref. [21]). Since Q̂ i is odd under this transformation,〈Q̂ i 〉 = 0. To asses whether the constraint is well imposed, the code, for this special case,computes the correlation function:X
SQ (q ) =〈Q̂ i Q̂ 0 〉 .
(242)i

For the above run we obtain SQ (q = 0) = 63.4 ± 1.7 which, for this 8 × 8 lattice, complies witha ferromagnetic ordering of the Ising Q̂ i variables. The pyALF python script that produces thisdata can be found in Z2_Matter.py. This code was used in Refs. [28, 29].
92

SciPost Phys. Codebases 1 (2022)

10

Maximum Entropy

If we want to compare the data we obtain from Monte Carlo simulations with experiments,
we must extract spectral information from the imaginary-time output. This can be achieved
through the maximum entropy method (MaxEnt), which generically computes the image A(ω)
for a given data set g(τ) and kernel K(τ, ω):Z ωendg(τ) =dωK(τ, ω)A(ω) .

(243)

ωstartThe ALF package includes a standard implementation of the stochastic MaxEnt, as formulated
in the article of K. Beach [102], in the module Libraries/Modules/maxent_stoch_mod.F90.
Its wrapper is found in Analysis/Max_SAC.F90 and the Green function is read from theoutput of the cov_tau.F90 analysis program.

10.1

General setup

The stochastic MaxEnt is essentially a parallel-tempering Monte Carlo simulation. For a discrete set of τi points, i ∈ 1 · · · n, the goodness-of-fit functional, which we take as the energy
reads
n 
X



χ 2 (A) =g(τi ) − g(τi ) C −1 (τi , τ j ) g(τ j ) − g(τ j ) ,(244)
i, j=1R

with g(τi ) = dωK(τi , ω)A(ω) and C the covariance matrix. The set of Nα inverse temperatures considered in the parallel tempering is given by αm = αst Rm , for m = 1 · · · Nα and a constant R. The phase space corresponds to all possible spectral functions satisfying
a given sum
R−αχ 2 (A)rule and the required positivity. Finally, the partition function reads Z = DA e[102],
such that for a given “inverse temperature” α, the image is given by:
R〈A(ω)〉 =2

DA e−αχ (A) A(ω)
R.
DA e−αχ 2 (A)(245)

In the code, the spectral function is parametrized by a set of Nγ Dirac δ functions:A(ω) =NγX

ai δ (ω − ωi ) .

(246)

i=1

To produce a histogram of A(ω) we divide the frequency range in Ndis intervals.
Besides the parameters included in the namelist VAR_Max_Stoch set in the fileparameters (see Sec. 5.7), also the variable N_cov, from the namelist VAR_errors, is required to run the maxent code. Recalling: N_cov = 1 (N_cov = 0) sets that the covariancewill (will not) be taken into account.
Input files
In addition to the aforementioned parameter file, the MaxEnt program requires the output of
the analysis of the time-displaced functions. The program Anaylsis/ana.out (see Sec. 6.3)
generates, for each k-point, a directory named Variable_name_kx_ky. In this directory thefile g_kx_ky contains the required information for the MaxEnt code, which is formatted asfollows:

93

SciPost Phys. Codebases 1 (2022)<# of tau-points> <# of bins >do tau = 1,
of tau-points
P # (corr)
τ,
〈S
error
α α,α (k, τ)〉,enddo
do tau1 = 1, # of tau-points
do tau2 = 1, # of tau-points<beta><Norb><Channel>C(τ1 , τ2 )

enddo
enddo

Output files
The code produces the following output files:• The files Aom_n contains theRaverage spectral function at inverse temperature αn . This2
corresponds to 〈An (ω)〉 = Z1 DA(ω) e−αn χ (A) A(ω). The file contains three columns: ω,〈An (ω)〉, and ∆〈An (ω)〉.
• The files Aom_ps_n contain the average image over the inverse temperatures αn to αNγ ,see Ref. [102] for more details. Its first three columns have the same meaning as for thefiles Aom_n.
• The file Green contains the Green function, obtained from the spectral function throughZ
1A(Ω)G(ω) = −
dΩ
,
(247)
π
ω − Ω + iδ
where δ = ∆ω = (ωend − ωstart )/Ndis and the image corresponds to that of the file
Aom_ps_n with n = Nα − 10. The first column of the Green file is a place holder forpost-processing. The last three columns correspond to ω, Re G(ω), − Im G(ω)/π.

• One of the most important output files is energies, which lists αn , 〈χ 2 〉, ∆〈χ 2 〉.
PNγ
• best_fit gives the values of ai and ωi (recall that A(ω) = i=1 ai δ (ω − ωi )) corresponding to the last configuration of the lowest temperature run.
• R
The file data_out facilitates crosschecking.
It lists τ, g(τ), ∆g(τ), anddωK(τ, ω)A(ω), where the image corresponds to the best fit (i.e. the lowest temperature). This data should give an indication of how good the fit actually is. Note that
data_out contains only the data points that have passed the tolerance test.
• Two dump files are also generated, dump_conf and dump_Aom. Since the MaxEnt is aMonte Carlo code, it is possible to improve the data by continuing a previous simulation.
The data in the dump files allow you to do so. These files are only generated if thevariable checkpoint is set to .true..
The essential question is: Which image should one use? There is no ultimate answer tothis question in the context of the stochastic MaxEnt. The only rule of thumb is to consider
temperatures for which the χ 2 is comparable to the number of data points.

94

SciPost Phys. Codebases 1 (2022)

10.2

Single-particle quantities: Channel=P

For the single-particle Green function,〈ĉk (τ)ĉk† (0)〉 =ZdωK p (τ, ω)A p (k, ω) ,withK p (τ, ω) =1 e−τω
π 1 + e−βω

and, in the Lehmann representation,
π X −β En
A p (k, ω) =e
1 + e−βω |〈n|cn |m〉|2 δ (Em − En − ω) .
Z n,m
Here Ĥ − µN̂ |n〉 = En |n〉. Note that A p (k, ω) = − Im G ret (k, ω), withZ

ret
G (k, ω) = −i dtΘ(t)e iωt 〈 ĉk (t), ĉk† (0) 〉 .

(248)

(249)

(250)

(251)

Finally the sum rule readsZdωA p (k, ω) = π〈 ĉk , ĉk† 〉 = π 〈ĉk (τ = 0)ĉk† (0)〉 + 〈ĉk (τ = β)ĉk† (0)〉 .

(252)

Using the Max_Sac.F90 with Channel="P" will load the above kernel in the MaxEnt library.
In this case the back transformation is set to unity. Note that for each configuration of fields
we have 〈〈ĉk (τ = 0)ĉk† (0)〉〉C + 〈〈ĉk (τ = β)ĉk† (0)〉〉C = 〈〈 ĉk , ĉk† 〉〉C = 1, hence, if both theτ = 0 and τ = β data points are included, the covariance matrix will have a zero eigenvalue
and the χ 2 measure is not defined. Therefore, for the particle channel the program omits theτ = β data point. There are special particle-hole symmetric cases where the τ = 0 data pointshows no fluctuations – in such cases the code omits the τ = 0 data point as well.

10.3

Particle-hole quantities: Channel=PH

Imaginary-time formulation
For particle-hole quantities such as spin-spin or charge-charge correlations, the kernel readsZe−τω
1〈Ŝ(q, τ)Ŝ(−q, 0)〉 =dωχ 00 (q, ω) .
(253)
π
1 − e−βωThis follows directly from the Lehmann representation
π X −β En
e|〈n|Ŝ(q)|m〉|2 δ(ω + En − Em ) 1 − e−βω .
χ 00 (q, ω) =
Z n,m

(254)

Since the linear response to a Hermitian perturbation is real, χ 00 (q, ω) = −χ 00 (−q, −ω) andhence 〈Ŝ(q, τ)Ŝ(−q, 0)〉 is a symmetric function around β = τ/2 for systems with inversion
symmetry – the ones we consider here. When Channel=PH the analysis program ana.out
uses this symmetry to provide an improved estimator.
The stochastic MaxEnt requires a sum rule, and hence the kernel and image have to beadequately redefined. Let us consider coth(βω/2)χ 00 (q, ω). For this quantity, we have thesum rule, sinceZdω coth(βω/2)χ 00 (q, ω) = 2π〈Ŝ(q, τ = 0)Ŝ(−q, 0)〉 ,
95

(255)

SciPost Phys. Codebases 1 (2022)

which is just the first point in the data. Therefore,Z
1 e−τω
〈Ŝ(q, τ)Ŝ(−q, 0)〉 = dωtanh(βω/2) coth(βω/2)χ 00 (q, ω)
−βω
π
1
−
e
{z
}
|
{z
}|
K pp (τ,ω)

(256)

A(ω)

and one computes A(ω). Note that since χ 00 is an odd function of ω one restricts the integration
range to positive values of ω. Hence:Z∞〈Ŝ(q, τ)Ŝ(−q, 0)〉 =0dω (K(τ, ω) + K(τ, −ω)) A(ω) .
{z
}
|

(257)

K ph (τ,ω)

In the code, ωstart is set to zero by default and the kernel K ph is defined in the routine XKER_ph.
In general, one would like to produce the dynamical structure factor that gives the susceptibility according toS(q, ω) = χ 00 (q, ω)/ 1 − e−βω .
(258)
In the code, the routine BACK_TRANS_ph transforms the image A to the desired quantity:
S(q, ω) =A(ω).
1 + e−βω(259)Matsubara-frequency formulation
The ALF library uses imaginary time. It is, however, possible to formulate the MaxEnt in
Matsubara frequencies. Consider:ZβZχ 00 (q, ω)1iΩm τχ(q, iΩm ) =dτe〈Ŝ(q, τ)Ŝ(−q, 0)〉 =
dω
.
(260)
π
ω − iΩm0
Using the fact that χ 00 (q, ω) = −χ 00 (−q, −ω) = −χ 00 (q, −ω) one obtains
Z∞


1
1
1
dω
−
χ 00 (q, ω)χ(q, iΩm ) =π 0
ω − iΩm −ω − iΩmZ∞χ 00 (q, ω)
2
ω2
=
dω 2
π 0
ω + Ω2m
ω
Z∞

(261)

dωK(ω, iΩm )A(q, ω) ,

≡
0

with
K(ω, iΩm ) =ω2
ω2 + Ω2m

and A(q, ω) =2 χ 00 (q, ω).
πωThe above definitions produce an image that satisfies the sum rule:Z∞Z∞χ 00 (q, ω)1dωA(q, ω) =dω
≡ χ(q, iΩm = 0) .
π −∞
ω
0

10.4

(262)

(263)

Particle-Particle quantities: Channel=PP

Similarly to the particle-hole channel, the particle-particle channel is also a bosonic correlation function. Here, however, we do not assume that the imaginary time data is symmetricaround the τ = β/2 point. We use the kernel K pp defined in Eq. (256) and consider the whole
frequency range. The back transformation yields
χ 00 (ω) tanh (βω/2)=A(ω) .
ω
ω
96

(264)

SciPost Phys. Codebases 1 (2022)

Green

Den
8
10
6
4
12
0
-2
0.1
-4
-6
-8
0.01
0

8
7
6
5
4
3
2
1
0
0

π/2

π

SpinZ

π/2

π

10
8
7
6
1
5
4
3
0.1
2
1
0.01
0
0

10

1

0.1

0.01
π/2

π

Figure 9: Dynamics of the one-dimensional half-filled Hubbard model on a 46-site
chain, with U/t=4 and β t = 10. (a) Dynamical charge structure factor, (b) single
particle spectral function and (c) dynamical spin structure factor. Data obtained using
the pyALF python script Hubbard_1D.py, considering 400 bins of 200 sweeps eachand taking into account the covariance matrix for the MaxEnt. The parameters for
the MaxEnt that differ from the default values are also listed in the python script.

10.5

Zero-temperature, projective code: Channel=T0

In the zero temperature limit, the spectral function associated to an operator Ô reads:X
Ao (ω) = π|〈n|Ô|0〉|2 δ(En − E0 − ω) ,(265)
nsuch that†〈0|Ô (τ)Ô(0)|0〉 =Z

dωK0 (τ, ω)A0 (ω) ,

(266)

with

1 −τω
e
.
π
The zeroth moment of the spectral function readsZ
K0 (τ, ω) =dωAo (ω) = π〈0|Ô† (0)Ô(0)|0〉 ,

(267)

(268)

and hence corresponds to the first data point.
In the zero-temperature limit one does not distinguish between particle, particle-hole, or
particle-particle channels. Using the Max_Sac.F90 with Channel="T0" loads the above kernel in the MaxEnt library. In this case the back transformation is set to unity. The code will
also cut-off the tail of the imaginary time correlation function if the relative error is greaterthat the variable Tolerance.

10.6

Dynamics of the one-dimensional half-filled Hubbard model

To conclude this section, we show the example of the one-dimensional Hubbard model, which
is known to show spin-charge separation (see Ref. [155] and references therein). The data ofFig. 9 was produced with the pyALF python script Hubbard_1D.py, and the spectral function
plots with the bash script Spectral.sh.

11

Conclusions and Future Directions

In its present form, the auxiliary-field QMC code of the ALF project allows us to simulate alarge class of non-trivial models, both efficiently and at minimal programming cost. ALF 2.0
contains many advanced functionalities, including a projective formulation, various updating
97

SciPost Phys. Codebases 1 (2022)

schemes, better control of Trotter errors, predefined structures that facilitate reuse, a large
class of models, continuous fields and, finally, stochastic analytical continuation code. Also
the usability of the code has improved in comparison with ALF 1.0. In particular the pyALF
project provides a Python interface to the ALF which substantially facilitates running the codefor established models. This ease of use renders ALF 2.0 a powerful tool to for benchmarking
new algorithms.
There are further capabilities that we would like to see in future versions of ALF. Introducing time-dependent Hamiltonians, for instance, will require some rethinking, but will allow, forexample, to access entanglement properties of interacting fermionic systems [61–63]. Moreover, the auxiliary field approach is not the only method to simulate fermionic systems. It
would be desirable to include additional lattice fermion algorithms such as the CT-INT [93,156]. Lastly, at the more technical level, improved IO (e.g., HDF5 support), post-processing,object oriented programming, as well as increased compatibility with other software projects
are all certainly improvements to look forward to.

Acknowledgments
We are very grateful to B. Danu, S. Beyl, M. Hohenadler, M. Raczkowski, T. Sato, M. Ulybyshev,
Z. Wang, and M. Weber for their constant support during the development of this project. We
equally thank G. Hager, M. Wittmann, and G. Wellein for useful discussions and overall support. FFA would also like to thank T. Lang and Z. Y. Meng for developments of the auxiliary
field code as well as to T. Grover. MB, FFA and FG thank the Bavarian Competence Network
for Technical and Scientific High Performance Computing (KONWIHR) for financial support.
FG, JH, and JS thank the SFB-1170 for financial support under projects Z03 and C01. F.P.T
is funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) –project number 414456783. Z.L. is funded Würzburg-Dresden Cluster of Excellence on Complexity and Topology in Quantum Matter ct.qmat (EXC 2147, project-id 390858490). JSEP
thanks the DFG for financial support under the project AS120/14-1, dedicated to the further
development of the ALF library. Part of the optimization of the code was carried out during
the Porting and Tuning Workshop 2016 offered by the Forschungszentrum Jülich. Calculations
performed to extensively test this package were carried out both on SuperMUC-NG at the Leibniz Supercomputing Centre and on JURECA [157] at the Jülich Supercomputing Centre. We
thank both institutions for the generous allocation of computing time.

A

Practical implementation of Wick decomposition of 2n-point correlation functions of two imaginary times

In this Appendix we briefly outline how to compute 2n point correlation functions of the form:Xlim
f (σ1 , σ10 , · · · , σn , σ0n , s1 , s10 · · · sn , sn0 )ε→0σ1 ,σ10 ,··· ,σn ,σ0n ,s1 ,s10 ···sn ,sn0 〈〈T ĉ †x ,σ ,s (τ1,ε )ĉ x 0 ,σ0 ,s0 (τ01,ε ) − a1 · · · ĉ †x ,σ ,s (τn,ε )ĉ x 0 ,σ0 ,s0 (τ0n,ε ) − an 〉〉C . (269)
1

1 1

1

n

1 1

n n

n

n m

Here, σ is a color index and s a flavor index such that〈〈T ĉ †x,σ,s (τ)ĉ x 0 ,σ0 ,s0 (τ0 )〉〉C = 〈〈T ĉ †x,s (τ)ĉ x 0 ,s (τ0 )〉〉C δs,s0 δσ,σ0 .

(270)That is, the single-particle Green function is diagonal in the flavor index and color independent.
To define the time ordering we will assume that all times differ but that limε→0 τn,ε as well as
98

SciPost Phys. Codebases 1 (2022)

limε→0 τ0n,ε take the values 0 or τ. Let
Gs (I, J) = lim 〈〈T c †x ,s (τ I,ε )c x 0 ,s (τ0J,ε )〉〉C .
ε→0

I

(271)

J

The Gs (I, J) are uniquely defined by the time-displaced correlation functions that enter theObserT routine in the Hamiltonian files. They are defined in Eq. (139) and read:GT0(x,y,s) = 〈〈ĉ x,s (τ)ĉ †y,s (0)〉〉C = 〈〈T ĉ x,s (τ)ĉ †y,s (0)〉〉C ,G0T(x,y,s) = −〈〈ĉ †y,s (τ)ĉ x,s (0)〉〉C = 〈〈T ĉ x,s (0)ĉ †y,s (τ)〉〉C ,G00(x,y,s) = 〈〈ĉ x,s (0)ĉ †y,s (0)〉〉C ,(272)

GTT(x,y,s) = 〈〈ĉ x,s (τ)ĉ †y,s (τ)〉〉C .
For instance, let τ I,ε > τ0J,ε and limε→0 τ I,ε = limε→0 τ0J,ε = τ. Then
Gs (I, J) = 〈〈c †x ,s (τ)c x 0 ,s (τ)〉〉C = δ x I ,x J0 − GT T (x J0 , x I , s) .

(273)

Using the formulation of Wick’s theorem of Eq. (23), Eq. (269) reads:Xf (σ1 , σ10 , · · · , σn , σ0n , s1 , s10 · · · sn , sn0 )

(274)

I

J

σ1 ,σ10 ,··· ,σn ,σ0n ,s1 ,s10 ···sn ,sn0

Gs1 (1, 1)δs1 ,s10 δσ1 ,σ10 −α1 Gs (2, 1)δs ,s0 δσ ,σ0
 2
2 1
2 1
det 
..

.
Gsn (n, 1)δsn ,s10 δσn ,σ10

Gs1 (1, 2)δs1 ,s20 δσ1 ,σ20
Gs2 (2, 2)δs2 ,s20 δσ2 ,σ20 −α2..
.
Gsn (n, 2)δsn ,s20 δσn ,σ20. . . Gs1 (1, n)δs1 ,sn0 δσ1 ,σ0n. . . Gs2 (2, n)δs2 ,sn0 δσ2 ,σ0n

.
..
..

.
.
. . . Gsn (n, n)δsn ,sn0 δσn ,σ0n −αnThe symbolic evaluation of the determinant as well as the sum over the color and flavor indicescan be carried out with Mathematica. This produces a long expression in terms of the functions
G(I, J, s) that can then be included in the code. The Mathematica notebooks that we use canbe found in the directory Mathematica of the ALF directory. As an open source alternative toMathematica, the user can consider the Sympy Python library.

B

Performance, memory requirements and parallelization

As mentioned in the introduction, the auxiliary field QMC algorithm scales linearly in inverse
temperature β and as a cube in the volume Ndim . Using fast updates, a single spin flip requires(Ndim )2 operations to update the Green function upon acceptance. As there are LTrotter × Ndim
spins to be visited, the total computational cost for one sweep is of the order of β(Ndim )3 . This
operation alongside QR-decompositions required for stabilization dominates the performance,
see Fig. 10. A profiling analysis of our code shows that 80-90% of the CPU time is spend in
ZGEMM calls of the BLAS library provided in the MKL package by Intel. Consequently, thesingle-core performance is next to optimal.
For the implementation which scales linearly in β, one has to store 2× N f l × LTrotter /NWrap
intermediate propagation matrices of dimension Ndim × Ndim . Hence the memory cost scales2
as β Ndim
and for large lattices and/or low temperatures this dominates the total memory
requirements that can exceed 2 GB memory for a sequential version.
3
2
The above estimates of β Ndim
for CPU time and β Ndim
for memory implicitly assume Hamiltonians where the interaction is a sum of local terms. Recently Landau level projection schemes
for the regularization of continuum field theories have been introduced in the realm of the99

SciPost Phys. Codebases 1 (2022)

Wall- lo k time

10000

QMC simulation
t ∼ x3

1000

100

10
256

400

576

784 1024 1296

Ndim

Figure 10: Volume scaling behavior of the auxiliary field QMC code of the ALF projecton SuperMUC (phase 2/Haswell nodes) at the LRZ in Munich. The number of sites
Ndim corresponds to the system volume. The plot confirms that the leading scalingorder is due to matrix multiplications such that the runtime is dominated by calls to
ZGEMM.
auxiliary field QMC algorithms [73, 74]. In this case the interaction is not local, such that thematrices stored in the Op_V array of Observable type are of dimension of Ndim . Since the3dimension of the Op_V array scales as Ndim , the memory requirement scales as Ndim
. In these3
algorithms, a single field couples to a Ndim × Ndim matrix, such that updating it scales as Ndim.
Furthermore, and as mentioned in Sec. 2.3, for non-local Hamiltonians the Trotter time step
has to be scaled as 1/Ndim so as to maintain a constant systematic error. Taking all of this5
into account, yields a CPU time that scales as β Ndim
. Hence this approach is expensive bothin memory and CPU time.
At the heart of Monte Carlo schemes lies a random walk through the given configuration
space. This is easily parallelized via MPI by associating one random walker to each MPI task.
For each task, we start from a random configuration and have to invest the autocorrelation
time Tauto to produce an equilibrated configuration. Additionally we can also profit from an
OpenMP parallelized version of the BLAS/LAPACK library for an additional speedup, which
also effects equilibration overhead NMPI × Tauto /NOMP , where NMPI is the number of cores and
NOMP the number of OpenMP threads. For a given number of independent measurements
Nmeas , we therefore need a wall-clock time given by


Tauto
Nmeas
T=
1+
.
(275)
NOMP
NMPI
As we typically have Nmeas /NMPI  1, the speedup is expected to be almost perfect, in accordance with the performance test results for the auxiliary field QMC code on SuperMUC (seeFig. 11 (left)).
For many problem sizes, 2 GB memory per MPI task (random walker) suffices such that we
typically start as many MPI tasks as there are physical cores per node. Due to the large amountof CPU time spent in MKL routines, we do not profit from the hyper-threading option. For large
systems, the memory requirement increases and this is tackled by increasing the amount of
OpenMP threads to decrease the stress on the memory system and to simultaneously reduce
the equilibration overhead (see Fig. 11 (right)). For the displayed speedup, it was crucial
to pin the MPI tasks as well as the OpenMP threads in a pattern which keeps the threads as
100

SciPost Phys. Codebases 1 (2022)

compact as possible to profit from a shared cache. This also explains the drop in efficiency
from 14 to 28 threads where the OpenMP threads are spread over both sockets.
We store the field configurations of the random walker as checkpoints, such that a longsimulation can be easily split into several short simulations. This procedure allows us to takeadvantage of chained jobs using the dependency chains provided by the batch system.

QMC simulation
ideal ∼ x

Performan e (1/T )Performan e (1/T )

100

10

1
28

56

112

224

448

Number of ores

QMC simulation
ideal ∼ x
101
1

896 1792

2

4

7

14

Number of OpenMP threads

28

Figure 11: MPI (left) and OpenMP (right) scaling behavior of the auxiliary-field
QMC code of the ALF project on SuperMUC (phase 2/Haswell nodes) at the LRZ in
Munich. The MPI performance data was normalized to 28 cores and was obtainedusing a problem size of Ndim = 400. This is a medium to small system size thatis the least favorable in terms of MPI synchronization effects. The OpenMP performance data was obtained using a problem size of Ndim = 1296. Employing 2 and 4
OpenMP threads introduces some synchronization/management overhead such thatthe per-core performance is slightly reduced, compared to the single thread efficiency.
Further increasing the amount of threads to 7 and 14 keeps the efficiency constant.
The drop in performance of the 28 thread configuration is due to the architecture as
the threads are now spread over both sockets of the node.

C

Licenses and Copyrights

The ALF code is provided as an open source software that is available to all and we hopethat it will be useful. If you benefit from this code we ask that you acknowledge the ALF
collaboration as described on our website https://alf.physik.uni-wuerzburg.de. The git repository at https://git.physik.uni-wuerzburg.de/ALF/ALF gives us the tools to create a small but
vibrant community around the code and provides a suitable entry point for future contributors and future developments. The website is also the place where the original source files
can be found. Its public release make it necessary to add copyright headers to our source
code, which is licensed under a GPL license to keep the source as well as any future workin the community. And the Creative Commons licenses are a good way to share our documentation and it is also well accepted by publishers. Therefore this document is licensed toyou under a CC-BY-SA license. This means you can share it and redistribute it as long as
you cite the original source and license your changes under the same license. The details
are in the file license.CCBYSA, which you should have received with this documentation.
To express our desire for a proper attribution we decided to make this a visible part of thelicense. To that end we have exercised the rights of section 7 of GPL version 3 and haveamended the license terms with an additional paragraph that expresses our wish that if anauthor has benefited from this code that they should consider giving back a citation as specified on https://alf.physik.uni-wuerzburg.de. This is not meant to restrict your freedom ofuse, but to encourage what we strongly believe to be good scientific conduct. The original
101

SciPost Phys. Codebases 1 (2022)

GPL license can be found in the file license.GPL and the additional terms can be found inlicense.additional. To the benefit of our users, the ALF package contains part of theLapack implementation version 3.6.1 from http://www.netlib.org/lapack. Lapack is licensed
under the modified BSD license whose full text can be found in license.BSD.
With that being said, we hope that the ALF code will prove to you to be a suitable and highperformance tool that enables you to perform quantum Monte Carlo studies of solid statemodels of unprecedented complexity.
The ALF project’s contributors.

COPYRIGHT
Copyright © 2016-2022, The ALF Project.
The ALF Project Documentation is licensed under a Creative Commons Attribution-ShareAlike
4.0 International License. You are free to share and benefit from this documentation as longas this license is preserved and proper attribution to the authors is given. For details see the
ALF project website alf.physik.uni-wuerzburg.de and the file license.CCBYSA.

References[1] R. Blankenbecler, D. J. Scalapino and R. L. Sugar, Monte Carlo calculations of coupled boson-fermion systems. I, Phys. Rev. D 24, 2278 (1981),
doi:10.1103/PhysRevD.24.2278.
[2] S. R. White, D. J. Scalapino, R. L. Sugar, E. Y. Loh, J. E. Gubernatis and R. T. Scalettar,
Numerical study of the two-dimensional Hubbard model, Phys. Rev. B 40, 506 (1989),
doi:10.1103/PhysRevB.40.506.
[3] G. Sugiyama and S. E. Koonin, Auxiliary field Monte-Carlo for quantum many-bodyground states, Ann. Phys. 168, 1 (1986), doi:10.1016/0003-4916(86)90107-7.
[4] S. Sorella, S. Baroni, R. Car and M. Parrinello, A novel technique for the simulation of interacting fermion systems, Europhys. Lett. 8, 663 (1989), doi:10.1209/02955075/8/7/014.
[5] S. Duane, A. D. Kennedy, B. J. Pendleton and D. Roweth, Hybrid Monte Carlo, Phys. Lett.
B 195, 216 (1987), doi:10.1016/0370-2693(87)91197-X.
[6] F. F. Assaad and H. G. Evertz, World-line and determinantal quantum Monte Carlo methods for spins, phonons and electrons, in Computational many-particle physics 739 of
Lecture notes in physics, Springer Berlin, Heidelberg, ISBN 9783540746850, (2008),
doi:10.1007/978-3-540-74686-7_10.
[7] D. J. Scalapino, Numerical studies of the 2D Hubbard model, in Handbook of hightemperature superconductivity, Springer, New York, US, ISBN 9780387687346 (2007),
doi:10.1007/978-0-387-68734-6_13.
[8] J. P. F. LeBlanc, et al., Solutions of the two-dimensional Hubbard model: Benchmarks
and results from a wide range of numerical algorithms, Phys. Rev. X 5, 041041 (2015),
doi:10.1103/PhysRevX.5.041041.

102

SciPost Phys. Codebases 1 (2022)[9] M. Hohenadler, T. C. Lang and F. F. Assaad, Correlation effects in quantum spinHall insulators: A quantum Monte Carlo study, Phys. Rev. Lett. 106, 100403 (2011),
doi:10.1103/PhysRevLett.106.100403.
[10] D. Zheng, G.-M. Zhang and C. Wu, Particle-hole symmetry and interaction
effects in the Kane-Mele-Hubbard model, Phys. Rev. B 84, 205121 (2011),
doi:10.1103/PhysRevB.84.205121.
[11] F. F. Assaad, M. Bercx and M. Hohenadler, Topological invariant and quantum spin models from magnetic π fluxes in correlated topological insulators, Phys. Rev. X 3, 011015(2013), doi:10.1103/PhysRevX.3.011015.
[12] J. S. Hofmann, F. F. Assaad, R. Queiroz and E. Khalaf, Search for correlation-induced
adiabatic paths between distinct topological insulators, Phys. Rev. Research 2, 023390(2020), doi:10.1103/PhysRevResearch.2.023390.
[13] F. F. Assaad and I. F. Herbut, Pinning the order: The nature of quantum criticality in the Hubbard model on honeycomb lattice, Phys. Rev. X 3, 031010 (2013),
doi:10.1103/PhysRevX.3.031010.
[14] F. Parisen Toldin, M. Hohenadler, F. F. Assaad and I. F. Herbut, Fermionic quantum criticality in honeycomb and π-flux Hubbard models: Finite-size scaling of renormalizationgroup-invariant observables from quantum Monte Carlo, Phys. Rev. B 91, 165108 (2015),
doi:10.1103/PhysRevB.91.165108.
[15] Y. Otsuka, S. Yunoki and S. Sorella, Universal quantum criticality in the metal-insulatortransition of two-dimensional interacting Dirac electrons, Phys. Rev. X 6, 011029 (2016),
doi:10.1103/PhysRevX.6.011029.
[16] S. Chandrasekharan and A. Li, Quantum critical behavior in three dimensional lattice Gross-Neveu models, Phys. Rev. D 88, 021701 (2013),
doi:10.1103/PhysRevD.88.021701.
[17] V. Ayyar and S. Chandrasekharan, Massive fermions without fermion bilinear condensates,
Phys. Rev. D 91, 065035 (2015), doi:10.1103/PhysRevD.91.065035.
[18] Y. Liu, Z. Wang, T. Sato, M. Hohenadler, C. Wang, W. Guo and F. F. Assaad, Superconductivity from the condensation of topological defects in a quantum spin-Hall insulator, Nat.
Commun. 10, 2658 (2019), doi:10.1038/s41467-019-10372-0.
[19] Z.-X. Li, Y.-F. Jiang, S.-K. Jian and H. Yao, Fermion-induced quantum critical points, Nat.
Commun. 8, 314 (2017), doi:10.1038/s41467-017-00167-6.
[20] M. Raczkowski, R. Peters, T. Thu Phùng, N. Takemori, F. F. Assaad, A. Honecker and J.
Vahedi, Hubbard model on the honeycomb lattice: From static and dynamical mean-field
theories to lattice quantum Monte Carlo simulations, Phys. Rev. B 101, 125103 (2020),
doi:10.1103/PhysRevB.101.125103.
[21] F. F. Assaad and T. Grover, Simple fermionic model of deconfined phases and phase transitions, Phys. Rev. X 6, 041049 (2016), doi:10.1103/PhysRevX.6.041049.
[22] T. Sato, M. Hohenadler and F. F. Assaad, Dirac fermions with competing orders: NonLandau transition with emergent symmetry, Phys. Rev. Lett. 119, 197203 (2017),
doi:10.1103/PhysRevLett.119.197203.

103

SciPost Phys. Codebases 1 (2022)[23] T. Sato, M. Hohenadler, T. Grover, J. McGreevy and F. F. Assaad, Topological terms on
topological defects: A quantum Monte Carlo study, Phys. Rev. B 104, L161105 (2021),
doi:10.1103/PhysRevB.104.L161105.
[24] Z. Wang, Y. Liu, T. Sato, M. Hohenadler, C. Wang, W. Guo and F. F. Assaad, Dopinginduced quantum spin Hall insulator to superconductor transition, Phys. Rev. Lett. 126,205701 (2021), doi:10.1103/PhysRevLett.126.205701.
[25] S. Gazit, M. Randeria and A. Vishwanath, Emergent Dirac fermions and broken symmetries in confined and deconfined phases of Z2 gauge theories, Nat. Phys. 13, 484 (2017),
doi:10.1038/nphys4028.
[26] S. Gazit, F. F. Assaad, S. Sachdev, A. Vishwanath and C. Wang, Confinement transition of Z2 gauge theories coupled to massless fermions: Emergent quantum chromodynamics and SO(5) symmetry, Proc. Natl. Acad. Sci. USA 115, E6987 (2018),
doi:10.1073/pnas.1806338115.
[27] X. Y. Xu, Y. Qi, L. Zhang, F. F. Assaad, C. Xu and Z. Yang Meng, Monte Carlo studyof lattice compact quantum electrodynamics with fermionic matter: The parent state ofquantum phases, Phys. Rev. X 9, 021022 (2019), doi:10.1103/PhysRevX.9.021022.
[28] M. Hohenadler and F. F. Assaad, Fractionalized metal in a Falicov-Kimball model, Phys.
Rev. Lett. 121, 086601 (2018), doi:10.1103/PhysRevLett.121.086601.
[29] M. Hohenadler and F. F. Assaad, Orthogonal metal in the Hubbard model with liberated
slave spins, Phys. Rev. B 100, 125133 (2019), doi:10.1103/PhysRevB.100.125133.
[30] S. Gazit, F. F. Assaad and S. Sachdev, Fermi surface reconstruction without symmetry
breaking, Phys. Rev. X 10, 041057 (2020), doi:10.1103/PhysRevX.10.041057.
[31] F. F. Assaad, Quantum Monte Carlo simulations of the half-filled two-dimensional Kondo
lattice model, Phys. Rev. Lett. 83, 796 (1999), doi:10.1103/PhysRevLett.83.796.
[32] S. Capponi and F. F. Assaad, Spin and charge dynamics of the ferromagnetic and antiferromagnetic two-dimensional half-filled Kondo lattice model, Phys. Rev. B 63, 155114(2001), doi:10.1103/PhysRevB.63.155114.
[33] T. Sato, F. F. Assaad and T. Grover, Quantum Monte Carlo simulationof frustrated Kondo lattice models, Phys. Rev. Lett. 120, 107201 (2018),
doi:10.1103/PhysRevLett.120.107201.
[34] J. S. Hofmann, F. F. Assaad and T. Grover, Fractionalized Fermi liquid in a frustrated Kondo
lattice model, Phys. Rev. B 100, 035118 (2019), doi:10.1103/PhysRevB.100.035118.
[35] B. Danu, F. F. Assaad and F. Mila, Exploring the Kondo effect of an extended impurity
with chains of co adatoms in a magnetic field, Phys. Rev. Lett. 123, 176601 (2019),
doi:10.1103/PhysRevLett.123.176601.
[36] B. Danu, M. Vojta, F. F. Assaad and T. Grover, Kondo breakdown in a spin-1/2
chain of adatoms on a Dirac semimetal, Phys. Rev. Lett. 125, 206602 (2020),
doi:10.1103/PhysRevLett.125.206602.
[37] Y. Schattner, S. Lederer, S. A. Kivelson and E. Berg, Ising nematic quantum critical point in a metal: A Monte Carlo study, Phys. Rev. X 6, 031028 (2016),
doi:10.1103/PhysRevX.6.031028.

104

SciPost Phys. Codebases 1 (2022)[38] O. Grossman, J. S. Hofmann, T. Holder and E. Berg, Specific heat of a quantum critical
metal, Phys. Rev. Lett. 127, 017601 (2021), doi:10.1103/PhysRevLett.127.017601.
[39] X. Y. Xu, K. Sun, Y. Schattner, E. Berg and Z. Yang Meng, Non-Fermi liquid at(2 + 1)D ferromagnetic quantum critical point, Phys. Rev. X 7, 031058 (2017),
doi:10.1103/PhysRevX.7.031058.
[40] Z. Hong Liu, G. Pan, X. Y. Xu, K. Sun and Z. Yang Meng, Itinerant quantum criticalpoint with fermion pockets and hotspots, Proc. Natl. Acad. Sci. USA 116, 16760 (2019),
doi:10.1073/pnas.1901751116.
[41] E. Berg, M. A. Metlitski and S. Sachdev, Sign-Problem-Free quantum Monte
Carlo of the onset of antiferromagnetism in metals, Science 338, 1606 (2012),
doi:10.1126/science.1227769.
[42] H.-K. Tang, X. Yang, J. Sun and H.-Q. Lin, Berezinskii-Kosterlitz-Thoules phase transitionof spin-orbit coupled Fermi gas in optical lattice, Europhys. Lett. 107, 40003 (2014),
doi:10.1209/0295-5075/107/40003.
[43] J. S. Hofmann, E. Berg and D. Chowdhury, Superconductivity, pseudogap, andphase separation in topological flat bands, Phys. Rev. B 102, 201112 (2020),
doi:10.1103/PhysRevB.102.201112.
[44] V. Peri, Z.-D. Song, B. Andrei Bernevig and S. D. Huber, Fragile topology and flat-band
superconductivity in the strong-coupling regime, Phys. Rev. Lett. 126, 027002 (2021),
doi:10.1103/PhysRevLett.126.027002.
[45] F. F. Assaad, Phase diagram of the half-filled two-dimensional SU(N ) HubbardHeisenberg model: A quantum Monte Carlo study, Phys. Rev. B 71, 075103 (2005),
doi:10.1103/PhysRevB.71.075103.
[46] T. C. Lang, Z. Yang Meng, A. Muramatsu, S. Wessel and F. F. Assaad, Dimerized solids
and resonating plaquette order in SU(N )-Dirac fermions, Phys. Rev. Lett. 111, 066401(2013), doi:10.1103/PhysRevLett.111.066401.
[47] F. H. Kim, K. Penc, P. Nataf and F. Mila, Linear flavor-wave theory for fully antisymmetric SU(N ) irreducible representations, Phys. Rev. B 96, 205142 (2017),
doi:10.1103/PhysRevB.96.205142.
[48] D. Wang, Y. Li, Z. Cai, Z. Zhou, Y. Wang and C. Wu, Competing orders in the 2D halfFilled SU(2N ) Hubbard model through the pinning-field quantum Monte Carlo simulations, Phys. Rev. Lett. 112, 156403 (2014), doi:10.1103/PhysRevLett.112.156403.
[49] F. H. Kim, F. F. Assaad, K. Penc and F. Mila, Dimensional crossover in the SU(4) Heisenberg model in the six-dimensional antisymmetric self-conjugate representation revealed byquantum Monte Carlo and linear flavor-wave theory, Phys. Rev. B 100, 085103 (2019),
doi:10.1103/PhysRevB.100.085103.
[50] M. Raczkowski and F. F. Assaad, Phase diagram and dynamics of the SU(N )symmetric Kondo lattice model, Phys. Rev. Research 2, 013276 (2020),
doi:10.1103/PhysRevResearch.2.013276.
[51] M. Hohenadler, F. Parisen Toldin, I. F. Herbut and F. F. Assaad, Phase diagram of the Kane-Mele-Coulomb model, Phys. Rev. B 90, 085146 (2014),
doi:10.1103/PhysRevB.90.085146.
105

SciPost Phys. Codebases 1 (2022)[52] H.-K. Tang, E. Laksono, J. N. B. Rodrigues, P. Sengupta, F. F. Assaad and S. Adam,
Interaction-driven metal-insulator transition in strained graphene, Phys. Rev. Lett. 115,
186602 (2015), doi:10.1103/PhysRevLett.115.186602.
[53] H.-K. Tang, J. N. Leaw, J. N. B. Rodrigues, I. F. Herbut, P. Sengupta, F. F. Assaad and
S. Adam, The role of electron-electron interactions in two-dimensional Dirac fermions,
Science 361, 570 (2018), doi:10.1126/science.aao2934.
[54] M. Raczkowski and F. F. Assaad, Interplay between the edge-state magnetism and longrange Coulomb interaction in zigzag graphene nanoribbons: Quantum Monte Carlo study,
Phys. Rev. B 96, 115155 (2017), doi:10.1103/PhysRevB.96.115155.
[55] J. Ning Leaw, H.-K. Tang, P. Sengupta, F. F. Assaad, I. F. Herbut and S. Adam, Electronic
ground state in bilayer graphene with realistic Coulomb interactions, Phys. Rev. B 100,
125116 (2019), doi:10.1103/PhysRevB.100.125116.
[56] M. Rigol, A. Muramatsu, G. G. Batrouni and R. T. Scalettar, Local quantum criticality in confined fermions on optical lattices, Phys. Rev. Lett. 91, 130403 (2003),
doi:10.1103/PhysRevLett.91.130403.
[57] D. Lee, Lattice simulations for few- and many-body systems, Prog. Part. Nucl. Phys. 63,
117 (2009), doi:10.1016/j.ppnp.2008.12.001.
[58] Z. Wang, F. F. Assaad and F. Parisen Toldin, Finite-size effects in canonical and grandcanonical quantum Monte Carlo simulations for fermions, Phys. Rev. E 96, 042131(2017), doi:10.1103/PhysRevE.96.042131.
[59] T. Shen, Y. Liu, Y. Yu and B. M. Rubenstein, Finite temperature auxiliary field quantum Monte Carlo in the canonical ensemble, J. Chem. Phys. 153, 204108 (2020),
doi:10.1063/5.0026606.
[60] T. Grover, Entanglement of interacting fermions in quantum Monte Carlo calculations,Phys. Rev. Lett. 111, 130402 (2013), doi:10.1103/PhysRevLett.111.130402.
[61] P. Broecker and S. Trebst, Rényi entropies of interacting fermions from determinantal
quantum Monte Carlo simulations, J. Stat. Mech. P08015 (2014), doi:10.1088/17425468/2014/08/p08015.
[62] F. F. Assaad, T. C. Lang and F. Parisen Toldin, Entanglement spectra of interacting
fermions in quantum Monte Carlo simulations, Phys. Rev. B 89, 125121 (2014),
doi:10.1103/PhysRevB.89.125121.
[63] F. F. Assaad, Stable quantum Monte Carlo simulations for entanglement spectra of interacting fermions, Phys. Rev. B 91, 125146 (2015), doi:10.1103/PhysRevB.91.125146.
[64] F. Parisen Toldin and F. F. Assaad, Entanglement Hamiltonian of interacting fermionicmodels, Phys. Rev. Lett. 121, 200602 (2018), doi:10.1103/PhysRevLett.121.200602.
[65] F. Parisen Toldin, T. Sato and F. F. Assaad, Mutual information in heavy-fermion systems,
Phys. Rev. B 99, 155158 (2019), doi:10.1103/PhysRevB.99.155158.
[66] F. Parisen Toldin and F. F. Assaad, Entanglement studies of interacting fermionic models,J. Phys.: Conf. Ser. 1163, 012056 (2019), doi:10.1088/1742-6596/1163/1/012056.
[67] C. Chen, X. Y. Xu, J. Liu, G. Batrouni, R. Scalettar and Z. Yang Meng, Symmetry-enforced
self-learning Monte Carlo method applied to the Holstein model, Phys. Rev. B 98, 041102(2018), doi:10.1103/PhysRevB.98.041102.
106

SciPost Phys. Codebases 1 (2022)[68] C. Chen, X. Y. Xu, Z. Y. Meng and M. Hohenadler, Charge-density-wave transitions of Dirac fermions coupled to phonons, Phys. Rev. Lett. 122, 077601 (2019),
doi:10.1103/PhysRevLett.122.077601.
[69] S. Karakuzu, K. Seki and S. Sorella, Solution of the sign problem forthe half-filled Hubbard-Holstein model, Phys. Rev. B 98, 201108 (2018),
doi:10.1103/PhysRevB.98.201108.
[70] N. C. Costa, K. Seki, S. Yunoki and S. Sorella, Phase diagram of the two-dimensional
Hubbard-Holstein model, Commun. Phys. 3, 80 (2020), doi:10.1038/s42005-020-03422.
[71] N. C. Costa, K. Seki and S. Sorella, Magnetism and Charge Order in the Honeycomb
Lattice, Phys. Rev. Lett. 126, 107205 (2021), doi:10.1103/PhysRevLett.126.107205.
[72] O. Bradley, G. G. Batrouni and R. T. Scalettar, Superconductivity and charge density
wave order in the two-dimensional Holstein model, Phys. Rev. B 103, 235104 (2021),
doi:10.1103/PhysRevB.103.235104.
[73] M. Ippoliti, R. S. K. Mong, F. F. Assaad and M. P. Zaletel, Half-filled Landau levels: A continuum and sign-free regularization for three-dimensional quantum critical points, Phys.
Rev. B 98, 235108 (2018), doi:10.1103/PhysRevB.98.235108.
[74] Z. Wang, M. P. Zaletel, R. S. K. Mong and F. F. Assaad, Phases of the (2 + 1) dimensional
SO(5) nonlinear sigma model with topological term, Phys. Rev. Lett. 126, 045701 (2021),
doi:10.1103/PhysRevLett.126.045701.
[75] G. Pan, W. Wang, A. Davis, Y. Wang and Z. Yang Meng, Yukawa-SYK modeland self-tuned quantum criticality, Phys. Rev. Research 3, 013250 (2021),
doi:10.1103/PhysRevResearch.3.013250.
[76] H. Zhang et al., Coexistence and interaction of spinons and magnons in an antiferromagnet
with alternating antiferromagnetic and ferromagnetic quantum spin chains, Phys. Rev.
Lett. 125, 037204 (2020), doi:10.1103/PhysRevLett.125.037204.
[77] T. Sato and F. F. Assaad, Quantum Monte Carlo simulation of generalized Kitaev models,
Phys. Rev. B 104, L081106 (2021), doi:10.1103/PhysRevB.104.L081106.
[78] C. Wu and S.-C. Zhang, Sufficient condition for absence of the sign problem inthe fermionic quantum Monte Carlo algorithm, Phys. Rev. B 71, 155115 (2005),
doi:10.1103/PhysRevB.71.155115.
[79] E. F. Huffman and S. Chandrasekharan, Solution to sign problems in halffilled spin-polarized electronic systems, Phys. Rev. B 89, 111101 (2014),
doi:10.1103/PhysRevB.89.111101.
[80] Z.-X. Li, Y.-F. Jiang and H. Yao, Solving the fermion sign problem in quantum Monte
Carlo simulations by Majorana representation, Phys. Rev. B 91, 241117 (2015),
doi:10.1103/PhysRevB.91.241117.
[81] Z. C. Wei, C. Wu, Y. Li, S. Zhang and T. Xiang, Majorana positivity and the fermion
sign problem of quantum Monte Carlo simulations, Phys. Rev. Lett. 116, 250601 (2016),
doi:10.1103/PhysRevLett.116.250601.
[82] J. Hubbard, Calculation of partition functions, Phys. Rev. Lett. 3, 77 (1959),
doi:10.1103/PhysRevLett.3.77.
107

SciPost Phys. Codebases 1 (2022)[83] M. Troyer and U.-J. Wiese, Computational complexity and fundamental limitations
to fermionic quantum Monte Carlo simulations, Phys. Rev. Lett. 94, 170201 (2005),
doi:10.1103/PhysRevLett.94.170201.
[84] S. Duane and J. B. Kogut, Hybrid stochastic differential equations applied to quantum
chromodynamics, Phys. Rev. Lett. 55, 2774 (1985), doi:10.1103/PhysRevLett.55.2774.
[85] J. E. Hirsch, Discrete Hubbard-Stratonovich transformation for fermion lattice models,
Phys. Rev. B 28, 4059 (1983), doi:10.1103/PhysRevB.28.4059.
[86] A. D. Sokal, Monte Carlo methods in statistical mechanics: Foundations and new algorithms, in Lecture notes from Cours de Troisième Cycle de la Physique en Suisse Romande,
updated in 1996 for Cargèse Summer School on “Functional Integration: Basics andApplications” (1989).
[87] H. Gerd Evertz, G. Lana and M. Marcu, Cluster algorithm for vertex models, Phys. Rev.
Lett. 70, 875 (1993), doi:10.1103/PhysRevLett.70.875.
[88] A. W. Sandvik, Stochastic series expansion method with operator-loop update, Phys. Rev.
B 59, R14157 (1999), doi:10.1103/PhysRevB.59.R14157.
[89] O. F. Syljuåsen and A. W. Sandvik, Quantum Monte Carlo with directed loops, Phys. Rev.
E 66, 046701 (2002), doi:10.1103/PhysRevE.66.046701.
[90] J. E. Hirsch and R. M. Fye, Monte Carlo method for magnetic impurities in metals, Phys.
Rev. Lett. 56, 2521 (1986), doi:10.1103/PhysRevLett.56.2521.
[91] E. Gull, A. J. Millis, A. I. Lichtenstein, A. N. Rubtsov, M. Troyer and P. Werner,
Continuous-time Monte Carlo methods for quantum impurity models, Rev. Mod. Phys.
83, 349 (2011), doi:10.1103/RevModPhys.83.349.
[92] F. F. Assaad, DMFT at 25: Infinite dimensions: Lecture notes of the autumn school on
correlated electrons 4, in Chap. 7. Continuous-time QMC solvers for electronic systems
in fermionic and bosonic baths, Verlag des Forschungszentrum Jülich, Jülich, ISBN
9783893369539 (2014).
[93] F. F. Assaad and T. C. Lang, Diagrammatic determinantal quantum Monte Carlo methods: Projective schemes and applications to the Hubbard-Holstein model, Phys. Rev. B 76,
035116 (2007), doi:10.1103/PhysRevB.76.035116.
[94] R. T. Scalettar, D. J. Scalapino and R. L. Sugar, New algorithm for the numerical simulation of fermions, Phys. Rev. B 34, 7911 (1986), doi:10.1103/PhysRevB.34.7911.
[95] S. Beyl, F. Goth and F. F. Assaad, Revisiting the hybrid quantum Monte Carlo
method for Hubbard and electron-phonon models, Phys. Rev. B 97, 085144 (2018),
doi:10.1103/PhysRevB.97.085144.
[96] S. Dürr et al., Ab initio determination of light hadron masses, Science 322, 1224 (2008),
doi:10.1126/science.1163233.
[97] F. F. Assaad, Quantum Monte Carlo methods on lattices: The determinantal method, in
J. Grotendorst, D. Marx and A. Muramatsu., eds., Lecture notes of the winter school onquantum simulations of complex many-body systems: From theory to algorithms 10,
99, Publication series of the John von Neumann institute for computing, Jülich (2002).

108

SciPost Phys. Codebases 1 (2022)[98] Y. Motome and M. Imada, A quantum Monte Carlo method and its applications to multiorbital Hubbard models, J. Phys. Soc. Jpn. 66, 1872 (1997), doi:10.1143/JPSJ.66.1872.
[99] F. F. Assaad, M. Imada and D. J. Scalapino, Charge and spin structures of a d x 2 − y 2 superconductor in the proximity of an antiferromagnetic Mott insulator, Phys. Rev. B 56,
15001 (1997), doi:10.1103/PhysRevB.56.15001.
[100] C.-R. Lee, S. Chiesa, C. N. Varney, E. Khatami, Z. Bai, E. F. D’Azevedo, M. Jarrell, T. Maier,
S. Y. Savrasov, R. T. Scalettar and K. Tomko, Quest: Quantum electron simulation toolbox(2010).
[101] A. W. Sandvik, Stochastic method for analytic continuation of quantum Monte Carlo data,
Phys. Rev. B 57, 10287 (1998), doi:10.1103/PhysRevB.57.10287.
[102] K. S. D. Beach, Identifying the maximum entropy method as a special limit of stochastic
analytic continuation, arXiv:cond-mat/0403055.
[103] R. M. Fye, New results on Trotter-like approximations, Phys. Rev. B 33, 6271 (1986),
doi:10.1103/PhysRevB.33.6271.
[104] M. Iazzi and M. Troyer, Efficient continuous-time quantum Monte Carlo algorithm for fermionic lattice models, Phys. Rev. B 91, 241118 (2015),
doi:10.1103/PhysRevB.91.241118.
[105] S. M. A. Rombouts, K. Heyde and N. Jachowicz, Quantum Monte Carlo Method
for Fermions, Free of Discretization Errors, Phys. Rev. Lett. 82, 4155 (1999),
doi:10.1103/PhysRevLett.82.4155.
[106] E. Gull, P. Werner, O. Parcollet and M. Troyer, Continuous-time auxiliary-field Monte Carlofor quantum impurity models, Europhys. Lett. 82, 57003 (2008), doi:10.1209/02955075/82/57003.
[107] S. Rombouts, K. Heyde and N. Jachowicz, A discrete Hubbard-Stratonovich decomposition for general, fermionic two-body interactions, Phys. Lett. A 242, 271 (1998),
doi:10.1016/S0375-9601(98)00197-2.
[108] D. Rost, E. V. Gorelik, F. Assaad and N. Blümer, Momentum-dependent pseudogaps
in the half-filled two-dimensional Hubbard model, Phys. Rev. B 86, 155109 (2012),
doi:10.1103/PhysRevB.86.155109.
[109] D. Rost, F. Assaad and N. Blümer, Quasi-continuous-time impurity solver for the dynamical
mean-field theory with linear scaling in the inverse temperature, Phys. Rev. E 87, 053305(2013), doi:10.1103/PhysRevE.87.053305.
[110] N. Blümer, Multigrid Hirsch-Fye quantum Monte Carlo method for dynamical mean-field
theory, arXiv:0801.1222.
[111] L. Wang, Y.-H. Liu and M. Troyer, Stochastic series expansion simulation of the t −v model,
Phys. Rev. B 93, 155117 (2016), doi:10.1103/PhysRevB.93.155117.
[112] E. Huffman and S. Chandrasekharan, Fermion bag approach to Hamiltonian
lattice field theories in continuous time, Phys. Rev. D 96, 114502 (2017),
doi:10.1103/PhysRevD.96.114502.
[113] E. Huffman and S. Chandrasekharan, Fermion-bag inspired Hamiltonian latticefield theory for fermionic quantum criticality, Phys. Rev. D 101, 074501 (2020),
doi:10.1103/PhysRevD.101.074501.
109

SciPost Phys. Codebases 1 (2022)[114] F. Goth, Higher order auxiliary field quantum Monte Carlo methods, arXiv:2009.04491.
[115] I. Peschel, Calculation of reduced density matrices from correlation functions, J. Phys. A:
Math. Gen. 36, L205 (2003), doi:10.1088/0305-4470/36/14/101.
[116] Z.-Q. Wan, S.-X. Zhang and H. Yao, Mitigating sign problem by automatic differentiation,
arXiv:2010.01141.
[117] D. Hangleiter, I. Roth, D. Nagaj and J. Eisert, Easing the Monte Carlo sign problem, Sci.
Adv. 6, (2020), doi:10.1126/sciadv.abb8341.
[118] J. Liu, Y. Qi, Z. Yang Meng and L. Fu, Self-learning Monte Carlo method, Phys. Rev. B 95,
041101 (2017), doi:10.1103/PhysRevB.95.041101.
[119] X. Y. Xu, Y. Qi, J. Liu, L. Fu and Z. Yang Meng, Self-learning quantum Monte
Carlo method in interacting fermion systems, Phys. Rev. B 96, 041119 (2017),
doi:10.1103/PhysRevB.96.041119.
[120] K. Hukushima and K. Nemoto, Exchange Monte Carlo method and application to spinglass simulations, J. Phys. Soc. Jpn. 65, 1604 (1996), doi:10.1143/JPSJ.65.1604.
[121] C. J. Geyer, Markov chain Monte Carlo maximum likelihood, In Computing science andstatistics: Proceedings of the 23rd symposium on the interface, 156, American statisticalassociation, New York, (1991).
[122] C. W. Gardiner, Handbook of stochastic methods, Springer-Verlag Berlin Heidelberg, Heidelberg, Germany, ISBN 9783540707127, (1985).
[123] G. G. Batrouni, G. R. Katz, A. S. Kronfeld, G. P. Lepage, B. Svetitsky and K. G.
Wilson, Langevin simulations of lattice field theories, Phys. Rev. D 32, 2736 (1985),
doi:10.1103/PhysRevD.32.2736.
[124] G. G. Batrouni and R. T. Scalettar, Langevin simulations of a long-range electron-phononmodel, Phys. Rev. B 99, 035114 (2019), doi:10.1103/PhysRevB.99.035114.
[125] C. Davies, G. Batrouni, G. Katz, A. Kronfeld, P. Lepage, P. Rossi, B. Svetitsky and K.
Wilson, Langevin simulations of lattice field theories using Fourier acceleration, J. Stat.
Phys. 43, 1073 (1986), doi:10.1007/BF02628331.
[126] S. Beyl, Hybrid quantum Monte Carlo for condensed matter models, Doctoral thesis, Universität Würzburg, doi:10.25972/OPUS-19122 (2020).
[127] E. Loh, J. Gubernatis, R. Scalettar, R. Sugar and S. White, Stable matrix-multiplication
algorithms for low-temperature numerical simulations of fermions, In Interacting electrons in reduced dimensions, Springer US, Boston, MA, ISBN 9781461278696 (1989),
doi:10.1007/978-1-4613-0565-1_8.
[128] E. Y. Loh, J. E. Gubernatis, R. T. Scalettar, S. R. White, D. J. Scalapino and R. L. Sugar,
Numerical stability and the sign problem in the determinant quantum Monte Carlo method,Int. J. Mod. Phys. C 16, 1319 (2005), doi:10.1142/S0129183105007911.
[129] Z. Bai, C. Lee, R.-C. Li and S. Xu, Stable solutions of linear systems involving long chain of matrix multiplications, Linear Algebra Appl. 435, 659 (2011),
doi:10.1016/j.laa.2010.06.023.
[130] C. Bauer, Fast and stable determinant quantum Monte Carlo, SciPost Phys. Core 2, 011(2020), doi:10.21468/SciPostPhysCore.2.2.011.
110

SciPost Phys. Codebases 1 (2022)[131] J. Demmel and K. Veselić, Jacobi’s method is more accurate than qr, SIAM J. Matrix Anal.
& Appl. 13, 1204 (1992), doi:10.1137/0613074.
[132] J. Dongarra, M. Gates, A. Haidar, J. Kurzak, P. Luszczek, S. Tomov and I. Yamazaki,
The singular value decomposition: Anatomy of optimizing an algorithm for extreme scale,
SIAM Rev. 60, 808 (2018), doi:10.1137/17M1117732.
[133] A. van der Sluis, Condition numbers and equilibration of matrices, Numer. Math. 14, 14(1969), doi:10.1007/BF02165096.
[134] M. Feldbacher and F. F. Assaad, Efficient calculation of imaginary-time-displaced correlation functions in the projector auxiliary-field quantum Monte Carlo algorithm, Phys. Rev.
B 63, 073105 (2001), doi:10.1103/PhysRevB.63.073105.
[135] D. Ixert, F. F. Assaad and K. P. Schmidt, Mott physics in the half-filled Hubbard
model on a family of vortex-full square lattices, Phys. Rev. B 90, 195133 (2014),
doi:10.1103/PhysRevB.90.195133.
[136] J. W. Negele and H. Orland, Quantum many body systems, Frontiers in physics. AddisonWesley, Redwood City, California, ISBN 9780738200521, (1988).
[137] W. Krauth, Statistical mechanics: Algorithms and computations, Oxford University Press,
Oxford, UK, ISBN 9780198515364, (2006).
[138] C. J. Geyer, Practical Markov chain Monte Carlo, Statist. Sci. 7, 473 (1992),
doi:10.1214/ss/1177011137.
[139] R. M. Neal, Probabilistic inference using Markov chain Monte Carlo methods, Departmentof Computer Science, University of Toronto, Toronto, Ontario, Canada (1993).
[140] M. Bercx, J. S. Hofmann, F. F. Assaad and T. C. Lang, Spontaneous particle-hole symmetry breaking of correlated fermions on the Lieb lattice, Phys. Rev. B 95, 035108 (2017),
doi:10.1103/PhysRevB.95.035108.
[141] B. Efron and C. Stein, The jackknife estimate of variance, Ann. Statist. 9, 586 (1981),
doi:10.1214/aos/1176345462.
[142] S. Chakravarty, B. I. Halperin and D. R. Nelson, Low-temperature behavior of
two-dimensional quantum antiferromagnets, Phys. Rev. Lett. 60, 1057 (1988),
doi:10.1103/PhysRevLett.60.1057.
[143] M. B. Thompson, A comparison of methods for computing autocorrelation time,arXiv:1011.0175.
[144] I. Milat, F. Assaad and M. Sigrist, Field induced magnetic ordering transition in Kondo
insulators, Eur. Phys. J. B 38, 571 (2004), doi:10.1140/epjb/e2004-00154-5.
[145] M. Bercx, T. C. Lang and F. F. Assaad, Magnetic field induced semimetal-to-cantedantiferromagnet transition on the honeycomb lattice, Phys. Rev. B 80, 045412 (2009),
doi:10.1103/PhysRevB.80.045412.
[146] A. Parola, S. Sorella, M. Parrinello and E. Tosatti, D-wave, dimer, and chiral states in the two-dimensional Hubbard model, Phys. Rev. B 43, 6190 (1991),
doi:10.1103/PhysRevB.43.6190.
[147] J. R. Schrieffer and P. A. Wolff, Relation between the Anderson and Kondo Hamiltonians,
Phys. Rev. 149, 491 (1966), doi:10.1103/PhysRev.149.491.
111

SciPost Phys. Codebases 1 (2022)[148] T. A. Costi, Kondo effect in a magnetic field and the magnetoresistivity of Kondo alloys,
Phys. Rev. Lett. 85, 1504 (2000), doi:10.1103/PhysRevLett.85.1504.
[149] M. Raczkowski and F. F. Assaad, Emergent coherent lattice behavior in Kondo nanosystems,
Phys. Rev. Lett. 122, 097203 (2019), doi:10.1103/PhysRevLett.122.097203.
[150] M. Maltseva, M. Dzero and P. Coleman, Electron cotunneling into a Kondo lattice, Phys.
Rev. Lett. 103, 206402 (2009), doi:10.1103/PhysRevLett.103.206402.
[151] M. Vekić, J. W. Cannon, D. J. Scalapino, R. T. Scalettar and R. L. Sugar,
Competition between antiferromagnetic order and spin-liquid behavior in the twodimensional periodic Anderson model at half filling, Phys. Rev. Lett. 74, 2367 (1995),
doi:10.1103/PhysRevLett.74.2367.
[152] Z.-X. Li, Y.-F. Jiang and H. Yao, Majorana-Time-Reversal Symmetries: A Fundamental
principle for sign-problem-free quantum Monte Carlo simulations, Phys. Rev. Lett. 117,
267002 (2016), doi:10.1103/PhysRevLett.117.267002.
[153] K. S. D. Beach, P. A. Lee and P. Monthoux, Field-induced antiferromagnetism in the Kondo
insulator, Phys. Rev. Lett. 92, 026401 (2004), doi:10.1103/PhysRevLett.92.026401.
[154] A. Rüegg, S. D. Huber and M. Sigrist, Z2 -slave-spin theory for strongly correlated
fermions, Phys. Rev. B 81, 155118 (2010), doi:10.1103/PhysRevB.81.155118.
[155] A. Abendschein and F. F. Assaad, Temperature dependence of spectral functions for the
one-dimensional Hubbard model: Comparison with experiments, Phys. Rev. B 73, 165119(2006), doi:10.1103/PhysRevB.73.165119.
[156] A. N. Rubtsov, V. V. Savkin and A. I. Lichtenstein, Continuous-time quantum Monte Carlo method for fermions, Phys. Rev. B 72, 035122 (2005),
doi:10.1103/PhysRevB.72.035122.
[157] Jülich Supercomputing Centre, JURECA: General-purpose supercomputer at Jülich Supercomputing Centre, J. large-scale res. facil. 2, A62 (2016).

112