tbkit 0.6.0__tar.gz → 0.6.2__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.6.0/tbkit.egg-info → tbkit-0.6.2}/PKG-INFO +8 -5
- {tbkit-0.6.0 → tbkit-0.6.2}/README.md +3 -3
- {tbkit-0.6.0 → tbkit-0.6.2}/pyproject.toml +2 -2
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/__init__.py +1 -1
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/bdg.py +86 -41
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/bridges.py +50 -24
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/continuum.py +31 -15
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/dos.py +30 -12
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/error_handling.py +1274 -393
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/exceptional.py +142 -65
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/floquet.py +177 -83
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/graphene.py +58 -21
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/higher_order.py +90 -48
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/io.py +82 -40
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/kpm.py +119 -64
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/kspace.py +935 -442
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/lattice.py +101 -43
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/lattices.py +30 -6
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/meanfield.py +80 -40
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/moire.py +120 -59
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/neighbours.py +44 -21
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/occupation.py +20 -11
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/optics.py +96 -53
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/orbital.py +84 -32
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/plot.py +229 -116
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/propagation.py +91 -39
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/save.py +32 -14
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/slater_koster.py +28 -16
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/system.py +235 -92
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/topology.py +49 -23
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/transport.py +396 -221
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/values.py +13 -6
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/wannier.py +78 -33
- {tbkit-0.6.0 → tbkit-0.6.2/tbkit.egg-info}/PKG-INFO +8 -5
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/requires.txt +4 -1
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_kspace.py +51 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/LICENSE +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/setup.cfg +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/py.typed +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/SOURCES.txt +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/dependency_links.txt +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/top_level.txt +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_analysis.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_berry_response.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_bridges.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_continuum.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_correlations.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_dos.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_error_handling.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_error_handling_structures.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_exceptional.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_floquet.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_graphene.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_green_occupation.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_hall.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_higher_order.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_interactions.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_invariants.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_io.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_kpm.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_large_lattices.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_lattice.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_lattices.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_magnetic.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_moire.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_neighbours.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_non_hermitian_bands.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_optics.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_orbitals.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_periodic.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_plot.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_propagation.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_regressions.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_save.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_smatrix.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_surface_spectral.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_system.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_three_d.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_topology.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_transport.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_transport_response.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_values.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_wannier90.py +0 -0
- {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_wannier_functions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tbkit
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
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: Charles Poli <cpoli374@gmail.com>
|
|
@@ -36,19 +36,22 @@ Requires-Dist: sympy>=1.12; extra == "test"
|
|
|
36
36
|
Provides-Extra: docs
|
|
37
37
|
Requires-Dist: sphinx>=7; extra == "docs"
|
|
38
38
|
Requires-Dist: pydata-sphinx-theme>=0.15; extra == "docs"
|
|
39
|
-
Requires-Dist: sphinx-gallery>=0.
|
|
39
|
+
Requires-Dist: sphinx-gallery>=0.17; extra == "docs"
|
|
40
|
+
Requires-Dist: joblib>=1.3; extra == "docs"
|
|
40
41
|
Requires-Dist: sympy>=1.12; extra == "docs"
|
|
42
|
+
Requires-Dist: sphinx-sitemap>=2.6; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinxext-opengraph>=0.9; extra == "docs"
|
|
41
44
|
Dynamic: license-file
|
|
42
45
|
|
|
43
46
|
# tbkit — a Tight-Binding package
|
|
44
47
|
|
|
45
48
|
| | |
|
|
46
49
|
|:--|:-:|
|
|
47
|
-
| Package | [](https://pypi.org/project/tbkit/) [](https://anaconda.org/conda-forge/tbkit) [](https://pypi.org/project/tbkit/) [](https://pypi.org/project/tbkit/) [](https://anaconda.org/conda-forge/tbkit) [](https://pypi.org/project/tbkit/) [](https://doi.org/10.5281/zenodo.23386289) |
|
|
51
|
+
| Quality | [](https://github.com/cpoli/tbkit/blob/master/LICENSE) [](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [](https://codecov.io/gh/cpoli/tbkit) |
|
|
49
52
|
| Documentation | [](https://cpoli.github.io/tbkit/) |
|
|
50
53
|
| Downloads | [](https://pepy.tech/project/tbkit) [](https://pepy.tech/project/tbkit) |
|
|
51
|
-
| Community | [](https://github.com/cpoli/tbkit) [](https://github.com/cpoli/tbkit) [](https://github.com/cpoli/tbkit/graphs/contributors) [](https://github.com/cpoli/tbkit/commits/master) |
|
|
52
55
|
|
|
53
56
|

|
|
54
57
|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
| | |
|
|
4
4
|
|:--|:-:|
|
|
5
|
-
| Package | [](https://pypi.org/project/tbkit/) [](https://anaconda.org/conda-forge/tbkit) [](https://pypi.org/project/tbkit/) [](https://pypi.org/project/tbkit/) [](https://anaconda.org/conda-forge/tbkit) [](https://pypi.org/project/tbkit/) [](https://doi.org/10.5281/zenodo.23386289) |
|
|
6
|
+
| Quality | [](https://github.com/cpoli/tbkit/blob/master/LICENSE) [](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [](https://codecov.io/gh/cpoli/tbkit) |
|
|
7
7
|
| Documentation | [](https://cpoli.github.io/tbkit/) |
|
|
8
8
|
| Downloads | [](https://pepy.tech/project/tbkit) [](https://pepy.tech/project/tbkit) |
|
|
9
|
-
| Community | [](https://github.com/cpoli/tbkit) [](https://github.com/cpoli/tbkit) [](https://github.com/cpoli/tbkit/graphs/contributors) [](https://github.com/cpoli/tbkit/commits/master) |
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tbkit"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.2"
|
|
8
8
|
description = "A Python package to build and solve Tight-Binding models."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "BSD-3-Clause"
|
|
@@ -39,7 +39,7 @@ Documentation = "https://cpoli.github.io/tbkit/"
|
|
|
39
39
|
[project.optional-dependencies]
|
|
40
40
|
continuum = ["sympy>=1.12"]
|
|
41
41
|
test = ["pytest>=7", "pytest-cov>=4", "pytest-xdist>=3.2", "sympy>=1.12"]
|
|
42
|
-
docs = ["sphinx>=7", "pydata-sphinx-theme>=0.15", "sphinx-gallery>=0.
|
|
42
|
+
docs = ["sphinx>=7", "pydata-sphinx-theme>=0.15", "sphinx-gallery>=0.17", "joblib>=1.3", "sympy>=1.12", "sphinx-sitemap>=2.6", "sphinxext-opengraph>=0.9"]
|
|
43
43
|
|
|
44
44
|
[tool.pytest.ini_options]
|
|
45
45
|
# The suite is warning-free; keep it that way. A warning from tbkit itself is
|
|
@@ -30,13 +30,18 @@ def bdg_ham(ham, pairing, mu: float = 0.) -> sparse.csr_matrix:
|
|
|
30
30
|
r'''
|
|
31
31
|
Get the real-space BdG Hamiltonian (see the module docstring).
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
ham : Square Hermitian matrix, shape (N, N) (e.g. *System.ham*)
|
|
36
|
+
pairing
|
|
37
|
+
Square antisymmetric matrix, shape (N, N): :math:`\Delta`
|
|
35
38
|
(see *pairing_bonds*, *pairing_s_wave*).
|
|
36
|
-
|
|
39
|
+
mu : Real number, default 0
|
|
40
|
+
Chemical potential.
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
ham_bdg : Sparse CSR matrix, shape (2N, 2N)
|
|
40
45
|
'''
|
|
41
46
|
h = sparse.csr_matrix(ham, dtype='c16')
|
|
42
47
|
delta = sparse.csr_matrix(pairing, dtype='c16')
|
|
@@ -56,11 +61,15 @@ def pairing_bonds(sys, delta: complex) -> sparse.csr_matrix:
|
|
|
56
61
|
them: angle in :math:`[0, 180)`). On a chain it is Kitaev's
|
|
57
62
|
:math:`\Delta\,c^\dagger_jc^\dagger_{j+1}`.
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
sys : **System** instance, with hoppings
|
|
67
|
+
delta : Complex number
|
|
68
|
+
:math:`\Delta`.
|
|
61
69
|
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
pairing : Sparse CSR matrix, shape (sites, sites)
|
|
64
73
|
'''
|
|
65
74
|
error_handling.empty_hop(sys.hop)
|
|
66
75
|
error_handling.number(delta, 'delta')
|
|
@@ -78,11 +87,16 @@ def pairing_s_wave(n_sites: int, delta: complex) -> sparse.csr_matrix:
|
|
|
78
87
|
for a spinful model with rows ordered site by site, spin up then down
|
|
79
88
|
(as *KSpace* with ``spin=True`` and *OrbitalSystem* with one orbital).
|
|
80
89
|
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
n_sites : Positive integer
|
|
93
|
+
Number of sites.
|
|
94
|
+
delta : Complex number
|
|
95
|
+
:math:`\Delta`.
|
|
83
96
|
|
|
84
|
-
|
|
85
|
-
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
pairing : Sparse CSR matrix, shape (2 n_sites, 2 n_sites)
|
|
86
100
|
'''
|
|
87
101
|
error_handling.positive_int(n_sites, 'n_sites')
|
|
88
102
|
error_handling.number(delta, 'delta')
|
|
@@ -105,15 +119,22 @@ def bdg_kspace(ks, pairing: list[dict], mu: float = 0.):
|
|
|
105
119
|
same positions). Each pairing :math:`\Delta\,c^\dagger_{i,\mathbf{0}}c^\dagger_{j,\mathbf{R}} + h.c.`
|
|
106
120
|
enters antisymmetrized, :math:`\Delta_{ij}(\mathbf{R}) = -\Delta_{ji}(-\mathbf{R})`.
|
|
107
121
|
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
Parameters
|
|
123
|
+
----------
|
|
124
|
+
ks : **KSpace** instance (Hermitian, orthogonal basis)
|
|
125
|
+
pairing
|
|
126
|
+
List of dictionaries with keys ('i', 'j', 'R', 'delta'):
|
|
110
127
|
orbital indices of *ks* (``0 ... norb-1``; with ``spin=True``,
|
|
111
128
|
``2*site + spin``), lattice vector, amplitude.
|
|
112
|
-
|
|
129
|
+
mu : Real number, default 0
|
|
130
|
+
Chemical potential.
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
Returns
|
|
133
|
+
-------
|
|
134
|
+
ks_bdg : **KSpace** instance, 2 norb orbitals
|
|
116
135
|
|
|
136
|
+
Examples
|
|
137
|
+
--------
|
|
117
138
|
Example usage::
|
|
118
139
|
|
|
119
140
|
# Kitaev chain: E(k) = +-sqrt((2t cos k - mu)^2 + 4 Delta^2 sin^2 k)
|
|
@@ -154,10 +175,14 @@ def particle_hole(n: int) -> NDArray[np.float64]:
|
|
|
154
175
|
orbitals: pass it to *KSpace.symmetry_error* (``antiunitary=True``,
|
|
155
176
|
``anti=True``) or *KSpace.tenfold_class* (``particle_hole=``).
|
|
156
177
|
|
|
157
|
-
|
|
178
|
+
Parameters
|
|
179
|
+
----------
|
|
180
|
+
n : Positive integer
|
|
181
|
+
Number of particle orbitals.
|
|
158
182
|
|
|
159
|
-
|
|
160
|
-
|
|
183
|
+
Returns
|
|
184
|
+
-------
|
|
185
|
+
tau_x : Real ndarray, shape (2n, 2n)
|
|
161
186
|
'''
|
|
162
187
|
error_handling.positive_int(n, 'n')
|
|
163
188
|
return np.kron(np.array([[0., 1.], [1., 0.]]), np.eye(n))
|
|
@@ -171,10 +196,13 @@ def pfaffian(a) -> complex:
|
|
|
171
196
|
(2012)). For a 2x2 block :math:`\begin{pmatrix}0 & a\\ -a & 0\end{pmatrix}`
|
|
172
197
|
it is :math:`a`; it is 0 for an odd dimension.
|
|
173
198
|
|
|
174
|
-
|
|
199
|
+
Parameters
|
|
200
|
+
----------
|
|
201
|
+
a : Square antisymmetric matrix, shape (n, n)
|
|
175
202
|
|
|
176
|
-
|
|
177
|
-
|
|
203
|
+
Returns
|
|
204
|
+
-------
|
|
205
|
+
pf : Complex number (a float for a real matrix)
|
|
178
206
|
'''
|
|
179
207
|
real = not np.iscomplexobj(a)
|
|
180
208
|
a = np.array(a, dtype='c16')
|
|
@@ -224,11 +252,15 @@ def majorana_number(ks) -> int:
|
|
|
224
252
|
B 82, 184525 (2010)). The invariant changes only where the gap closes
|
|
225
253
|
at one of the :math:`\Gamma_i`.
|
|
226
254
|
|
|
227
|
-
|
|
255
|
+
Parameters
|
|
256
|
+
----------
|
|
257
|
+
ks
|
|
258
|
+
**KSpace** instance of a BdG model, 2n orbitals: n particles
|
|
228
259
|
then their n holes (see *bdg_kspace*).
|
|
229
260
|
|
|
230
|
-
|
|
231
|
-
|
|
261
|
+
Returns
|
|
262
|
+
-------
|
|
263
|
+
m : Integer, -1 (topological) or +1 (trivial)
|
|
232
264
|
'''
|
|
233
265
|
from tbkit.kspace import KSpace
|
|
234
266
|
error_handling.kspace(ks, KSpace)
|
|
@@ -249,12 +281,18 @@ class GapResult():
|
|
|
249
281
|
r'''
|
|
250
282
|
Self-consistent s-wave pairing of *s_wave_gap*.
|
|
251
283
|
|
|
252
|
-
|
|
253
|
-
|
|
284
|
+
Attributes
|
|
285
|
+
----------
|
|
286
|
+
delta : Complex ndarray
|
|
287
|
+
Gap :math:`\Delta_i` on every site.
|
|
288
|
+
energies : Real ndarray, shape (2N,)
|
|
289
|
+
Spectrum of the reduced BdG
|
|
254
290
|
Hamiltonian (symmetric, :math:`\pm E_n`).
|
|
255
|
-
|
|
291
|
+
states : Complex ndarray, shape (2N, 2N)
|
|
292
|
+
Its eigenvectors
|
|
256
293
|
:math:`(u_n, v_n)` (columns).
|
|
257
|
-
|
|
294
|
+
iterations : Integer
|
|
295
|
+
Number of iterations.
|
|
258
296
|
'''
|
|
259
297
|
|
|
260
298
|
def __init__(self, delta, energies, states, iterations) -> None:
|
|
@@ -305,19 +343,26 @@ def s_wave_gap(
|
|
|
305
343
|
:math:`T_c` the iteration slows down (the linearized map has an
|
|
306
344
|
eigenvalue close to 1): raise *max_iter* there.
|
|
307
345
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
346
|
+
Parameters
|
|
347
|
+
----------
|
|
348
|
+
ham : Square Hermitian matrix, (N, N), spin independent (e.g. *System.ham*)
|
|
349
|
+
V : Positive real, or array of N non-negative reals
|
|
350
|
+
Attraction.
|
|
351
|
+
mu : Real number, default 0
|
|
352
|
+
Chemical potential.
|
|
353
|
+
temperature : Positive real or zero, default 0
|
|
354
|
+
delta0 : Number, or array of N numbers, default 0.1
|
|
313
355
|
Initial gap.
|
|
314
|
-
|
|
315
|
-
|
|
356
|
+
mixing : Real in (0, 1]
|
|
357
|
+
Default value 1 (plain iteration).
|
|
358
|
+
tol : Positive real, default 1e-8
|
|
359
|
+
Convergence threshold
|
|
316
360
|
on the largest change of :math:`\Delta_i`.
|
|
317
|
-
|
|
361
|
+
max_iter : Positive integer, default 10000
|
|
318
362
|
|
|
319
|
-
|
|
320
|
-
|
|
363
|
+
Returns
|
|
364
|
+
-------
|
|
365
|
+
result : :class:`GapResult`
|
|
321
366
|
'''
|
|
322
367
|
h = ham.toarray() if hasattr(ham, 'toarray') else np.asarray(ham)
|
|
323
368
|
error_handling.square_matrix(h, 'ham')
|
|
@@ -45,12 +45,18 @@ def cell_orbitals(lat: Lattice) -> tuple[NDArray[np.int64], NDArray[np.int64]]:
|
|
|
45
45
|
:math:`\boldsymbol\tau_{o_s} + \sum_k n_{s,k}\mathbf{a}_k`, with the tag
|
|
46
46
|
of orbital :math:`o_s` (within ``ATOL``).
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Parameters
|
|
49
|
+
----------
|
|
50
|
+
lat
|
|
51
|
+
**Lattice** instance, after *get_lattice* (sites may have
|
|
49
52
|
been removed, but not moved).
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
Returns
|
|
55
|
+
-------
|
|
56
|
+
cells : Integer ndarray, shape (sites, dim)
|
|
57
|
+
:math:`n_{s,k}`.
|
|
58
|
+
orbitals : Integer ndarray, shape (sites,)
|
|
59
|
+
:math:`o_s`.
|
|
54
60
|
'''
|
|
55
61
|
error_handling.lat(lat)
|
|
56
62
|
error_handling.empty_coor(lat.coor)
|
|
@@ -90,19 +96,27 @@ def kspace_from_system(sys: System, periodic: bool | None = None, tol: float = 1
|
|
|
90
96
|
element is kept, with ``hermitian=False``. Onsite energies are taken
|
|
91
97
|
orbital by orbital.
|
|
92
98
|
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
Parameters
|
|
100
|
+
----------
|
|
101
|
+
sys : **System** instance with its hoppings set (one orbital per site)
|
|
102
|
+
periodic : Boolean
|
|
103
|
+
Default value None: True if *sys* has
|
|
95
104
|
periodic boundaries along some primitive vector (``System(lat,
|
|
96
105
|
periodic=...)``, or *finite_system* with ``periodic=True``). The
|
|
97
106
|
System is a torus of the *lat.n1* x *lat.n2* (x *lat.n3*) cells of
|
|
98
107
|
*get_lattice*.
|
|
99
|
-
|
|
108
|
+
tol : Positive real number, default 1e-9
|
|
109
|
+
Largest allowed
|
|
100
110
|
difference between equivalent matrix elements.
|
|
101
111
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
ks
|
|
115
|
+
**KSpace** instance (spinless), on a new **Lattice**
|
|
116
|
+
with the *unit_cell* and *prim_vec* of *sys.lat*.
|
|
105
117
|
|
|
118
|
+
Examples
|
|
119
|
+
--------
|
|
106
120
|
Example usage::
|
|
107
121
|
|
|
108
122
|
lat = lattices.honeycomb()
|
|
@@ -170,17 +184,23 @@ def finite_model(
|
|
|
170
184
|
and tag of every row. Spinful models are supported (the two spin
|
|
171
185
|
components of a site share its position).
|
|
172
186
|
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
Parameters
|
|
188
|
+
----------
|
|
189
|
+
ks : **KSpace** instance
|
|
190
|
+
n_cells : Positive integer, or tuple of *dim* positive integers
|
|
175
191
|
Number of unit cells along each primitive vector.
|
|
176
|
-
|
|
192
|
+
periodic : Boolean, default False
|
|
193
|
+
Periodic boundaries (a torus).
|
|
177
194
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
195
|
+
Returns
|
|
196
|
+
-------
|
|
197
|
+
ham : Complex CSR matrix, shape (N*norb, N*norb)
|
|
198
|
+
positions : Real ndarray, shape (N*norb, space_dim)
|
|
199
|
+
Row
|
|
200
|
+
:math:`c\,\mathrm{norb}+o` sits at :math:`\boldsymbol\tau_o + \sum_k n_k\mathbf{a}_k`
|
|
201
|
+
(cell *c* has :math:`c = n_1 + N_1 n_2 + N_1N_2 n_3`).
|
|
202
|
+
tags : String ndarray, shape (N*norb,)
|
|
203
|
+
Sublattice tags.
|
|
184
204
|
'''
|
|
185
205
|
error_handling.kspace(ks, KSpace)
|
|
186
206
|
error_handling.nk(n_cells, ks.dim)
|
|
@@ -210,13 +230,19 @@ def finite_system(ks: KSpace, n_cells: int | tuple[int, ...], periodic: bool = F
|
|
|
210
230
|
(``sys.periodic``), so that further *set_hopping* calls, *Plot* and
|
|
211
231
|
*get_bott_index* treat it as a torus.
|
|
212
232
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
233
|
+
Parameters
|
|
234
|
+
----------
|
|
235
|
+
ks : **KSpace** instance, with ``spin=False``
|
|
236
|
+
n_cells : Positive integer, or tuple of *dim* positive integers
|
|
237
|
+
periodic : Boolean, default False
|
|
238
|
+
Periodic boundaries (a torus).
|
|
216
239
|
|
|
217
|
-
|
|
218
|
-
|
|
240
|
+
Returns
|
|
241
|
+
-------
|
|
242
|
+
sys : **System** instance, with its hoppings set
|
|
219
243
|
|
|
244
|
+
Examples
|
|
245
|
+
--------
|
|
220
246
|
Example usage::
|
|
221
247
|
|
|
222
248
|
sys = finite_system(gra, (30, 30), periodic=True)
|
|
@@ -149,21 +149,29 @@ def discretize_symbolic(hamiltonian, dim: int | None = None) -> dict:
|
|
|
149
149
|
the grid spacing *a* and the parameters of the Hamiltonian (see the
|
|
150
150
|
module docstring for the scheme).
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
Parameters
|
|
153
|
+
----------
|
|
154
|
+
hamiltonian
|
|
155
|
+
sympy expression or Matrix, or a string, in the
|
|
153
156
|
momenta ``k_x``, ``k_y``, ``k_z``: a polynomial in them with
|
|
154
157
|
constant coefficients. Any other symbol is a parameter, taken real
|
|
155
158
|
(the symbols ``x``, ``y``, ``z`` and ``a`` are not allowed). A
|
|
156
159
|
string may use the Pauli matrices ``sigma_0``, ``sigma_x``,
|
|
157
160
|
``sigma_y``, ``sigma_z`` and ``kron`` (Kronecker product); ``I``
|
|
158
161
|
is the imaginary unit.
|
|
159
|
-
|
|
162
|
+
dim : 1, 2 or 3
|
|
163
|
+
Default value None: the last axis whose momentum
|
|
160
164
|
appears (1 if none).
|
|
161
165
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
Returns
|
|
167
|
+
-------
|
|
168
|
+
hoppings : Dictionary
|
|
169
|
+
key: tuple of *dim* integers
|
|
170
|
+
:math:`\mathbf{R}`, val: sympy Matrix :math:`T(\mathbf{R})`, in
|
|
171
|
+
the symbol ``a`` and those of *hamiltonian*.
|
|
166
172
|
|
|
173
|
+
Examples
|
|
174
|
+
--------
|
|
167
175
|
Example usage::
|
|
168
176
|
|
|
169
177
|
discretize_symbolic('k_x**2')
|
|
@@ -211,21 +219,29 @@ def discretize(hamiltonian, a: float = 1., dim: int | None = None,
|
|
|
211
219
|
otherwise every matrix element is stored, with ``hermitian=False``.
|
|
212
220
|
Constant onsite terms are in *ks.onsite*.
|
|
213
221
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
222
|
+
Parameters
|
|
223
|
+
----------
|
|
224
|
+
hamiltonian : sympy expression or Matrix, or a string (see *discretize_symbolic*)
|
|
225
|
+
a
|
|
226
|
+
Real number, at least :math:`\sqrt{0.1}\approx 0.316` (the
|
|
217
227
|
shortest primitive vector of a **Lattice**). Default value 1. Grid
|
|
218
228
|
spacing: to refine the grid, measure lengths in a smaller unit.
|
|
219
|
-
|
|
229
|
+
dim : 1, 2 or 3
|
|
230
|
+
Default value None: the last axis whose momentum
|
|
220
231
|
appears (1 if none).
|
|
221
|
-
|
|
232
|
+
tags : String or list of one-character strings
|
|
233
|
+
Default value
|
|
222
234
|
None: 'a', 'b', 'c', ... Tag of each orbital.
|
|
223
235
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
236
|
+
Returns
|
|
237
|
+
-------
|
|
238
|
+
ks : **KSpace** instance (spinless, *norb* orbitals)
|
|
239
|
+
Its
|
|
240
|
+
lattice has *prim_vec* :math:`a\hat{\mathbf{x}}, a\hat{\mathbf{y}},
|
|
241
|
+
(a\hat{\mathbf{z}})`.
|
|
228
242
|
|
|
243
|
+
Examples
|
|
244
|
+
--------
|
|
229
245
|
Example usage::
|
|
230
246
|
|
|
231
247
|
# the BHZ model of HgTe quantum wells, one spin block
|
|
@@ -36,20 +36,29 @@ def density_of_states(
|
|
|
36
36
|
:math:`\int\rho(E)dE` equals the number of levels in *energies*,
|
|
37
37
|
for an *e_grid* wide enough to contain the tails.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
energies : Array of (real) eigenenergies
|
|
42
|
+
Any shape (e.g. the
|
|
40
43
|
*en* attribute of **System**, or of **KSpace** after *get_bands*
|
|
41
44
|
over a k-mesh -- flattened automatically).
|
|
42
|
-
|
|
45
|
+
e_grid : Real ndarray, default None
|
|
46
|
+
Energies at which to
|
|
43
47
|
evaluate the density of states. If None, a grid of 401 points
|
|
44
48
|
spanning ``[min(energies)-3*broadening, max(energies)+3*broadening]``
|
|
45
49
|
is used.
|
|
46
|
-
|
|
50
|
+
broadening : Positive real number, default 0.05
|
|
51
|
+
Kernel width
|
|
47
52
|
:math:`\sigma`.
|
|
48
|
-
|
|
53
|
+
kernel : String, default 'gaussian'
|
|
54
|
+
'gaussian' or 'lorentzian'.
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
e_grid : Real ndarray
|
|
59
|
+
The energy grid used.
|
|
60
|
+
dos : Real ndarray, same shape as *e_grid*
|
|
61
|
+
Density of states.
|
|
53
62
|
'''
|
|
54
63
|
error_handling.ndarray_empty(np.asarray(energies), 'energies')
|
|
55
64
|
error_handling.positive_real(broadening, 'broadening')
|
|
@@ -153,18 +162,27 @@ def tetrahedron_dos(
|
|
|
153
162
|
correction. Complex energies (non-Hermitian bands) are replaced by
|
|
154
163
|
their real part.
|
|
155
164
|
|
|
156
|
-
|
|
165
|
+
Parameters
|
|
166
|
+
----------
|
|
167
|
+
energies
|
|
168
|
+
Real array, shape (n1, n2, ..., nbands): the bands on
|
|
157
169
|
a periodic mesh of 1, 2 or 3 dimensions, ``energies[i1, i2, ..., n]``
|
|
158
170
|
at the k-point :math:`\sum_d (i_d/n_d)\mathbf{b}_d` (as given by
|
|
159
171
|
``KSpace.mesh_bands(nk).reshape(*nk, norb)``).
|
|
160
|
-
|
|
172
|
+
e_grid : Real ndarray, increasing, default None
|
|
173
|
+
Energies at
|
|
161
174
|
which to evaluate the density of states. If None, 401 points
|
|
162
175
|
spanning the bands, with a 2% margin on each side.
|
|
163
176
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
Returns
|
|
178
|
+
-------
|
|
179
|
+
e_grid : Real ndarray
|
|
180
|
+
The energy grid used.
|
|
181
|
+
dos : Real ndarray, same shape as *e_grid*
|
|
182
|
+
Density of states.
|
|
167
183
|
|
|
184
|
+
Examples
|
|
185
|
+
--------
|
|
168
186
|
Example usage::
|
|
169
187
|
|
|
170
188
|
en = ks.mesh_bands((40, 40)).reshape(40, 40, ks.norb)
|