HofstadterTools: A Python package for analyzing the Hofstadter model

The Hofstadter model successfully describes the behavior of non-interacting quantum particles hopping on a lattice coupled to a gauge field, and hence is ubiquitous in many fields of research, including condensed matter, optical, and atomic physics. Motivated by this, we introduce HofstadterTools (https://hofstadter.tools), a Python package that can be used to analyze the energy spectrum of a generalized Hofstadter model, with any combination of hoppings on any regular Euclidean lattice. The package can be applied to compute key properties of the band structure, such as quantum geometry and topology, as well as plot Hofstadter butterflies and Wannier diagrams that are colored according to their Chern numbers.


Statement of need
The purpose of HofstadterTools is to consolidate the fragmented theory and code relevant to the Hofstadter model into one well-documented Python package, which can be used easily by non-specialists as a benchmark or springboard for their own research projects.The Hofstadter model [1][2][3] is an iconic tight-binding model in physics and famously yields a fractal energy spectrum as a function of flux density, as shown in Figs. 1, 2, 3, and 4. Consequently, it is often treated as an add-on to larger numerical packages, such as WannierTools [4], pyqula [5], and DiagHam [6], or simply included as supplementary code together with research articles [7].However, the Hofstadter model's generalizability, interdisciplinary appeal, and recent experimental realization, motivates us to create a dedicated package that can provide a detailed analysis of its band structure, in the general case.
1. Generalizability.The Hofstadter model was originally studied in the context of electrons hopping in a periodic potential coupled to a perpendicular magnetic field.However, the model transcends this framework and can be extended in numerous directions.For example, the Peierls phases that arise in the Hamiltonian due to the magnetic field [8] can also be generated using artificial gauge fields [9] or Floquet modulation [10].Moreover, the full scope of the Hofstadter model is still being revealed, with papers on its application to hyperbolic lattices [11], higher-dimensional crystals [12], and synthesized materials [7], all published within the last couple of years.
2. Interdisciplinary appeal.Owing to its generalizability, interest in the Hofstadter model goes beyond its well-known connection to condensed matter physics and the quantum Hall effect [13].In mathematics, for example, the difference relation arising in the solution of the Hofstadter model, known as the Harper equation [1], is a special case of an "almost Mathieu operator", which is one of the most studied types of ergodic Schrödinger operator [14,15].Moreover, in other branches of physics, the Hofstadter model has growing relevance in a variety of subfields, including: cold atomic gases [16], acoustic metamaterials [17], and photonics [18].
3. Recent experimental realization.Although the Hofstadter model was introduced last century [1,8], it has only been experimentally realized within the last decade.Signatures of the Hofstadter spectrum were first observed in moiré materials [19] and optical flux lattices [20], and they have since been reproduced in several other experimental platforms [16][17][18]21].Not only does this spur recent theoretical interest, but it also increases the likelihood of experimental groups entering the field, with the need for a self-contained code repository that can be quickly applied to benchmark data and related computations.
A prominent use-case of HofstadterTools is to facilitate the study of a rich landscape of many-body problems.The Hofstadter model is an infinitely-configurable topological flat-band model and hence, is a popular choice among theorists studying strongly-correlated phenomena, such as the fractional quantum Hall effect [22,23] and superconductivity [24,25].Since there is a relationship between the quantum geometry and topology of single-particle band structures and the stability of exotic strongly-correlated states [26][27][28][29][30][31], HofstadterTools may be used to guide theorists who are researching quantum many-body systems.More broadly, we hope that HofstadterTools will find many interdisciplinary applications, and we look forward to expanding the package in these directions, with help from the community.[34]

Figure 1 :
Figure 1: Square Lattice.(a) Hofstadter butterfly and (b) Wannier diagram for the Hofstadter model defined with nearest-neighbor hoppings on the square lattice.(a) The energy E, and (b) the integrated density of states below the gap N (E), are plotted as a function of flux density n ϕ = BAmin/ϕ0 = p/499, where B is the perpendicular field strength, Amin is the area of a minimal hopping plaquette, ϕ0 is the flux quantum, and p is an integer.The r-th gap is colored with respect to t = r i=0 Ci,where Ci is the Chern number of band i.The size of the points in the Wannier diagram is proportional to the size of the gaps.[12]

Figure 3 :
Figure 3: Honeycomb Lattice.(a) Hofstadter butterfly and (b) Wannier diagram for the Hofstadter model defined with nearest-neighbor hoppings on the honeycomb lattice.[33]

Figure 4 :
Figure 4: Kagome Lattice.(a) Hofstadter butterfly and (b) Wannier diagram for the Hofstadter model defined with nearest-neighbor hoppings on the kagome lattice.[34]