tbkit 0.3.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. {tbkit-0.3.0/tbkit.egg-info → tbkit-0.4.1}/PKG-INFO +104 -10
  2. {tbkit-0.3.0 → tbkit-0.4.1}/README.md +102 -9
  3. {tbkit-0.3.0 → tbkit-0.4.1}/pyproject.toml +5 -2
  4. tbkit-0.4.1/tbkit/__init__.py +49 -0
  5. tbkit-0.4.1/tbkit/bdg.py +270 -0
  6. tbkit-0.4.1/tbkit/bridges.py +264 -0
  7. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/dos.py +33 -0
  8. tbkit-0.4.1/tbkit/error_handling.py +2786 -0
  9. tbkit-0.4.1/tbkit/exceptional.py +875 -0
  10. tbkit-0.4.1/tbkit/floquet.py +840 -0
  11. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/graphene.py +36 -32
  12. tbkit-0.4.1/tbkit/higher_order.py +428 -0
  13. tbkit-0.4.1/tbkit/io.py +354 -0
  14. tbkit-0.4.1/tbkit/kpm.py +439 -0
  15. tbkit-0.4.1/tbkit/kspace.py +2132 -0
  16. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/lattice.py +137 -62
  17. tbkit-0.4.1/tbkit/meanfield.py +289 -0
  18. tbkit-0.4.1/tbkit/moire.py +491 -0
  19. tbkit-0.4.1/tbkit/neighbours.py +245 -0
  20. tbkit-0.4.1/tbkit/occupation.py +97 -0
  21. tbkit-0.4.1/tbkit/optics.py +450 -0
  22. tbkit-0.4.1/tbkit/orbital.py +483 -0
  23. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/plot.py +53 -56
  24. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/propagation.py +53 -34
  25. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/save.py +4 -4
  26. tbkit-0.4.1/tbkit/slater_koster.py +250 -0
  27. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/system.py +397 -58
  28. tbkit-0.4.1/tbkit/transport.py +656 -0
  29. {tbkit-0.3.0 → tbkit-0.4.1/tbkit.egg-info}/PKG-INFO +104 -10
  30. tbkit-0.4.1/tbkit.egg-info/SOURCES.txt +68 -0
  31. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit.egg-info/requires.txt +1 -0
  32. tbkit-0.4.1/tests/test_bridges.py +258 -0
  33. tbkit-0.4.1/tests/test_correlations.py +158 -0
  34. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_error_handling.py +289 -3
  35. tbkit-0.4.1/tests/test_error_handling_structures.py +73 -0
  36. tbkit-0.4.1/tests/test_exceptional.py +405 -0
  37. tbkit-0.4.1/tests/test_floquet.py +433 -0
  38. tbkit-0.4.1/tests/test_green_occupation.py +159 -0
  39. tbkit-0.4.1/tests/test_hall.py +360 -0
  40. tbkit-0.4.1/tests/test_higher_order.py +215 -0
  41. tbkit-0.4.1/tests/test_interactions.py +179 -0
  42. tbkit-0.4.1/tests/test_io.py +144 -0
  43. tbkit-0.4.1/tests/test_kpm.py +237 -0
  44. tbkit-0.4.1/tests/test_large_lattices.py +125 -0
  45. tbkit-0.4.1/tests/test_magnetic.py +73 -0
  46. tbkit-0.4.1/tests/test_moire.py +262 -0
  47. tbkit-0.4.1/tests/test_neighbours.py +233 -0
  48. tbkit-0.4.1/tests/test_non_hermitian_bands.py +127 -0
  49. tbkit-0.4.1/tests/test_optics.py +335 -0
  50. tbkit-0.4.1/tests/test_orbitals.py +360 -0
  51. tbkit-0.4.1/tests/test_regressions.py +809 -0
  52. tbkit-0.4.1/tests/test_three_d.py +240 -0
  53. tbkit-0.4.1/tests/test_topology.py +254 -0
  54. tbkit-0.4.1/tests/test_transport.py +141 -0
  55. tbkit-0.4.1/tests/test_transport_response.py +257 -0
  56. tbkit-0.4.1/tests/test_wannier90.py +180 -0
  57. tbkit-0.3.0/tbkit/__init__.py +0 -27
  58. tbkit-0.3.0/tbkit/error_handling.py +0 -978
  59. tbkit-0.3.0/tbkit/kspace.py +0 -586
  60. tbkit-0.3.0/tbkit.egg-info/SOURCES.txt +0 -30
  61. tbkit-0.3.0/tests/test_regressions.py +0 -355
  62. {tbkit-0.3.0 → tbkit-0.4.1}/LICENSE +0 -0
  63. {tbkit-0.3.0 → tbkit-0.4.1}/setup.cfg +0 -0
  64. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit/lattices.py +0 -0
  65. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit.egg-info/dependency_links.txt +0 -0
  66. {tbkit-0.3.0 → tbkit-0.4.1}/tbkit.egg-info/top_level.txt +0 -0
  67. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_dos.py +0 -0
  68. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_graphene.py +0 -0
  69. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_kspace.py +0 -0
  70. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_lattice.py +0 -0
  71. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_lattices.py +0 -0
  72. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_plot.py +0 -0
  73. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_propagation.py +0 -0
  74. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_save.py +0 -0
  75. {tbkit-0.3.0 → tbkit-0.4.1}/tests/test_system.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tbkit
3
- Version: 0.3.0
3
+ Version: 0.4.1
4
4
  Summary: A Python package to build and solve Tight-Binding models.
5
5
  Author-email: Charles Poli <cpoli374@gmail.com>
6
6
  Maintainer-email: cpoli <cpoli374@gmail.com>
@@ -19,6 +19,7 @@ Requires-Dist: matplotlib>=3.7
19
19
  Provides-Extra: test
