A Julia package for constructing symmetry-constrained tight-binding Hamiltonians in any crystallographic space group (1D, 2D, 3D). Built on the framework of topological quantum chemistry (TQC) and the theory of band representations.
Given a set of elementary band representations (EBRs) from Crystalline.jl and a list of hopping ranges, the package:
- Enumerates symmetry-related hopping orbits
- Constructs the M-matrix encoding all allowed Hamiltonian terms
- Enforces spatial symmetry, time-reversal, and hermiticity constraints via nullspace + Zassenhaus intersection
- Returns a
TightBindingModelwhose free parameters can be tuned to produce concrete Hamiltonians
Repository: https://github.com/CrystallineOrg/SymmetricTightBinding.jl
Depends on: Crystalline.jl (local copy at ../Crystalline)
Authors: Antonio Morales Perez, Thomas Christensen
tb_hamiltonian(cbr, Rs; antihermitian)— top-level entry point; returnsTightBindingModelobtain_symmetry_related_hoppings(Rs, br_a, br_b)— enumerates hopping orbitssgrep_induced_by_siteir(br, op)— site-symmetry induced space group representation
HoppingOrbit{D}— orbit of symmetry-related hopping vectors {delta_i}TightBindingBlock{D}— single block of the Hamiltonian (br1 -> br2 hopping)TightBindingTerm{D}— block embedded in full matrix, with hermiticity infoTightBindingModel{D}— collection of terms; functortbm(cs)-> parameterized modelParameterizedTightBindingModel{D}— model with coefficients; functorptbm(k)-> H(k)
spectrum(ptbm, ks)— band eigenvalues over k-path (src/spectrum.jl)symmetry_eigenvalues(ptbm, ops, k, sgreps)— irrep content at high-symmetry k (src/symmetry_analysis.jl)collect_compatible(ptbm)/collect_irrep_annotations(ptbm)— band symmetry labelsberrycurvature(ptbm, k, n)/chern(ptbm, n, Nk)/chern_fukui(ptbm, n, Nk)(src/berry.jl)gradient_wrt_hopping/gradient_wrt_momentum(src/gradients.jl)subduced_complement(tbm, sgnum_H)— new terms from symmetry breaking (src/symmetry_breaking.jl)
pin_free!(brs, idx2abc)— fix free Wyckoff parameters (src/utils.jl)solve(ptbm, k; bloch_phase)— eigenvalues + eigenvectors (insrc/types.jl)fit(tbm, E_ref, ks)— least-squares fitting via Optim.jl extension
SymmetricTightBindingMakieExt— Makie recipes for hopping orbits and band structuresSymmetricTightBindingOptimExt— model fitting via Optim.jl (multi-start LBFGS)
The package uses Convention 1 (PythTB-style) throughout: the Bloch basis includes
position phases, i.e., exp(ik*(t + q_alpha)). This differs from much of the literature
(Convention 2, lattice-phase only). See docs/src/theory.md Appendix A and
docs/src/devdocs/fourier.md. The solve(...; bloch_phase=Val(true)) option converts eigenvectors
to Convention 2.
src/
SymmetricTightBinding.jl # module definition, exports, constants
types.jl # core data structures + evaluation functors
tightbinding.jl # constraint pipeline: M-matrix, nullspace, sparsification
site_representations.jl # coset-decomposition-based induced representations
symmetry_analysis.jl # irrep content at high-symmetry k-points
spectrum.jl # band eigenvalue computation
berry.jl # Berry curvature, Chern numbers (Kubo + Fukui)
gradients.jl # dH/dc_i and dH/dk_i
hermiticity.jl # hermiticity/anti-hermiticity constraint intersection
timereversal.jl # TRS constraint: H(k) = H*(-k)
zassenhaus.jl # Zassenhaus algorithm for subspace intersection
symmetry_breaking.jl # subduced complement for translationengleiche subgroups
utils.jl # orbital positions, pin_free!, split_complex, etc.
show.jl # pretty-printing for all types
ext/
SymmetricTightBindingMakieExt.jl # Makie visualization recipes
SymmetricTightBindingOptimExt.jl # Optim.jl fitting
test/
runtests.jl # test runner
pg_tb_hamiltonian.jl # plane group tests (graphene, p4mm, p3, p2)
sg_tb_hamiltonian.jl # space group tests (SG 2, 16, 47, 225; 1D SG 2)
site_representations.jl # representation matrix tests
symmetry-breaking.jl # subduced complement tests
symmetry_analysis.jl # comprehensive symmetry tests (commented out; see PR #89)
symmetry_analysis_stopgap.jl # interim symmetry vector tests (see PR #89)
berry.jl # Berry curvature + Chern number tests
spectrum.jl # band eigenvalue tests
show.jl # regression tests for show/summary methods
gradients.jl # hopping/momentum gradient tests
docs/src/
tutorial.md # graphene walkthrough
theory.md # mathematical framework (polished)
band-symmetry.md # symmetry analysis example
symmetry-breaking.md # symmetry reduction example
berry.md # Haldane model, Chern numbers
devdocs/
README.md # index of developer docs
trs_notes.md # co-representation theory, TRS quantization, realification
fourier.md # Convention 1 vs 2 quick reference
1d_example.md # worked 1D bipartite lattice example
cd /path/to/SymmetricTightBinding
julia --project -e 'using Pkg; Pkg.test()'Or interactively:
using Pkg; Pkg.activate(".")
include("test/runtests.jl")Tests take ~2 minutes.
-
Symmetry analysis failures (PR #89 / treat as issue):
collect_compatiblereturns incorrect irrep labels for many space groups, especially at K/KA/H/HA points with 3-fold symmetry. Root cause: unresolved phase convention ambiguity in the Theta_G factor withinsymmetry_eigenvalues. Conjugating the phase fixes some cases but breaks others. Related to Crystalline.jl issue #12 (sign incalc_bandreps). -
ANTIHERMITIAN
solvenot implemented (src/types.jl:455). -
Performance (issue #44):
tb_hamiltonianis slow for high space group numbers (SG ~200+ can take minutes per EBR). -
Test coverage gaps: No tests for extensions (Optim, Makie). Interim symmetry analysis tests exist (
symmetry_analysis_stopgap.jl) but comprehensive tests await PR #89.
See PLAN.md for the phased work plan (TODO audit, devdocs restructuring, tests,
refactoring, symmetry analysis fix).
- Follow existing docstring style (see e.g.
HoppingOrbit,TightBindingBlockintypes.jl) - Use Unicode math where it improves readability (e.g.,
δ,ρ,Θ) - Numeric tolerances are defined as module-level constants (
NULLSPACE_ATOL_DEFAULT, etc.) - The codebase uses Convention 1 Fourier transform everywhere; be careful with phases
- Prefer using Crystalline.jl's API over reimplementing group-theoretic operations
- Don't add new functionality without tests
- Always run tests after making changes
- Keep comments brief but include enough detail for non-obvious physics/math
- Work in separate branches for each groupable change (for PR review with collaborators)
ptbm(k)returns mutable scratch:ParameterizedTightBindingModelreuses an internal buffer. When comparing evaluations at different k-points,copy()the result.@compositemacro hygiene: The@compositemacro evaluates in Crystalline's module scope, so loop variables are not visible. UseCompositeBandRep(coefs, brs)constructor in programmatic contexts (loops, comprehensions).TightBindingElementStringis not exported: import explicitly if needed in tests viausing SymmetricTightBinding: TightBindingElementString.