Examples#
Runnable scripts demonstrating the conceptual breakthroughs behind tbkit, from Bloch’s band theory to Floquet topological insulators – see History for the full chronology each script illustrates.
See also the narrative walkthrough: Tutorial.
Each script in this gallery is self-contained and can be run directly with
python examples/<section>/<script>.py. Every script also carries an
RST module docstring as its title/description and uses # %% markers
to split narrative text from code, which is exactly what Sphinx-Gallery
renders into the pages below – the script is the source of truth for
what you see, not a copy of it. Every numeric claim a script’s narrative
makes is checked with an assert right there in the code – nothing is
asserted in the docs that isn’t also verified in code.
Sections#
tight_binding – the generic real-space/reciprocal-space machinery: a graphene flake and its Bloch band structure, including Wallace’s 1947 linear (Dirac) dispersion near the K point, and the physics behind the 2004 isolation of graphene.
orbitals – several orbitals per site: Slater-Koster bond integrals between s, p and d orbitals, with non-orthogonal bases.
three_dimensions – 3D lattices: the Anderson metal-insulator transition and Weyl semimetals with their Fermi arcs.
magnetic_field – the Peierls substitution: gauge-invariant plaquette fluxes, an Aharonov-Bohm ring’s flux-periodic spectrum, Landau levels, and the fractal Hofstadter butterfly.
strain – strain-induced pseudo-magnetic fields in graphene.
disorder – Anderson localization: the Inverse Participation Ratio vs. disorder strength, and an extended state next to a localized one.
topology – topological band theory: the SSH model and its Zak phase, the Haldane model’s Chern number, the TKNN Hall conductance, the Kane-Mele Z2 invariant (Wannier-centre flow and Fu-Kane parities), the Thouless pump, the quantum metric, the local Chern marker, the tenfold way, and diabolical points.
hall_effects – Hall conductivities at any Fermi level: the anomalous Hall effect of the Haldane model (in k-space, and in real space with disorder by the kernel polynomial method) and the intrinsic spin Hall effect of the Kane-Mele model.
flat_bands – the kagome and Lieb lattices’ exactly flat bands, the natural home for strong-correlation physics via Lieb’s theorem.
correlations – the Hubbard model in mean field: zigzag-edge magnetism in graphene and Lieb’s theorem.
superconductivity – the Bogoliubov-de Gennes formalism and the Majorana end modes of the Kitaev chain.
transport – Landauer conductance through a device between semi-infinite leads, and the quantized steps of a point contact.
large_scale – sparse solvers and the kernel polynomial method for lattices of hundreds of thousands of sites.
dynamics – real-time wavepacket propagation: Bloch oscillations and the Wannier-Stark ladder under a uniform tilt.
non_hermitian – PT symmetry, exceptional points, the non-Hermitian skin effect with its generalized Brillouin zone, and exceptional points in momentum space: vorticity, exceptional rings, bulk Fermi arcs, encircling, and biorthogonal Chern numbers.
floquet – periodically driven lattices: a Floquet Chern insulator made with circularly polarized light, and anomalous Floquet phases with edge states despite zero Chern numbers.
models – building, bridging and saving models: hoppings by neighbour order in k-space (third-nearest-neighbour graphene with overlaps), and bridges between the real-space and k-space pipelines (the Haldane model on a torus), models saved to and reloaded from disk, and maximally localized Wannier functions: graphene’s pi bands imported from a Wannier90 file.
higher_order – higher-order topology: the Benalcazar-Bernevig-Hughes quadrupole insulator, its nested Wilson loop, zero-energy corner states and fractional corner charges.
moire – supercells, band unfolding and the spectral function of disordered supercells, and twisted bilayers: the flat bands of magic-angle twisted bilayer graphene.
optics – the optical response of Bloch bands: the Kubo-Greenwood conductivity and graphene’s universal absorption, the Berry curvature dipole of the nonlinear Hall effect, and the shift current of the bulk photovoltaic effect.
Correlations#
Interacting electrons, in the Hartree-Fock mean-field approximation of the Hubbard model: the magnetism of graphene’s zigzag edges and of triangular nanoislands, Lieb’s theorem and the ferrimagnet of the Lieb lattice, and flat-band ferromagnetism (Nagaoka, Mielke, Tasaki). The non-collinear mean field finds the 120-degree order of the frustrated triangular lattice.
Flat-Band Ferromagnetism: Nagaoka, Mielke and Tasaki
The Hubbard Model: Magnetism of Graphene’s Zigzag Edges
Lieb’s Theorem: The Ferrimagnet of the Lieb Lattice
Frustrated Magnetism: the 120-Degree Order of the Triangular Hubbard Model
Disorder#
Anderson localization: the Inverse Participation Ratio vs. disorder strength, and an extended state shown side by side with a localized one. The IPR’s scaling with size and the multifractal states of a critical chain, the self-dual Aubry-André transition of a quasiperiodic chain, Lifshitz tails of the density of states, and the zero modes bound by vacancies in graphene.
Aubry-André Localization: a Self-Dual Metal-Insulator Transition in 1D
The Inverse Participation Ratio and Multifractal Wave Functions
Lifshitz Tails in the Density of States of a Disordered Lattice
Dynamics#
Real-time wavepacket propagation: Bloch oscillations and the Wannier-Stark ladder under a uniform lattice tilt, Landau-Zener tunnelling and Zener breakdown between bands, and light in waveguide arrays (the directional coupler, discrete diffraction and diffraction management).
Wave Propagation: Interference on a Ring and a Trapped Domain-Wall State
Flat Bands#
The kagome and Lieb lattices’ exactly flat bands, the natural home for strong-correlation physics via Lieb’s theorem.
Floquet#
Periodically driven lattices: quasienergies, the Floquet Hamiltonian, dynamic localization and coherent destruction of tunnelling, the photovoltaic Hall effect of graphene in circularly polarized light, a Chern insulator engineered with that light, and anomalous Floquet phases, whose edge states the winding number counts while every Chern number vanishes.
Anomalous Floquet Topological Phases: Edge States With Zero Chern Numbers
Dynamic Localization and Coherent Destruction of Tunnelling
Floquet Engineering: A Chern Insulator From Circularly Polarized Light
Hall effects#
Hall responses at any Fermi level, from the Berry curvature of the bands: the anomalous Hall conductivity of the Haldane model (its quantized plateau in the gap, and its non-quantized value in the bands), the same plateau surviving disorder in a real-space Kubo-Bastin (kernel polynomial) calculation on a torus, and the intrinsic spin Hall conductivity of the Kane-Mele model with its departure from quantization under Rashba coupling. The same curvature, weighted by entropy or by energy, drives the anomalous Nernst effect (with the Mott relation) and the thermal Hall effect (with the Wiedemann-Franz law and its quantized Chern plateau).
The Anomalous Hall Effect in Real Space: a Disordered Chern Insulator
The Anomalous Hall Effect: from the Anomalous Velocity to the Berry Phase
The Intrinsic Spin Hall Effect: Kane-Mele Plateau and Rashba Coupling
The Intrinsic Thermal Hall Effect and the Wiedemann-Franz Law
Higher-Order Topology#
Topological phases beyond dipoles: Wannier sectors, nested Wilson loops, the quantized quadrupole moment of the Benalcazar-Bernevig-Hughes model, and the zero-energy corner states and fractional corner charges it binds.
Quantized Electric Quadrupole Insulators: the Benalcazar-Bernevig-Hughes Model
Large lattices#
Lattices far beyond dense diagonalization: sparse neighbour search, shift-invert eigensolvers, and the kernel polynomial method, which turns spectral densities and conductivities of hundreds of thousands of sites into a few hundred sparse matrix-vector products. In k-space, fine meshes are diagonalized in batches, optionally across threads.
Batched and Threaded k-Space Diagonalization: the Haldane Model on 90,000 k-Points
The Kernel Polynomial Method: Graphene With Vacancies, 45,000 Sites
Magnetic Field#
The Peierls substitution on a lattice: gauge-invariant flux through the plaquettes, an Aharonov-Bohm ring’s flux-periodic spectrum, Landau levels of the square lattice and of graphene, Zak’s magnetic translations and the magnetic supercell at rational flux, and the self-similar, fractal Hofstadter butterfly swept continuously in flux, and the orbital magnetization of a Chern insulator, checked against the Streda formula on a flake.
Zak’s Magnetic Translation Group: the Magnetic Supercell at Rational Flux
The Peierls Substitution: Flux Through the Plaquettes, in Any Gauge
Building, Bridging and Saving Models#
Tools that make realistic models easy to build and move around: Bloch
Hamiltonians set up by neighbour order (1st, 2nd, 3rd, … neighbours) as
in real space, bridges between the real-space System
and the reciprocal-space KSpace pipelines, k·p
(continuum) Hamiltonians discretized into lattice models and the fermion
doubling that comes with it, models
saved to and loaded from disk, tight-binding models imported from
Wannier90’s _hr.dat files, and Wannier functions built from any model
(isolated or entangled bands), with their Wannier-interpolated model.
Maximally Localized Wannier Functions: Projection and Spread Minimization
Disentanglement: Wannier Functions of the π Bands of Graphene
k·p Theory on a Lattice: from a Continuum Hamiltonian to Tight-Binding
Maximally Localized Wannier Functions: Graphene from a Wannier90 File
Hoppings by Neighbour Order in k-Space: Third-Nearest-Neighbour Graphene
From Real Space to k-Space and Back: the Haldane Model on a Torus
Saving and Reloading Models: a Kane-Mele Model on Disk
Supercells and Moiré Structures#
Supercells of periodic models: band unfolding and the spectral function of disordered supercells, and the commensurate moiré cells of twisted bilayers, down to the flat bands of magic-angle twisted bilayer graphene.
Band Unfolding: the Effective Band Structure of a Disordered Supercell
Magic-Angle Twisted Bilayer Graphene: Flat Moiré Bands
Non-Hermitian lattices#
Lattices with balanced gain and loss: PT-symmetric spectra that stay real up to a threshold, the exceptional points at which eigenvalues and eigenvectors coalesce, the Petermann factor that measures how far the eigenbasis has been skewed, and the selective amplification of a topological edge mode. With non-reciprocal hoppings: the non-Hermitian skin effect, its spectral winding number, and the generalized Brillouin zone that restores the bulk-boundary correspondence. In two dimensions: exceptional points in momentum space, their charges (eigenvalue vorticity and discriminant winding), the pair of EPs and the bulk Fermi arc into which a Dirac point splits, exceptional rings, encircling an EP (the state swap and the four-loop return), and the biorthogonal Chern number of a line-gapped band.
Exceptional Points in Momentum Space: Encircling an EP versus a Dirac Point
Exceptional Points in Momentum Space: Vorticity and Exceptional Rings
Exceptional Points in Momentum Space: the Chern Number until the Line Gap Closes
Exceptional Points in Momentum Space: Complex Bands and the Bulk Fermi Arc
The Generalized Brillouin Zone and Non-Bloch Band Theory
PT Symmetry, Exceptional Points, and a Selectively Amplified Edge Mode
Optics#
Linear and nonlinear optical response of Bloch bands: the Kubo-Greenwood optical conductivity and the universal absorption of graphene, the Berry curvature dipole behind the nonlinear Hall effect, and the shift current of the bulk photovoltaic effect.
The Bulk Photovoltaic Effect: the Shift Current of Gapped Graphene
The Universal Absorption of Graphene: Opacity Defined by the Fine-Structure Constant
The Nonlinear Hall Effect: the Berry Curvature Dipole of a Tilted Dirac Cone
Orbitals#
Beyond one orbital per site: Slater-Koster bond integrals between s, p and d orbitals, non-orthogonal bases and their Löwdin orthogonalization, spin with Rashba spin-orbit coupling and a Zeeman field, and the band structures they give.
Löwdin Orthogonalization and Non-Orthogonal Tight Binding
Rashba Spin-Orbit Coupling: Spin-Split Bands from Broken Inversion Symmetry
The Slater-Koster Method: Graphene’s sigma and pi Bands
Strain#
Mechanical strain as a gauge field: triaxial strain bends graphene’s bonds into a pseudo-magnetic field that quantizes the Dirac spectrum into Landau levels while leaving the Hamiltonian real, and therefore time-reversal symmetry intact.
Strain as a Gauge Field: Pseudo-Landau Levels in Graphene
Superconductivity#
Superconductors in the Bogoliubov-de Gennes formalism: particle-hole symmetric spectra and Andreev bound states in junctions, and the Majorana zero modes at the ends of Kitaev’s p-wave chain, with its Pfaffian bulk invariant, the Majorana number, and of a Rashba nanowire in a Zeeman field. The self-consistent BCS gap equation in real space, with its universal ratio Delta(0)/T_c = 1.764 and the proximity effect. Andreev reflection at a normal-superconductor junction and the BTK conductance, from the scattering matrix resolved into electrons and holes.
Andreev Reflection: the BTK Conductance of a Normal-Superconductor Junction
The BCS Gap Equation: Delta(T) and the Universal Ratio Delta(0)/T_c = 1.764
The Bogoliubov-de Gennes Equations: Andreev Bound States
Majorana Nanowires: Rashba, Zeeman and s-Wave Pairing
Three dimensions#
Lattices in 3D space: the Anderson metal-insulator transition, which exists only in three dimensions, and Weyl semimetals, whose band touchings (located, with their chiralities, by a Weyl point finder) are monopoles of Berry curvature with Fermi-arc surface states.
The Scaling Theory of Localization: the 3D Anderson Transition
Weyl Semimetals: Monopoles of Berry Curvature and Fermi Arcs
Tight-Binding#
The generic real-space and reciprocal-space machinery: the square
lattice, whose single band is simple enough to check by hand, as the
smallest complete illustration of Bloch’s theorem; Brillouin zones and
the standard high-symmetry paths of the 2D and 3D Bravais lattices;
Monkhorst-Pack k-point grids; a graphene flake
diagonalized directly and its Bloch band structure along a k-path,
including Wallace’s 1947 linear (Dirac) dispersion near the K point;
the physics behind the 2004 isolation of graphene – flakes, edge
states, and the Berry phase of pi of its Dirac cones; the zigzag edge
states of graphene ribbons and the 3m + 2 rule of armchair ribbons;
surface Green’s functions by Lopez Sancho decimation; and
tbkit.plot.Plot’s lattice, spectrum, density-of-states, and
eigenstate-intensity plots; parametrized Hamiltonians, whose value
functions let a flux or dimerization sweep re-evaluate the hoppings
instead of rebuilding the model; periodic boundaries in real space,
tori and cylinders whose spectra match the Bloch bands on a k-mesh;
and the analysis of a band structure: Fermi surfaces and their Lifshitz
transitions, bands projected on sublattices or spins and spin textures,
and the tetrahedron method for the density of states.
Building Finite Lattices: Unit Cells, Cuts, and Lattice Arithmetic
Defects and Impurities in a Graphene Flake: Vacancy Zero Modes and Bound States
Graphene: Real-Space Flake and Reciprocal-Space Bands
The Isolation of Graphene: Flakes, Edges, and a Berry Phase of pi
Parametrized Hamiltonians: Sweeping Without Rebuilding
Periodic Boundaries in Real Space: Tori and Cylinders
The Square Lattice: Bloch’s Theorem in its Simplest Form
The Surface Green’s Function by Lopez Sancho Decimation
Topology#
Topological band theory: the SSH model’s bulk-boundary correspondence and its Zak phase, the Haldane model’s Chern-number phase transition and Berry curvature, the TKNN quantized Hall conductance of the Hofstadter bands, Kane-Mele helical edge states cut from ribbons, the Kane-Mele Z2 invariant from Wannier-centre flow and the Fu-Kane parity criterion, the surface Dirac cone of a 3D topological insulator (surface spectral function of a semi-infinite crystal), the Thouless quantum pump’s exactly quantized charge transport, a topological (Chern) flat band on the kagome lattice, the quantum metric of a Bloch band, the local Chern marker of a disordered flake, the Bott index of a disordered torus, the entanglement spectrum of a cut SSH ring and Haldane cylinder, the spin Chern number of the Kane-Mele model with Rashba coupling, the mirror Chern number of a topological crystalline insulator, the four Z2 indices of strong and weak 3D topological insulators, the axion angle pumped by 2 pi around a cycle of a lattice Dirac model, the tenfold-way classification of tight-binding models by their symmetries, and the diabolical points (conical intersections with a Berry phase of pi) of a two-parameter family.
Three-Dimensional Topological Insulators: the Surface Dirac Cone
The Axion Angle and the Topological Magnetoelectric Effect
The Bott Index: the Chern Number of a Disordered Torus
Diabolical Points: Conical Intersections in a Two-Parameter Family
The Entanglement Spectrum: Edge States Without an Edge
The Fu-Kane Parity Criterion: Z2 from Inversion Eigenvalues
The Haldane Model: Berry Curvature and a Topological Phase Transition
The Kane-Mele Z2 Invariant from Wannier-Centre Flow
The Local Chern Marker: Topology Without a Brillouin Zone
Mirror Chern Numbers: a Topological Crystalline Insulator
The Spin Chern Number: Quantum Spin Hall Without Spin Conservation
The Tenfold Way: Symmetry Classes of Tight-Binding Models
TKNN: The Quantized Hall Conductance of the Hofstadter Bands
The Zak Phase: Where the SSH Chain’s Electrons Sit
Transport#
Quantum transport through a finite device attached to semi-infinite leads: Landauer’s formula, in which the conductance is a transmission probability, and the quantized conductance steps of a quantum point contact. Leads attached automatically from their geometry, narrow contacts on a wide cavity, and ragged interfaces (a graphene disc between zigzag leads) completed with the lead’s own sites.
Multi-terminal devices: Landauer-Buttiker conductance matrices and the quantized resistances of a Hall bar with its edge channels; bond currents; shot noise and the Fano factor; and the recursive Green’s function for long wires. The scattering matrix from the exact modes of the leads, the scattering states and the local density of states they carry. Thermoelectric transport: the Mott formula and the Wiedemann-Franz law, and their breakdown at a resonance.
Automatic Lead Attachment: Narrow Contacts on a Wide Cavity
Completing Lead Interfaces: a Graphene Disc between Zigzag Leads
Buttiker’s Edge Channels: the Quantized Resistances of a Hall Bar
The Landauer Formula: Quantized Conductance of a Point Contact
The Recursive Green’s Function: Localization Length of Long Disordered Wires
Mode Matching: the Scattering Matrix, Lead Modes and Scattering States
Shot Noise: the Fano Factor of Ballistic, Tunnel and Diffusive Conductors
Thermoelectric Transport: the Mott Formula and the Wiedemann-Franz Law