20
20
  Requires-Dist: pytest>=7; extra == "test"
21
21
  Requires-Dist: pytest-cov>=4; extra == "test"
22
+ Requires-Dist: pytest-xdist>=3.2; extra == "test"
22
23
  Provides-Extra: docs
23
24
  Requires-Dist: sphinx>=7; extra == "docs"
24
25
  Requires-Dist: pydata-sphinx-theme>=0.15; extra == "docs"
@@ -41,6 +42,12 @@ models — lattices, hoppings, Hamiltonians, spectra, band structures —
41
42
  explicit and easy to inspect, so it works as well for teaching as for
42
43
  research prototyping.
43
44
 
45
+ For computational physics beyond tight-binding — quantum mechanics,
46
+ classical mechanics, statistical physics, general relativity, and more —
47
+ see [physicskit](https://github.com/cpoli/physicskit), whose
48
+ `physicskit.condensed` subpackage covers tight-binding band theory and
49
+ topology alongside superconductivity.
50
+
44
51
  ## Features
45
52
 
46
53
  * **Real space**: build arbitrarily complex finite lattices (flakes,
@@ -51,7 +58,40 @@ research prototyping.
51
58
  periodic lattice from a small set of intra-unit-cell hoppings, and compute
52
59
  band structures along a k-path through high-symmetry points.
53
60
  * **Topology**: Berry curvature and Chern numbers of a group of bands, by
54
- the gauge-invariant Fukui-Hatsugai-Suzuki lattice method.
61
+ the gauge-invariant Fukui-Hatsugai-Suzuki lattice method; Zak/Berry
62
+ phases, Wannier centres and their flow, the Z2 invariant (Wilson loops
63
+ and Fu-Kane parities), the quantum geometric tensor, symmetry checks and
64
+ the tenfold way, magnetic supercells (TKNN), and the real-space local
65
+ Chern marker.
66
+ * **Hall conductivities**: the intrinsic anomalous Hall conductivity at
67
+ any Fermi level (Kubo formula over the Brillouin zone, in 2D and 3D,
68
+ with adaptive mesh refinement), the spin Hall conductivity, and the
69
+ real-space Kubo-Bastin Hall conductivity of large disordered samples by
70
+ the kernel polynomial method.
71
+ * **3D**: lattices, slabs, and Bloch Hamiltonians in three dimensions
72
+ (Anderson transition, Weyl semimetals).
73
+ * **Orbitals**: several orbitals per site with Slater-Koster bond
74
+ integrals (s, p, d), non-orthogonal bases, and spinful multi-orbital
75
+ real-space models (`OrbitalSystem`: atomic/Kane-Mele spin-orbit,
76
+ Rashba, Zeeman, Peierls phases).
77
+ * **Large lattices**: sparse neighbour search, shift-invert sparse
78
+ eigensolvers, and the kernel polynomial method (DOS, LDOS, Kubo-Greenwood
79
+ conductivity).
80
+ * **Green's functions and transport**: retarded Green's functions, LDOS,
81
+ Fermi levels and occupations, and Landauer transmission through a device
82
+ between semi-infinite leads.
83
+ * **Interactions and superconductivity**: the Hubbard model in mean field,
84
+ and Bogoliubov-de Gennes Hamiltonians in real and reciprocal space.
85
+ * **Non-Hermitian bands**: non-reciprocal hoppings, spectral winding, the
86
+ skin effect, and the generalized Brillouin zone.
87
+ * **Exceptional points** of 2D bands: eigenvalue vorticity, discriminant
88
+ winding, an EP finder (charges, Jordan-block orders, exceptional rings,
89
+ bulk Fermi arcs, the doubling theorem), encircling exceptional versus
90
+ diabolical points, and biorthogonal Chern numbers of line-gapped bands.
91
+ * **Floquet**: quasienergies, Floquet and Sambe Hamiltonians, driven
92
+ Bloch models (`FloquetKSpace`, `DrivenKSpace`), exact step drives of
93
+ Bloch models, ribbons and flakes (`step_drive`), and anomalous Floquet
94
+ phases: the Rudner winding number and edge-state counts.
55
95
  * **Spin**: optional spin-1/2 degree of freedom on every site, with 2x2
56
96
  (Pauli-matrix) hoppings/onsite terms, for spin-orbit coupling (Rashba,
57
97
  Kane-Mele) and Zeeman splitting.
@@ -76,12 +116,26 @@ research prototyping.
76
116
  |----------------------------|---------------------------------------------------------|
77
117
  | `tbkit.Lattice` | Define and manipulate site positions and sublattices. |
78
118
  | `tbkit.System` | Build the real-space Hamiltonian from a `Lattice` and solve it. |
79
- | `tbkit.KSpace` | Build and solve the Bloch Hamiltonian of a periodic `Lattice`; bands, Berry curvature/Chern numbers, ribbons, DOS. |
119
+ | `tbkit.KSpace` | Build and solve the Bloch Hamiltonian of a periodic `Lattice`; bands, Berry curvature/Chern numbers, anomalous and spin Hall conductivities, ribbons, DOS. |
80
120
  | `tbkit.Plot` | Plot lattices, spectra, eigenstates, and the density of states. |
81
121
  | `tbkit.Propagation` | Time-evolve a wavepacket. |
82
122
  | `tbkit.Save` | Save figures/animations to disk. |
83
123
  | `tbkit.lattices` | Ready-made common lattices. |
84
124
  | `tbkit.dos` | Broadened density of states from a set of eigenenergies. |
125
+ | `tbkit.OrbitalSystem` | Real-space models with several orbitals and spin per site (`tbkit.orbital`). |
126
+ | `tbkit.Transport` | Landauer transmission through a device between leads (`tbkit.transport`). |
127
+ | `tbkit.occupation` | Fermi-Dirac occupations and Fermi levels. |
128
+ | `tbkit.kpm` | Kernel polynomial method: DOS, LDOS, longitudinal and Hall conductivities of very large lattices. |
129
+ | `tbkit.slater_koster` | Slater-Koster bond integrals and multi-orbital `KSpace` models. |
130
+ | `tbkit.meanfield` | The Hubbard model in (unrestricted Hartree-Fock) mean field. |
131
+ | `tbkit.bdg` | Bogoliubov-de Gennes Hamiltonians and pairings. |
132
+ | `tbkit.exceptional` | Exceptional and diabolical points of 2D bands: vorticity, discriminant winding, EP finder, Fermi arcs, encircling. |
133
+ | `tbkit.higher_order` | Higher-order topology: nested Wilson loops, Wannier-sector polarizations, the BBH quadrupole moment, corner charges. |
134
+ | `tbkit.moire` | Supercells, band unfolding and spectral functions, commensurate twisted bilayers. |
135
+ | `tbkit.floquet` | Floquet theory; `FloquetKSpace`/`DrivenKSpace` for driven Bloch models, `step_drive`, and the winding number of anomalous Floquet phases. |
136
+ | `tbkit.neighbours` | Neighbour shells of a periodic lattice; `KSpace.set_hopping` by neighbour order, angle and sublattice pair, as in `System`. |
137
+ | `tbkit.bridges` | Move a model between `System` and `KSpace` (open samples and tori). |
138
+ | `tbkit.io` | Save and load `Lattice`/`System`/`KSpace` models (`.npz`); import Wannier90 `_hr.dat` models. |
85
139
 
86
140
  ## Install
87
141
 
@@ -232,10 +286,52 @@ thumbnailed example gallery under `docs/source/api/gallery/`.
232
286
  | [`topology/plot_thouless_pump.py`](examples/topology/plot_thouless_pump.py) | The Rice-Mele model as a Thouless quantum pump: quantized Chern number and polarization winding. |
233
287
  | [`strain/plot_pseudo_magnetic_field.py`](examples/strain/plot_pseudo_magnetic_field.py) | Triaxial strain as a gauge field: pseudo-Landau levels in graphene from a purely real Hamiltonian. |
234
288
  | [`non_hermitian/plot_pt_symmetry.py`](examples/non_hermitian/plot_pt_symmetry.py) | PT symmetry, exceptional points, the Petermann factor, and a selectively amplified topological edge mode. |
235
-
236
- The `examples/` directory also has five older Jupyter notebooks (graphene
237
- flakes, kagome/Lieb/dumbbell lattices, disorder, strain, time propagation)
238
- predating the 0.2 API refresh below.
289
+ | [`tight_binding/plot_isolation_of_graphene.py`](examples/tight_binding/plot_isolation_of_graphene.py) | The physics behind the isolation of graphene: flakes, zigzag edge states, and the Dirac cones' Berry phase of pi. |
290
+ | [`magnetic_field/plot_peierls_substitution.py`](examples/magnetic_field/plot_peierls_substitution.py) | The Peierls substitution: gauge-invariant plaquette fluxes, in two different gauges. |
291
+ | [`topology/plot_zak_phase.py`](examples/topology/plot_zak_phase.py) | The SSH chain's Zak phase and Wannier centres. |
292
+ | [`topology/plot_tknn_hofstadter.py`](examples/topology/plot_tknn_hofstadter.py) | TKNN: Chern numbers of the Hofstadter bands from magnetic supercells, and the Diophantine equation. |
293
+ | [`topology/plot_kane_mele_z2.py`](examples/topology/plot_kane_mele_z2.py) | The Kane-Mele Z2 invariant from Wannier-centre flow. |
294
+ | [`topology/plot_fu_kane_parity.py`](examples/topology/plot_fu_kane_parity.py) | The Fu-Kane parity criterion on the BHZ model, checked against the Wannier flow. |
295
+ | [`topology/plot_quantum_geometry.py`](examples/topology/plot_quantum_geometry.py) | The quantum metric and Berry curvature of a Bloch band. |
296
+ | [`topology/plot_tenfold_way.py`](examples/topology/plot_tenfold_way.py) | Symmetry classes of tight-binding models: the tenfold way. |
297
+ | [`topology/plot_local_chern_marker.py`](examples/topology/plot_local_chern_marker.py) | The local Chern marker of a finite, disordered Haldane flake. |
298
+ | [`three_dimensions/plot_anderson_transition.py`](examples/three_dimensions/plot_anderson_transition.py) | The 3D Anderson metal-insulator transition from level statistics. |
299
+ | [`three_dimensions/plot_weyl_semimetal.py`](examples/three_dimensions/plot_weyl_semimetal.py) | A Weyl semimetal: Chern number jumps across Weyl points, and Fermi arcs on a slab. |
300
+ | [`orbitals/plot_slater_koster.py`](examples/orbitals/plot_slater_koster.py) | Slater-Koster sp3 graphene: the decoupled pi bands, a non-orthogonal basis, and the same model in real space. |
301
+ | [`large_scale/plot_kernel_polynomial_method.py`](examples/large_scale/plot_kernel_polynomial_method.py) | The kernel polynomial method on a very large (disordered) graphene flake. |
302
+ | [`transport/plot_landauer_conductance.py`](examples/transport/plot_landauer_conductance.py) | Landauer conductance, and the quantized steps of a quantum point contact. |
303
+ | [`correlations/plot_hubbard_edge_magnetism.py`](examples/correlations/plot_hubbard_edge_magnetism.py) | Hubbard mean field: magnetism of graphene's zigzag edges. |
304
+ | [`correlations/plot_lieb_theorem.py`](examples/correlations/plot_lieb_theorem.py) | Lieb's theorem: the total spin of bipartite Hubbard lattices. |
305
+ | [`superconductivity/plot_kitaev_chain.py`](examples/superconductivity/plot_kitaev_chain.py) | The Kitaev chain: BdG bands, the topological phase, and Majorana end modes. |
306
+ | [`non_hermitian/plot_skin_effect.py`](examples/non_hermitian/plot_skin_effect.py) | The non-Hermitian skin effect, the spectral winding, and the generalized Brillouin zone. |
307
+ | [`topology/plot_diabolical_points.py`](examples/topology/plot_diabolical_points.py) | Diabolical points: an accidental conical intersection in a two-parameter family, avoided crossings, and the eigenvector's sign change. |
308
+ | [`non_hermitian/plot_exceptional_points_fermi_arcs.py`](examples/non_hermitian/plot_exceptional_points_fermi_arcs.py) | Exceptional points in momentum space: Re E and Im E, EP charges, and the bulk Fermi arc. |
309
+ | [`non_hermitian/plot_exceptional_point_vorticity.py`](examples/non_hermitian/plot_exceptional_point_vorticity.py) | A Dirac point splits into an EP pair (vorticity conserved), or becomes an exceptional ring. |
310
+ | [`non_hermitian/plot_exceptional_point_encircling.py`](examples/non_hermitian/plot_exceptional_point_encircling.py) | Encircling an EP (state swap, four-loop return) versus a Dirac point (Berry phase pi). |
311
+ | [`non_hermitian/plot_exceptional_points_chern_number.py`](examples/non_hermitian/plot_exceptional_points_chern_number.py) | Biorthogonal Chern numbers (LR = RL = RR = LL) until the line gap closes at exceptional points. |
312
+ | [`floquet/plot_floquet_chern_insulator.py`](examples/floquet/plot_floquet_chern_insulator.py) | A Floquet Chern insulator from circularly polarized light on graphene. |
313
+ | [`floquet/plot_anomalous_floquet_phases.py`](examples/floquet/plot_anomalous_floquet_phases.py) | Anomalous Floquet phases: edge states with zero Chern numbers, the winding number, and the five-step model. |
314
+ | [`hall_effects/plot_anomalous_hall_effect.py`](examples/hall_effects/plot_anomalous_hall_effect.py) | The anomalous Hall effect: sigma_xy(E_F) of the Haldane model, quantized at C in the gap, not in the bands. |
315
+ | [`hall_effects/plot_anomalous_hall_disorder.py`](examples/hall_effects/plot_anomalous_hall_disorder.py) | The anomalous Hall plateau of a disordered Haldane torus, by the Kubo-Bastin kernel polynomial method. |
316
+ | [`hall_effects/plot_intrinsic_spin_hall_effect.py`](examples/hall_effects/plot_intrinsic_spin_hall_effect.py) | The intrinsic spin Hall effect: the Kane-Mele plateau at e/2pi, and its departure from quantization under Rashba coupling. |
317
+ | [`models/plot_neighbour_hoppings.py`](examples/models/plot_neighbour_hoppings.py) | Hoppings by neighbour order in k-space: third-nearest-neighbour graphene with overlaps. |
318
+ | [`models/plot_pipeline_bridges.py`](examples/models/plot_pipeline_bridges.py) | From real space to k-space and back: the Haldane model's torus spectrum equals its mesh bands. |
319
+ | [`models/plot_save_load.py`](examples/models/plot_save_load.py) | Saving and reloading models: identical Hamiltonians after a round trip through disk. |
320
+ | [`models/plot_maximally_localized_wannier_functions.py`](examples/models/plot_maximally_localized_wannier_functions.py) | Maximally localized Wannier functions: graphene's pi bands from a Wannier90 `_hr.dat` file. |
321
+ | [`higher_order/plot_quadrupole_insulator.py`](examples/higher_order/plot_quadrupole_insulator.py) | The BBH quadrupole insulator: nested Wilson loop, q_xy = 1/2, four corner states and corner charges +-1/2. |
322
+ | [`moire/plot_band_unfolding.py`](examples/moire/plot_band_unfolding.py) | Band unfolding: exact for a pristine supercell, coherence factors, and A(k, omega) of a disordered graphene supercell. |
323
+ | [`moire/plot_magic_angle_twisted_bilayer.py`](examples/moire/plot_magic_angle_twisted_bilayer.py) | Twisted bilayer graphene: Bistritzer-MacDonald velocity and flat bands at the magic alpha. |
324
+ | [`superconductivity/plot_bcs_gap_equation.py`](examples/superconductivity/plot_bcs_gap_equation.py) | The real-space BCS gap equation: Delta(T), Delta(0)/T_c = 1.764, and the proximity effect. |
325
+ | [`correlations/plot_noncollinear_120_degree_order.py`](examples/correlations/plot_noncollinear_120_degree_order.py) | Non-collinear mean field: the 120-degree order of the half-filled triangular Hubbard model. |
326
+ | [`tight_binding/plot_building_finite_lattices.py`](examples/tight_binding/plot_building_finite_lattices.py) | Building finite lattices: cuts, dangling sites, lattice arithmetic, rotations. |
327
+ | [`tight_binding/plot_defects_and_impurities.py`](examples/tight_binding/plot_defects_and_impurities.py) | A vacancy zero mode and an impurity bound state in a graphene flake. |
328
+ | [`dynamics/plot_wavepacket_interference.py`](examples/dynamics/plot_wavepacket_interference.py) | Wave propagation: Aharonov-Bohm caging on a ring and a state trapped at a domain wall. |
329
+
330
+ The five pre-0.2 Jupyter notebooks were replaced by the gallery scripts
331
+ `tight_binding/plot_building_finite_lattices.py`,
332
+ `tight_binding/plot_defects_and_impurities.py` and
333
+ `dynamics/plot_wavepacket_interference.py` (their other content is covered
334
+ by the strain, correlations and non-Hermitian examples).
239
335
 
240
336
  ## Documentation
241
337
 
@@ -266,9 +362,7 @@ cleaned up the API:
266
362
 
267
363
  For continuity, the pre-0.2 lowercase class names (`lattice`, `system`,
268
364
  `plot`, `propagation`, `save`) remain available as aliases of the new
269
- classes, so `from tbkit.lattice import lattice` still works. Example
270
- notebooks predating 0.2 still use byte-string tags (`b'a'`) and will need
271
- that one mechanical change to run on the current version.
365
+ classes, so `from tbkit.lattice import lattice` still works.
272
366
 
273
367
  ## License
274
368
 
@@ -14,6 +14,12 @@ models — lattices, hoppings, Hamiltonians, spectra, band structures —
14
14
  explicit and easy to inspect, so it works as well for teaching as for
15
15
  research prototyping.
16
16
 
17
+ For computational physics beyond tight-binding — quantum mechanics,
18
+ classical mechanics, statistical physics, general relativity, and more —
19
+ see [physicskit](https://github.com/cpoli/physicskit), whose
20
+ `physicskit.condensed` subpackage covers tight-binding band theory and
21
+ topology alongside superconductivity.
22
+
17
23
  ## Features
18
24
 
19
25
  * **Real space**: build arbitrarily complex finite lattices (flakes,
@@ -24,7 +30,40 @@ research prototyping.
24
30
  periodic lattice from a small set of intra-unit-cell hoppings, and compute
25
31
  band structures along a k-path through high-symmetry points.
26
32
  * **Topology**: Berry curvature and Chern numbers of a group of bands, by
27
- the gauge-invariant Fukui-Hatsugai-Suzuki lattice method.
33
+ the gauge-invariant Fukui-Hatsugai-Suzuki lattice method; Zak/Berry
34
+ phases, Wannier centres and their flow, the Z2 invariant (Wilson loops
35
+ and Fu-Kane parities), the quantum geometric tensor, symmetry checks and
36
+ the tenfold way, magnetic supercells (TKNN), and the real-space local
37
+ Chern marker.
38
+ * **Hall conductivities**: the intrinsic anomalous Hall conductivity at
39
+ any Fermi level (Kubo formula over the Brillouin zone, in 2D and 3D,
40
+ with adaptive mesh refinement), the spin Hall conductivity, and the
41
+ real-space Kubo-Bastin Hall conductivity of large disordered samples by
42
+ the kernel polynomial method.
43
+ * **3D**: lattices, slabs, and Bloch Hamiltonians in three dimensions
44
+ (Anderson transition, Weyl semimetals).
45
+ * **Orbitals**: several orbitals per site with Slater-Koster bond
46
+ integrals (s, p, d), non-orthogonal bases, and spinful multi-orbital
47
+ real-space models (`OrbitalSystem`: atomic/Kane-Mele spin-orbit,
48
+ Rashba, Zeeman, Peierls phases).
49
+ * **Large lattices**: sparse neighbour search, shift-invert sparse
50
+ eigensolvers, and the kernel polynomial method (DOS, LDOS, Kubo-Greenwood
51
+ conductivity).
52
+ * **Green's functions and transport**: retarded Green's functions, LDOS,
53
+ Fermi levels and occupations, and Landauer transmission through a device
54
+ between semi-infinite leads.
55
+ * **Interactions and superconductivity**: the Hubbard model in mean field,
56
+ and Bogoliubov-de Gennes Hamiltonians in real and reciprocal space.
57
+ * **Non-Hermitian bands**: non-reciprocal hoppings, spectral winding, the
58
+ skin effect, and the generalized Brillouin zone.
59
+ * **Exceptional points** of 2D bands: eigenvalue vorticity, discriminant
60
+ winding, an EP finder (charges, Jordan-block orders, exceptional rings,
61
+ bulk Fermi arcs, the doubling theorem), encircling exceptional versus
62
+ diabolical points, and biorthogonal Chern numbers of line-gapped bands.
63
+ * **Floquet**: quasienergies, Floquet and Sambe Hamiltonians, driven
64
+ Bloch models (`FloquetKSpace`, `DrivenKSpace`), exact step drives of
65
+ Bloch models, ribbons and flakes (`step_drive`), and anomalous Floquet
66
+ phases: the Rudner winding number and edge-state counts.
28
67
  * **Spin**: optional spin-1/2 degree of freedom on every site, with 2x2
29
68
  (Pauli-matrix) hoppings/onsite terms, for spin-orbit coupling (Rashba,
30
69
  Kane-Mele) and Zeeman splitting.
@@ -49,12 +88,26 @@ research prototyping.
49
88
  |----------------------------|---------------------------------------------------------|
50
89
  | `tbkit.Lattice` | Define and manipulate site positions and sublattices. |
51
90
  | `tbkit.System` | Build the real-space Hamiltonian from a `Lattice` and solve it. |
52
- | `tbkit.KSpace` | Build and solve the Bloch Hamiltonian of a periodic `Lattice`; bands, Berry curvature/Chern numbers, ribbons, DOS. |
91
+ | `tbkit.KSpace` | Build and solve the Bloch Hamiltonian of a periodic `Lattice`; bands, Berry curvature/Chern numbers, anomalous and spin Hall conductivities, ribbons, DOS. |
53
92
  | `tbkit.Plot` | Plot lattices, spectra, eigenstates, and the density of states. |
54
93
  | `tbkit.Propagation` | Time-evolve a wavepacket. |
55
94
  | `tbkit.Save` | Save figures/animations to disk. |
56
95
  | `tbkit.lattices` | Ready-made common lattices. |
57
96
  | `tbkit.dos` | Broadened density of states from a set of eigenenergies. |
97
+ | `tbkit.OrbitalSystem` | Real-space models with several orbitals and spin per site (`tbkit.orbital`). |
98
+ | `tbkit.Transport` | Landauer transmission through a device between leads (`tbkit.transport`). |
99
+ | `tbkit.occupation` | Fermi-Dirac occupations and Fermi levels. |
100
+ | `tbkit.kpm` | Kernel polynomial method: DOS, LDOS, longitudinal and Hall conductivities of very large lattices. |
101
+ | `tbkit.slater_koster` | Slater-Koster bond integrals and multi-orbital `KSpace` models. |
102
+ | `tbkit.meanfield` | The Hubbard model in (unrestricted Hartree-Fock) mean field. |
103
+ | `tbkit.bdg` | Bogoliubov-de Gennes Hamiltonians and pairings. |
104
+ | `tbkit.exceptional` | Exceptional and diabolical points of 2D bands: vorticity, discriminant winding, EP finder, Fermi arcs, encircling. |
105
+ | `tbkit.higher_order` | Higher-order topology: nested Wilson loops, Wannier-sector polarizations, the BBH quadrupole moment, corner charges. |
106
+ | `tbkit.moire` | Supercells, band unfolding and spectral functions, commensurate twisted bilayers. |
107
+ | `tbkit.floquet` | Floquet theory; `FloquetKSpace`/`DrivenKSpace` for driven Bloch models, `step_drive`, and the winding number of anomalous Floquet phases. |
108
+ | `tbkit.neighbours` | Neighbour shells of a periodic lattice; `KSpace.set_hopping` by neighbour order, angle and sublattice pair, as in `System`. |
109
+ | `tbkit.bridges` | Move a model between `System` and `KSpace` (open samples and tori). |
110
+ | `tbkit.io` | Save and load `Lattice`/`System`/`KSpace` models (`.npz`); import Wannier90 `_hr.dat` models. |
58
111
 
59
112
  ## Install
60
113
 
@@ -205,10 +258,52 @@ thumbnailed example gallery under `docs/source/api/gallery/`.
205
258
  | [`topology/plot_thouless_pump.py`](examples/topology/plot_thouless_pump.py) | The Rice-Mele model as a Thouless quantum pump: quantized Chern number and polarization winding. |
206
259
  | [`strain/plot_pseudo_magnetic_field.py`](examples/strain/plot_pseudo_magnetic_field.py) | Triaxial strain as a gauge field: pseudo-Landau levels in graphene from a purely real Hamiltonian. |
207
260
  | [`non_hermitian/plot_pt_symmetry.py`](examples/non_hermitian/plot_pt_symmetry.py) | PT symmetry, exceptional points, the Petermann factor, and a selectively amplified topological edge mode. |
208
-
209
- The `examples/` directory also has five older Jupyter notebooks (graphene
210
- flakes, kagome/Lieb/dumbbell lattices, disorder, strain, time propagation)
211
- predating the 0.2 API refresh below.
261
+ | [`tight_binding/plot_isolation_of_graphene.py`](examples/tight_binding/plot_isolation_of_graphene.py) | The physics behind the isolation of graphene: flakes, zigzag edge states, and the Dirac cones' Berry phase of pi. |
262
+ | [`magnetic_field/plot_peierls_substitution.py`](examples/magnetic_field/plot_peierls_substitution.py) | The Peierls substitution: gauge-invariant plaquette fluxes, in two different gauges. |
263
+ | [`topology/plot_zak_phase.py`](examples/topology/plot_zak_phase.py) | The SSH chain's Zak phase and Wannier centres. |
264
+ | [`topology/plot_tknn_hofstadter.py`](examples/topology/plot_tknn_hofstadter.py) | TKNN: Chern numbers of the Hofstadter bands from magnetic supercells, and the Diophantine equation. |
265
+ | [`topology/plot_kane_mele_z2.py`](examples/topology/plot_kane_mele_z2.py) | The Kane-Mele Z2 invariant from Wannier-centre flow. |
266
+ | [`topology/plot_fu_kane_parity.py`](examples/topology/plot_fu_kane_parity.py) | The Fu-Kane parity criterion on the BHZ model, checked against the Wannier flow. |
267
+ | [`topology/plot_quantum_geometry.py`](examples/topology/plot_quantum_geometry.py) | The quantum metric and Berry curvature of a Bloch band. |
268
+ | [`topology/plot_tenfold_way.py`](examples/topology/plot_tenfold_way.py) | Symmetry classes of tight-binding models: the tenfold way. |
269
+ | [`topology/plot_local_chern_marker.py`](examples/topology/plot_local_chern_marker.py) | The local Chern marker of a finite, disordered Haldane flake. |
270
+ | [`three_dimensions/plot_anderson_transition.py`](examples/three_dimensions/plot_anderson_transition.py) | The 3D Anderson metal-insulator transition from level statistics. |
271
+ | [`three_dimensions/plot_weyl_semimetal.py`](examples/three_dimensions/plot_weyl_semimetal.py) | A Weyl semimetal: Chern number jumps across Weyl points, and Fermi arcs on a slab. |
272
+ | [`orbitals/plot_slater_koster.py`](examples/orbitals/plot_slater_koster.py) | Slater-Koster sp3 graphene: the decoupled pi bands, a non-orthogonal basis, and the same model in real space. |
273
+ | [`large_scale/plot_kernel_polynomial_method.py`](examples/large_scale/plot_kernel_polynomial_method.py) | The kernel polynomial method on a very large (disordered) graphene flake. |
274
+ | [`transport/plot_landauer_conductance.py`](examples/transport/plot_landauer_conductance.py) | Landauer conductance, and the quantized steps of a quantum point contact. |
275
+ | [`correlations/plot_hubbard_edge_magnetism.py`](examples/correlations/plot_hubbard_edge_magnetism.py) | Hubbard mean field: magnetism of graphene's zigzag edges. |
276
+ | [`correlations/plot_lieb_theorem.py`](examples/correlations/plot_lieb_theorem.py) | Lieb's theorem: the total spin of bipartite Hubbard lattices. |
277
+ | [`superconductivity/plot_kitaev_chain.py`](examples/superconductivity/plot_kitaev_chain.py) | The Kitaev chain: BdG bands, the topological phase, and Majorana end modes. |
278
+ | [`non_hermitian/plot_skin_effect.py`](examples/non_hermitian/plot_skin_effect.py) | The non-Hermitian skin effect, the spectral winding, and the generalized Brillouin zone. |
279
+ | [`topology/plot_diabolical_points.py`](examples/topology/plot_diabolical_points.py) | Diabolical points: an accidental conical intersection in a two-parameter family, avoided crossings, and the eigenvector's sign change. |
280
+ | [`non_hermitian/plot_exceptional_points_fermi_arcs.py`](examples/non_hermitian/plot_exceptional_points_fermi_arcs.py) | Exceptional points in momentum space: Re E and Im E, EP charges, and the bulk Fermi arc. |
281
+ | [`non_hermitian/plot_exceptional_point_vorticity.py`](examples/non_hermitian/plot_exceptional_point_vorticity.py) | A Dirac point splits into an EP pair (vorticity conserved), or becomes an exceptional ring. |
282
+ | [`non_hermitian/plot_exceptional_point_encircling.py`](examples/non_hermitian/plot_exceptional_point_encircling.py) | Encircling an EP (state swap, four-loop return) versus a Dirac point (Berry phase pi). |
283
+ | [`non_hermitian/plot_exceptional_points_chern_number.py`](examples/non_hermitian/plot_exceptional_points_chern_number.py) | Biorthogonal Chern numbers (LR = RL = RR = LL) until the line gap closes at exceptional points. |
284
+ | [`floquet/plot_floquet_chern_insulator.py`](examples/floquet/plot_floquet_chern_insulator.py) | A Floquet Chern insulator from circularly polarized light on graphene. |
285
+ | [`floquet/plot_anomalous_floquet_phases.py`](examples/floquet/plot_anomalous_floquet_phases.py) | Anomalous Floquet phases: edge states with zero Chern numbers, the winding number, and the five-step model. |
286
+ | [`hall_effects/plot_anomalous_hall_effect.py`](examples/hall_effects/plot_anomalous_hall_effect.py) | The anomalous Hall effect: sigma_xy(E_F) of the Haldane model, quantized at C in the gap, not in the bands. |
287
+ | [`hall_effects/plot_anomalous_hall_disorder.py`](examples/hall_effects/plot_anomalous_hall_disorder.py) | The anomalous Hall plateau of a disordered Haldane torus, by the Kubo-Bastin kernel polynomial method. |
288
+ | [`hall_effects/plot_intrinsic_spin_hall_effect.py`](examples/hall_effects/plot_intrinsic_spin_hall_effect.py) | The intrinsic spin Hall effect: the Kane-Mele plateau at e/2pi, and its departure from quantization under Rashba coupling. |
289
+ | [`models/plot_neighbour_hoppings.py`](examples/models/plot_neighbour_hoppings.py) | Hoppings by neighbour order in k-space: third-nearest-neighbour graphene with overlaps. |
290
+ | [`models/plot_pipeline_bridges.py`](examples/models/plot_pipeline_bridges.py) | From real space to k-space and back: the Haldane model's torus spectrum equals its mesh bands. |
291
+ | [`models/plot_save_load.py`](examples/models/plot_save_load.py) | Saving and reloading models: identical Hamiltonians after a round trip through disk. |
292
+ | [`models/plot_maximally_localized_wannier_functions.py`](examples/models/plot_maximally_localized_wannier_functions.py) | Maximally localized Wannier functions: graphene's pi bands from a Wannier90 `_hr.dat` file. |
293
+ | [`higher_order/plot_quadrupole_insulator.py`](examples/higher_order/plot_quadrupole_insulator.py) | The BBH quadrupole insulator: nested Wilson loop, q_xy = 1/2, four corner states and corner charges +-1/2. |
294
+ | [`moire/plot_band_unfolding.py`](examples/moire/plot_band_unfolding.py) | Band unfolding: exact for a pristine supercell, coherence factors, and A(k, omega) of a disordered graphene supercell. |
295
+ | [`moire/plot_magic_angle_twisted_bilayer.py`](examples/moire/plot_magic_angle_twisted_bilayer.py) | Twisted bilayer graphene: Bistritzer-MacDonald velocity and flat bands at the magic alpha. |
296
+ | [`superconductivity/plot_bcs_gap_equation.py`](examples/superconductivity/plot_bcs_gap_equation.py) | The real-space BCS gap equation: Delta(T), Delta(0)/T_c = 1.764, and the proximity effect. |
297
+ | [`correlations/plot_noncollinear_120_degree_order.py`](examples/correlations/plot_noncollinear_120_degree_order.py) | Non-collinear mean field: the 120-degree order of the half-filled triangular Hubbard model. |
298
+ | [`tight_binding/plot_building_finite_lattices.py`](examples/tight_binding/plot_building_finite_lattices.py) | Building finite lattices: cuts, dangling sites, lattice arithmetic, rotations. |
299
+ | [`tight_binding/plot_defects_and_impurities.py`](examples/tight_binding/plot_defects_and_impurities.py) | A vacancy zero mode and an impurity bound state in a graphene flake. |
300
+ | [`dynamics/plot_wavepacket_interference.py`](examples/dynamics/plot_wavepacket_interference.py) | Wave propagation: Aharonov-Bohm caging on a ring and a state trapped at a domain wall. |
301
+
302
+ The five pre-0.2 Jupyter notebooks were replaced by the gallery scripts
303
+ `tight_binding/plot_building_finite_lattices.py`,
304
+ `tight_binding/plot_defects_and_impurities.py` and
305
+ `dynamics/plot_wavepacket_interference.py` (their other content is covered
306
+ by the strain, correlations and non-Hermitian examples).
212
307
 
213
308
  ## Documentation
214
309
 
@@ -239,9 +334,7 @@ cleaned up the API:
239
334
 
240
335
  For continuity, the pre-0.2 lowercase class names (`lattice`, `system`,
241
336
  `plot`, `propagation`, `save`) remain available as aliases of the new
242
- classes, so `from tbkit.lattice import lattice` still works. Example
243
- notebooks predating 0.2 still use byte-string tags (`b'a'`) and will need
244
- that one mechanical change to run on the current version.
337
+ classes, so `from tbkit.lattice import lattice` still works.
245
338
 
246
339
  ## License
247
340
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tbkit"
7
- version = "0.3.0"
7
+ version = "0.4.1"
8
8
  description = "A Python package to build and solve Tight-Binding models."
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"
@@ -27,7 +27,7 @@ classifiers = [
27
27
  Homepage = "https://github.com/cpoli/tbkit"
28
28
 
29
29
  [project.optional-dependencies]
30
- test = ["pytest>=7", "pytest-cov>=4"]
30
+ test = ["pytest>=7", "pytest-cov>=4", "pytest-xdist>=3.2"]
31
31
  docs = ["sphinx>=7", "pydata-sphinx-theme>=0.15", "sphinx-gallery>=0.15"]
32
32
 
33
33
  [tool.pytest.ini_options]
@@ -36,6 +36,9 @@ docs = ["sphinx>=7", "pydata-sphinx-theme>=0.15", "sphinx-gallery>=0.15"]
36
36
  # usually the test misusing an API. Add a targeted `ignore::` entry below if a
37
37
  # dependency ever emits something genuinely out of our control.
38
38
  filterwarnings = ["error"]
39
+ # Run in parallel; worksteal rebalances the few slow Floquet/Hall/KPM tests.
40
+ # Pass -n0 to run a single test without the worker startup cost.
41
+ addopts = "-n auto --dist worksteal"
39
42
 
40
43
  [tool.setuptools.packages.find]
41
44
  include = ["tbkit*"]
@@ -0,0 +1,49 @@
1
+ # Copyright 2014 Charles Poli.
2
+ #
3
+ # This file is part of TBKIT. It is subject to the license terms in the
4
+ # LICENSE file found in the top-level directory of this distribution and at
5
+ # https://github.com/cpoli/tbkit.
6
+
7
+ """tbkit: build and solve Tight-Binding models."""
8
+
9
+ __version__ = "0.4.1"
10
+
11
+ __all__ = [
12
+ "Lattice", "System", "Plot", "Propagation", "Save", "KSpace",
13
+ "reciprocal_vectors", "OrbitalSystem", "Transport", "FloquetKSpace",
14
+ "DrivenKSpace", "StepDrive", "step_drive",
15
+ "MeanFieldResult", "hubbard_mean_field", "ExceptionalPoints", "Encircling",
16
+ "find_exceptional_points", "error_handling",
17
+ ]
18
+
19
+ # NOTE: these are explicit imports, not `from tbkit.<module> import *`.
20
+ # A wildcard import here would rebind the `tbkit.<module>` submodule
21
+ # attributes to the classes they define (since e.g. tbkit/lattice.py both
22
+ # *is* the submodule `tbkit.lattice` and defines a `lattice` alias of the
23
+ # same name), breaking `import tbkit.lattice as lattice`-style imports.
24
+ from tbkit.lattice import Lattice
25
+ from tbkit.system import System
26
+ from tbkit.plot import Plot
27
+ from tbkit.propagation import Propagation
28
+ from tbkit.save import Save
29
+ from tbkit.kspace import KSpace, reciprocal_vectors
30
+ from tbkit.orbital import OrbitalSystem
31
+ from tbkit.transport import Transport
32
+ from tbkit.floquet import FloquetKSpace, DrivenKSpace, StepDrive, step_drive
33
+ from tbkit.meanfield import MeanFieldResult, hubbard_mean_field
34
+ from tbkit.exceptional import ExceptionalPoints, Encircling, find_exceptional_points
35
+ import tbkit.error_handling
36
+ # Model I/O (tbkit.io): appended here to keep the list above untouched.
37
+ from tbkit.io import save_model, load_model, read_wannier90
38
+ __all__ += ["save_model", "load_model", "read_wannier90"]
39
+
40
+ # Higher-order topology, moire supercells, self-consistent interactions
41
+ from tbkit.higher_order import CornerCharges, quadrupole_moment, corner_charges
42
+ __all__ += ["CornerCharges", "quadrupole_moment", "corner_charges"]
43
+ from tbkit.moire import SupercellKSpace, MoireKSpace, supercell, twisted_bilayer
44
+ __all__ += ["SupercellKSpace", "MoireKSpace", "supercell", "twisted_bilayer"]
45
+ from tbkit.meanfield import NonCollinearResult, hubbard_mean_field_noncollinear
46
+ from tbkit.bdg import GapResult, s_wave_gap
47
+ __all__ += ["NonCollinearResult", "hubbard_mean_field_noncollinear", "GapResult", "s_wave_gap"]
48
+ from tbkit.transport import RecursiveTransport
49
+ __all__ += ["RecursiveTransport"]