tbkit 0.3.0__tar.gz → 0.4.0__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.
- {tbkit-0.3.0/tbkit.egg-info → tbkit-0.4.0}/PKG-INFO +80 -3
- {tbkit-0.3.0 → tbkit-0.4.0}/README.md +78 -2
- {tbkit-0.3.0 → tbkit-0.4.0}/pyproject.toml +5 -2
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/__init__.py +10 -2
- tbkit-0.4.0/tbkit/bdg.py +163 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/dos.py +33 -0
- tbkit-0.4.0/tbkit/error_handling.py +2195 -0
- tbkit-0.4.0/tbkit/exceptional.py +875 -0
- tbkit-0.4.0/tbkit/floquet.py +840 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/graphene.py +36 -32
- tbkit-0.4.0/tbkit/kpm.py +439 -0
- tbkit-0.4.0/tbkit/kspace.py +2109 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/lattice.py +137 -62
- tbkit-0.4.0/tbkit/meanfield.py +157 -0
- tbkit-0.4.0/tbkit/occupation.py +97 -0
- tbkit-0.4.0/tbkit/orbital.py +483 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/plot.py +53 -56
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/propagation.py +53 -34
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/save.py +4 -4
- tbkit-0.4.0/tbkit/slater_koster.py +250 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/system.py +397 -58
- tbkit-0.4.0/tbkit/transport.py +225 -0
- {tbkit-0.3.0 → tbkit-0.4.0/tbkit.egg-info}/PKG-INFO +80 -3
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit.egg-info/SOURCES.txt +23 -1
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit.egg-info/requires.txt +1 -0
- tbkit-0.4.0/tests/test_correlations.py +158 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_error_handling.py +178 -3
- tbkit-0.4.0/tests/test_exceptional.py +405 -0
- tbkit-0.4.0/tests/test_floquet.py +433 -0
- tbkit-0.4.0/tests/test_green_occupation.py +159 -0
- tbkit-0.4.0/tests/test_hall.py +360 -0
- tbkit-0.4.0/tests/test_kpm.py +237 -0
- tbkit-0.4.0/tests/test_large_lattices.py +125 -0
- tbkit-0.4.0/tests/test_magnetic.py +73 -0
- tbkit-0.4.0/tests/test_non_hermitian_bands.py +127 -0
- tbkit-0.4.0/tests/test_orbitals.py +360 -0
- tbkit-0.4.0/tests/test_regressions.py +809 -0
- tbkit-0.4.0/tests/test_three_d.py +240 -0
- tbkit-0.4.0/tests/test_topology.py +254 -0
- tbkit-0.4.0/tests/test_transport.py +141 -0
- tbkit-0.3.0/tbkit/error_handling.py +0 -978
- tbkit-0.3.0/tbkit/kspace.py +0 -586
- tbkit-0.3.0/tests/test_regressions.py +0 -355
- {tbkit-0.3.0 → tbkit-0.4.0}/LICENSE +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/setup.cfg +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit/lattices.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit.egg-info/dependency_links.txt +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tbkit.egg-info/top_level.txt +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_dos.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_graphene.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_kspace.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_lattice.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_lattices.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_plot.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_propagation.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_save.py +0 -0
- {tbkit-0.3.0 → tbkit-0.4.0}/tests/test_system.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tbkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
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,21 @@ 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.floquet` | Floquet theory; `FloquetKSpace`/`DrivenKSpace` for driven Bloch models, `step_drive`, and the winding number of anomalous Floquet phases. |
|
|
85
134
|
|
|
86
135
|
## Install
|
|
87
136
|
|
|
@@ -232,6 +281,34 @@ thumbnailed example gallery under `docs/source/api/gallery/`.
|
|
|
232
281
|
| [`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
282
|
| [`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
283
|
| [`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. |
|
|
284
|
+
| [`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. |
|
|
285
|
+
| [`magnetic_field/plot_peierls_substitution.py`](examples/magnetic_field/plot_peierls_substitution.py) | The Peierls substitution: gauge-invariant plaquette fluxes, in two different gauges. |
|
|
286
|
+
| [`topology/plot_zak_phase.py`](examples/topology/plot_zak_phase.py) | The SSH chain's Zak phase and Wannier centres. |
|
|
287
|
+
| [`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. |
|
|
288
|
+
| [`topology/plot_kane_mele_z2.py`](examples/topology/plot_kane_mele_z2.py) | The Kane-Mele Z2 invariant from Wannier-centre flow. |
|
|
289
|
+
| [`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. |
|
|
290
|
+
| [`topology/plot_quantum_geometry.py`](examples/topology/plot_quantum_geometry.py) | The quantum metric and Berry curvature of a Bloch band. |
|
|
291
|
+
| [`topology/plot_tenfold_way.py`](examples/topology/plot_tenfold_way.py) | Symmetry classes of tight-binding models: the tenfold way. |
|
|
292
|
+
| [`topology/plot_local_chern_marker.py`](examples/topology/plot_local_chern_marker.py) | The local Chern marker of a finite, disordered Haldane flake. |
|
|
293
|
+
| [`three_dimensions/plot_anderson_transition.py`](examples/three_dimensions/plot_anderson_transition.py) | The 3D Anderson metal-insulator transition from level statistics. |
|
|
294
|
+
| [`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. |
|
|
295
|
+
| [`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. |
|
|
296
|
+
| [`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. |
|
|
297
|
+
| [`transport/plot_landauer_conductance.py`](examples/transport/plot_landauer_conductance.py) | Landauer conductance, and the quantized steps of a quantum point contact. |
|
|
298
|
+
| [`correlations/plot_hubbard_edge_magnetism.py`](examples/correlations/plot_hubbard_edge_magnetism.py) | Hubbard mean field: magnetism of graphene's zigzag edges. |
|
|
299
|
+
| [`correlations/plot_lieb_theorem.py`](examples/correlations/plot_lieb_theorem.py) | Lieb's theorem: the total spin of bipartite Hubbard lattices. |
|
|
300
|
+
| [`superconductivity/plot_kitaev_chain.py`](examples/superconductivity/plot_kitaev_chain.py) | The Kitaev chain: BdG bands, the topological phase, and Majorana end modes. |
|
|
301
|
+
| [`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. |
|
|
302
|
+
| [`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. |
|
|
303
|
+
| [`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. |
|
|
304
|
+
| [`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. |
|
|
305
|
+
| [`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). |
|
|
306
|
+
| [`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. |
|
|
307
|
+
| [`floquet/plot_floquet_chern_insulator.py`](examples/floquet/plot_floquet_chern_insulator.py) | A Floquet Chern insulator from circularly polarized light on graphene. |
|
|
308
|
+
| [`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. |
|
|
309
|
+
| [`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. |
|
|
310
|
+
| [`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. |
|
|
311
|
+
| [`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. |
|
|
235
312
|
|
|
236
313
|
The `examples/` directory also has five older Jupyter notebooks (graphene
|
|
237
314
|
flakes, kagome/Lieb/dumbbell lattices, disorder, strain, time propagation)
|
|
@@ -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,21 @@ 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.floquet` | Floquet theory; `FloquetKSpace`/`DrivenKSpace` for driven Bloch models, `step_drive`, and the winding number of anomalous Floquet phases. |
|
|
58
106
|
|
|
59
107
|
## Install
|
|
60
108
|
|
|
@@ -205,6 +253,34 @@ thumbnailed example gallery under `docs/source/api/gallery/`.
|
|
|
205
253
|
| [`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
254
|
| [`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
255
|
| [`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. |
|
|
256
|
+
| [`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. |
|
|
257
|
+
| [`magnetic_field/plot_peierls_substitution.py`](examples/magnetic_field/plot_peierls_substitution.py) | The Peierls substitution: gauge-invariant plaquette fluxes, in two different gauges. |
|
|
258
|
+
| [`topology/plot_zak_phase.py`](examples/topology/plot_zak_phase.py) | The SSH chain's Zak phase and Wannier centres. |
|
|
259
|
+
| [`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. |
|
|
260
|
+
| [`topology/plot_kane_mele_z2.py`](examples/topology/plot_kane_mele_z2.py) | The Kane-Mele Z2 invariant from Wannier-centre flow. |
|
|
261
|
+
| [`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. |
|
|
262
|
+
| [`topology/plot_quantum_geometry.py`](examples/topology/plot_quantum_geometry.py) | The quantum metric and Berry curvature of a Bloch band. |
|
|
263
|
+
| [`topology/plot_tenfold_way.py`](examples/topology/plot_tenfold_way.py) | Symmetry classes of tight-binding models: the tenfold way. |
|
|
264
|
+
| [`topology/plot_local_chern_marker.py`](examples/topology/plot_local_chern_marker.py) | The local Chern marker of a finite, disordered Haldane flake. |
|
|
265
|
+
| [`three_dimensions/plot_anderson_transition.py`](examples/three_dimensions/plot_anderson_transition.py) | The 3D Anderson metal-insulator transition from level statistics. |
|
|
266
|
+
| [`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. |
|
|
267
|
+
| [`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. |
|
|
268
|
+
| [`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. |
|
|
269
|
+
| [`transport/plot_landauer_conductance.py`](examples/transport/plot_landauer_conductance.py) | Landauer conductance, and the quantized steps of a quantum point contact. |
|
|
270
|
+
| [`correlations/plot_hubbard_edge_magnetism.py`](examples/correlations/plot_hubbard_edge_magnetism.py) | Hubbard mean field: magnetism of graphene's zigzag edges. |
|
|
271
|
+
| [`correlations/plot_lieb_theorem.py`](examples/correlations/plot_lieb_theorem.py) | Lieb's theorem: the total spin of bipartite Hubbard lattices. |
|
|
272
|
+
| [`superconductivity/plot_kitaev_chain.py`](examples/superconductivity/plot_kitaev_chain.py) | The Kitaev chain: BdG bands, the topological phase, and Majorana end modes. |
|
|
273
|
+
| [`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. |
|
|
274
|
+
| [`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. |
|
|
275
|
+
| [`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. |
|
|
276
|
+
| [`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. |
|
|
277
|
+
| [`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). |
|
|
278
|
+
| [`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. |
|
|
279
|
+
| [`floquet/plot_floquet_chern_insulator.py`](examples/floquet/plot_floquet_chern_insulator.py) | A Floquet Chern insulator from circularly polarized light on graphene. |
|
|
280
|
+
| [`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. |
|
|
281
|
+
| [`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. |
|
|
282
|
+
| [`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. |
|
|
283
|
+
| [`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. |
|
|
208
284
|
|
|
209
285
|
The `examples/` directory also has five older Jupyter notebooks (graphene
|
|
210
286
|
flakes, kagome/Lieb/dumbbell lattices, disorder, strain, time propagation)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tbkit"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
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*"]
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
"""tbkit: build and solve Tight-Binding models."""
|
|
8
8
|
|
|
9
|
-
__version__ = "0.
|
|
9
|
+
__version__ = "0.4.0"
|
|
10
10
|
|
|
11
11
|
__all__ = [
|
|
12
12
|
"Lattice", "System", "Plot", "Propagation", "Save", "KSpace",
|
|
13
|
-
"reciprocal_vectors", "
|
|
13
|
+
"reciprocal_vectors", "OrbitalSystem", "Transport", "FloquetKSpace",
|
|
14
|
+
"DrivenKSpace", "StepDrive", "step_drive",
|
|
15
|
+
"MeanFieldResult", "hubbard_mean_field", "ExceptionalPoints", "Encircling",
|
|
16
|
+
"find_exceptional_points", "error_handling",
|
|
14
17
|
]
|
|
15
18
|
|
|
16
19
|
# NOTE: these are explicit imports, not `from tbkit.<module> import *`.
|
|
@@ -24,4 +27,9 @@ from tbkit.plot import Plot
|
|
|
24
27
|
from tbkit.propagation import Propagation
|
|
25
28
|
from tbkit.save import Save
|
|
26
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
|
|
27
35
|
import tbkit.error_handling
|
tbkit-0.4.0/tbkit/bdg.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
r"""
|
|
2
|
+
Superconductivity in the Bogoliubov-de Gennes (BdG) formalism. With a
|
|
3
|
+
pairing term :math:`\sum_{ij}\Delta_{ij}c^\dagger_ic^\dagger_j + h.c.`,
|
|
4
|
+
the Hamiltonian is :math:`\frac12\Psi^\dagger H_{BdG}\Psi` in the Nambu
|
|
5
|
+
basis :math:`\Psi = (c_1, \dots, c_N, c_1^\dagger, \dots, c_N^\dagger)^T`,
|
|
6
|
+
|
|
7
|
+
.. math::
|
|
8
|
+
|
|
9
|
+
H_{BdG} = \begin{pmatrix} h - \mu & \Delta \\ \Delta^\dagger & -(h-\mu)^T \end{pmatrix}\, ,
|
|
10
|
+
|
|
11
|
+
with :math:`\Delta^T = -\Delta` (Fermi statistics). Its spectrum is
|
|
12
|
+
symmetric, :math:`\pm E_n`, by the particle-hole symmetry
|
|
13
|
+
:math:`\tau_x H_{BdG}^*\tau_x = -H_{BdG}`; the quasiparticle energies are
|
|
14
|
+
the :math:`E_n \ge 0`, and a zero mode is a Majorana mode. Real-space
|
|
15
|
+
models come from *bdg_ham*, periodic ones from *bdg_kspace* (a
|
|
16
|
+
:class:`tbkit.kspace.KSpace` with the holes as extra orbitals, so its bands,
|
|
17
|
+
Berry phases, *finite_ham*, ... all apply).
|
|
18
|
+
"""
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import numpy as np
|
|
22
|
+
from numpy.typing import NDArray
|
|
23
|
+
import scipy.sparse as sparse
|
|
24
|
+
|
|
25
|
+
import tbkit.error_handling as error_handling
|
|
26
|
+
from tbkit.lattice import Lattice
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def bdg_ham(ham, pairing, mu: float = 0.) -> sparse.csr_matrix:
|
|
30
|
+
r'''
|
|
31
|
+
Get the real-space BdG Hamiltonian (see the module docstring).
|
|
32
|
+
|
|
33
|
+
:param ham: Square Hermitian matrix, shape (N, N) (e.g. *System.ham*).
|
|
34
|
+
:param pairing: Square antisymmetric matrix, shape (N, N): :math:`\Delta`
|
|
35
|
+
(see *pairing_bonds*, *pairing_s_wave*).
|
|
36
|
+
:param mu: Real number. Default value 0. Chemical potential.
|
|
37
|
+
|
|
38
|
+
:returns:
|
|
39
|
+
* **ham_bdg** -- Sparse CSR matrix, shape (2N, 2N).
|
|
40
|
+
'''
|
|
41
|
+
h = sparse.csr_matrix(ham, dtype='c16')
|
|
42
|
+
delta = sparse.csr_matrix(pairing, dtype='c16')
|
|
43
|
+
error_handling.square_matrix(h, 'ham')
|
|
44
|
+
error_handling.hermitian(h)
|
|
45
|
+
error_handling.pairing(delta, h.shape[0])
|
|
46
|
+
error_handling.real_number(mu, 'mu')
|
|
47
|
+
h = h - mu * sparse.identity(h.shape[0], dtype='c16', format='csr')
|
|
48
|
+
return sparse.csr_matrix(sparse.bmat([[h, delta], [delta.conj().T, -h.T]]))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def pairing_bonds(sys, delta: complex) -> sparse.csr_matrix:
|
|
52
|
+
r'''
|
|
53
|
+
Get a p-wave (odd) pairing on the bonds of *sys.hop*:
|
|
54
|
+
:math:`\Delta_{ij} = \Delta`, :math:`\Delta_{ji} = -\Delta` for every
|
|
55
|
+
stored hopping :math:`i\to j` (oriented as *System.set_hopping* stores
|
|
56
|
+
them: angle in :math:`[0, 180)`). On a chain it is Kitaev's
|
|
57
|
+
:math:`\Delta\,c^\dagger_jc^\dagger_{j+1}`.
|
|
58
|
+
|
|
59
|
+
:param sys: **System** instance, with hoppings.
|
|
60
|
+
:param delta: Complex number. :math:`\Delta`.
|
|
61
|
+
|
|
62
|
+
:returns:
|
|
63
|
+
* **pairing** -- Sparse CSR matrix, shape (sites, sites).
|
|
64
|
+
'''
|
|
65
|
+
error_handling.empty_hop(sys.hop)
|
|
66
|
+
error_handling.number(delta, 'delta')
|
|
67
|
+
i, j = sys.hop['i'].astype(int), sys.hop['j'].astype(int)
|
|
68
|
+
n = sys.lat.sites
|
|
69
|
+
vals = np.full(len(i), delta, dtype='c16')
|
|
70
|
+
return sparse.csr_matrix((np.concatenate([vals, -vals]), (np.concatenate([i, j]), np.concatenate([j, i]))),
|
|
71
|
+
shape=(n, n))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def pairing_s_wave(n_sites: int, delta: complex) -> sparse.csr_matrix:
|
|
75
|
+
r'''
|
|
76
|
+
Get an onsite singlet (s-wave) pairing
|
|
77
|
+
:math:`\Delta\sum_i c^\dagger_{i\uparrow}c^\dagger_{i\downarrow} + h.c.`
|
|
78
|
+
for a spinful model with rows ordered site by site, spin up then down
|
|
79
|
+
(as *KSpace* with ``spin=True`` and *OrbitalSystem* with one orbital).
|
|
80
|
+
|
|
81
|
+
:param n_sites: Positive integer. Number of sites.
|
|
82
|
+
:param delta: Complex number. :math:`\Delta`.
|
|
83
|
+
|
|
84
|
+
:returns:
|
|
85
|
+
* **pairing** -- Sparse CSR matrix, shape (2 n_sites, 2 n_sites).
|
|
86
|
+
'''
|
|
87
|
+
error_handling.positive_int(n_sites, 'n_sites')
|
|
88
|
+
error_handling.number(delta, 'delta')
|
|
89
|
+
block = np.array([[0., delta], [-delta, 0.]], dtype='c16')
|
|
90
|
+
return sparse.csr_matrix(sparse.kron(sparse.identity(n_sites), block))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def bdg_kspace(ks, pairing: list[dict], mu: float = 0.):
|
|
94
|
+
r'''
|
|
95
|
+
Get the BdG Bloch Hamiltonian of a periodic model,
|
|
96
|
+
|
|
97
|
+
.. math::
|
|
98
|
+
|
|
99
|
+
H_{BdG}(\mathbf{k}) = \begin{pmatrix} h(\mathbf{k})-\mu & \Delta(\mathbf{k}) \\
|
|
100
|
+
\Delta(\mathbf{k})^\dagger & -[h(-\mathbf{k})-\mu]^T\end{pmatrix}\, ,\qquad
|
|
101
|
+
\Delta(\mathbf{k}) = \sum_{\mathbf{R}}\Delta_{ij}(\mathbf{R})\,e^{i\mathbf{k}\cdot\mathbf{R}}\, ,
|
|
102
|
+
|
|
103
|
+
as a new **KSpace** whose orbitals are those of *ks* (particles,
|
|
104
|
+
``0 ... norb-1``) followed by their holes (``norb ... 2 norb-1``, at the
|
|
105
|
+
same positions). Each pairing :math:`\Delta\,c^\dagger_{i,\mathbf{0}}c^\dagger_{j,\mathbf{R}} + h.c.`
|
|
106
|
+
enters antisymmetrized, :math:`\Delta_{ij}(\mathbf{R}) = -\Delta_{ji}(-\mathbf{R})`.
|
|
107
|
+
|
|
108
|
+
:param ks: **KSpace** instance (Hermitian, orthogonal basis).
|
|
109
|
+
:param pairing: List of dictionaries with keys ('i', 'j', 'R', 'delta'):
|
|
110
|
+
orbital indices of *ks* (``0 ... norb-1``; with ``spin=True``,
|
|
111
|
+
``2*site + spin``), lattice vector, amplitude.
|
|
112
|
+
:param mu: Real number. Default value 0. Chemical potential.
|
|
113
|
+
|
|
114
|
+
:returns:
|
|
115
|
+
* **ks_bdg** -- **KSpace** instance, 2 norb orbitals.
|
|
116
|
+
|
|
117
|
+
Example usage::
|
|
118
|
+
|
|
119
|
+
# Kitaev chain: E(k) = +-sqrt((2t cos k - mu)^2 + 4 Delta^2 sin^2 k)
|
|
120
|
+
chain = KSpace(lattices.chain())
|
|
121
|
+
chain.set_hopping([{'i': 0, 'j': 0, 'R': (1,), 't': t}])
|
|
122
|
+
kit = bdg_kspace(chain, [{'i': 0, 'j': 0, 'R': (1,), 'delta': delta}], mu=mu)
|
|
123
|
+
'''
|
|
124
|
+
from tbkit.kspace import KSpace
|
|
125
|
+
error_handling.hermitian_kspace(ks.is_hermitian(), ks._overlap_hop)
|
|
126
|
+
error_handling.pairing_kspace(pairing, ks.norb, ks.dim)
|
|
127
|
+
error_handling.real_number(mu, 'mu')
|
|
128
|
+
norb = ks.norb
|
|
129
|
+
tau = ks.orbital_positions()
|
|
130
|
+
tags = np.repeat(ks.tags, 2) if ks.spin else ks.tags
|
|
131
|
+
cell = [{'tag': str(t), 'r0': tuple(float(c) for c in r)} for t, r in zip(tags, tau)]
|
|
132
|
+
new = KSpace(Lattice(unit_cell=cell + [dict(c) for c in cell], prim_vec=ks.lat.prim_vec))
|
|
133
|
+
h0 = np.diag(ks.onsite) + ks._onsite_offdiag - mu * np.eye(norb)
|
|
134
|
+
new.onsite = np.concatenate([np.diag(h0), -np.diag(h0)]).astype('c16')
|
|
135
|
+
off = h0 - np.diag(np.diag(h0))
|
|
136
|
+
new._onsite_offdiag = np.block([[off, np.zeros((norb, norb))], [np.zeros((norb, norb)), -off.T]]).astype('c16')
|
|
137
|
+
hops = [(i, j, R, t) for i, j, R, t in ks._hop]
|
|
138
|
+
hops += [(j + norb, i + norb, -R, -t) for i, j, R, t in ks._hop]
|
|
139
|
+
for dic in pairing:
|
|
140
|
+
R = np.zeros(ks.space_dim)
|
|
141
|
+
for n, a in zip(dic['R'], ks.lat.prim_vec):
|
|
142
|
+
R += n * np.array(a)
|
|
143
|
+
i, j, d = dic['i'], dic['j'], complex(dic['delta'])
|
|
144
|
+
hops += [(i, j + norb, R, d), (j, i + norb, -R, -d),
|
|
145
|
+
(j + norb, i, -R, np.conj(d)), (i + norb, j, R, -np.conj(d))]
|
|
146
|
+
new._hop = hops
|
|
147
|
+
return new
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def particle_hole(n: int) -> NDArray[np.float64]:
|
|
151
|
+
r'''
|
|
152
|
+
Get the unitary part :math:`\tau_x` of the BdG particle-hole symmetry
|
|
153
|
+
:math:`C = \tau_x\mathcal{K}` (:math:`C^2 = +1`), for *n* particle
|
|
154
|
+
orbitals: pass it to *KSpace.symmetry_error* (``antiunitary=True``,
|
|
155
|
+
``anti=True``) or *KSpace.tenfold_class* (``particle_hole=``).
|
|
156
|
+
|
|
157
|
+
:param n: Positive integer. Number of particle orbitals.
|
|
158
|
+
|
|
159
|
+
:returns:
|
|
160
|
+
* **tau_x** -- Real ndarray, shape (2n, 2n).
|
|
161
|
+
'''
|
|
162
|
+
error_handling.positive_int(n, 'n')
|
|
163
|
+
return np.kron(np.array([[0., 1.], [1., 0.]]), np.eye(n))
|
|
@@ -7,6 +7,8 @@ from __future__ import annotations
|
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
from numpy.typing import ArrayLike, NDArray
|
|
10
|
+
import matplotlib.pyplot as plt
|
|
11
|
+
from matplotlib.figure import Figure
|
|
10
12
|
|
|
11
13
|
import tbkit.error_handling as error_handling
|
|
12
14
|
|
|
@@ -63,3 +65,34 @@ def density_of_states(
|
|
|
63
65
|
else:
|
|
64
66
|
weight = (broadening/np.pi) / (diff**2 + broadening**2)
|
|
65
67
|
return e_grid, weight.sum(axis=1)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _plot_density_of_states(
|
|
71
|
+
energies: ArrayLike,
|
|
72
|
+
e_grid: ArrayLike | None,
|
|
73
|
+
broadening: float,
|
|
74
|
+
kernel: str,
|
|
75
|
+
fs: float,
|
|
76
|
+
lw: float,
|
|
77
|
+
figsize: tuple[float, float] | None,
|
|
78
|
+
) -> Figure:
|
|
79
|
+
'''
|
|
80
|
+
Private function. Plot *density_of_states* (shared by *Plot.dos* and
|
|
81
|
+
*KSpace.plot_dos*, which validate the plotting parameters).
|
|
82
|
+
'''
|
|
83
|
+
e_grid, rho = density_of_states(energies, e_grid=e_grid, broadening=broadening, kernel=kernel)
|
|
84
|
+
fig, ax = plt.subplots(figsize=figsize)
|
|
85
|
+
ax.plot(e_grid, rho, 'b', lw=lw)
|
|
86
|
+
ax.fill_between(e_grid, rho, color='b', alpha=0.2)
|
|
87
|
+
ax.set_xlim([e_grid[0], e_grid[-1]])
|
|
88
|
+
ax.set_ylim([0., None])
|
|
89
|
+
ax.set_title('Density of states', fontsize=fs)
|
|
90
|
+
ax.set_xlabel('$E$', fontsize=fs)
|
|
91
|
+
ax.set_ylabel(r'$\rho(E)$', fontsize=fs)
|
|
92
|
+
for label in ax.xaxis.get_majorticklabels():
|
|
93
|
+
label.set_fontsize(fs)
|
|
94
|
+
for label in ax.yaxis.get_majorticklabels():
|
|
95
|
+
label.set_fontsize(fs)
|
|
96
|
+
fig.set_layout_engine('tight')
|
|
97
|
+
plt.draw()
|
|
98
|
+
return fig
|