Concept Guide — Mean-field & Superconductivity
The Meanfield and Superconductivity modules implement Hartree–Fock and Bogoliubov–de Gennes (BdG) workflows. This guide collects best practices and links relevant examples.
Mean-field toolkit
Meanfield.solveselfconsistent(problem; kwargs...): generic interface for iterative solvers (density, spin, pairing).Meanfield.solvehartreefock(model; kwargs...): Hartree–Fock convenience wrapper returning aHartreeFockobject.Meanfield.initialguess(lat; mode=:random)produces seed density matrices; a deterministic:uniformmode is available for benchmarking.Meanfield.HartreeFockstruct exposes fields such asdensity,energies,iterations, andconverged.
Superconducting extension
Superconductivity.BdGOperatorbuilds Bogoliubov–de Gennes Hamiltonians from normal-state hoppings and pairing matrices.- Pairing helpers (s-wave, d-wave) are available under
Superconductivity—audit docstrings as you standardise them.
Typical workflow
- Model definition — Specify the lattice, base hopping matrices, and interaction parameters (onsite U, nearest-neighbour V, pairing strength).
- Initial guess — Use
initialguessor reuse converged densities from previous runs (hf.density). - Iteration control — Tune
maxiter,tol, and mixing (linear, Anderson). Monitorhf.residuals. - Post-processing — Export densities, order parameters, and energies using
Operators.densitymatrixutilities or custom writers. - Visualisation — Plot layer/sublattice resolved densities; cross-check with scripts under
extra/examples/for consistency.
Debugging convergence
- Inspect the residual history; oscillations often indicate the need for stronger damping or a better initial guess.
- Use
tmp_debug.jlor dedicated sandbox notebooks to isolate problematic parameter sets before committing changes. - Log solver metadata (mixing coefficients, runtime) to aid reproducibility.
Resources
- Examples:
extra/examples/graphene/hubbardmeanfield_*,extra/examples/twistedgraphene_scf. - Tutorials: Tutorial 6 for a hands-on walkthrough.