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.
Files changed (84) hide show
  1. {tbkit-0.6.0/tbkit.egg-info → tbkit-0.6.2}/PKG-INFO +8 -5
  2. {tbkit-0.6.0 → tbkit-0.6.2}/README.md +3 -3
  3. {tbkit-0.6.0 → tbkit-0.6.2}/pyproject.toml +2 -2
  4. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/__init__.py +1 -1
  5. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/bdg.py +86 -41
  6. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/bridges.py +50 -24
  7. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/continuum.py +31 -15
  8. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/dos.py +30 -12
  9. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/error_handling.py +1274 -393
  10. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/exceptional.py +142 -65
  11. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/floquet.py +177 -83
  12. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/graphene.py +58 -21
  13. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/higher_order.py +90 -48
  14. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/io.py +82 -40
  15. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/kpm.py +119 -64
  16. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/kspace.py +935 -442
  17. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/lattice.py +101 -43
  18. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/lattices.py +30 -6
  19. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/meanfield.py +80 -40
  20. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/moire.py +120 -59
  21. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/neighbours.py +44 -21
  22. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/occupation.py +20 -11
  23. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/optics.py +96 -53
  24. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/orbital.py +84 -32
  25. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/plot.py +229 -116
  26. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/propagation.py +91 -39
  27. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/save.py +32 -14
  28. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/slater_koster.py +28 -16
  29. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/system.py +235 -92
  30. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/topology.py +49 -23
  31. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/transport.py +396 -221
  32. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/values.py +13 -6
  33. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/wannier.py +78 -33
  34. {tbkit-0.6.0 → tbkit-0.6.2/tbkit.egg-info}/PKG-INFO +8 -5
  35. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/requires.txt +4 -1
  36. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_kspace.py +51 -0
  37. {tbkit-0.6.0 → tbkit-0.6.2}/LICENSE +0 -0
  38. {tbkit-0.6.0 → tbkit-0.6.2}/setup.cfg +0 -0
  39. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit/py.typed +0 -0
  40. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/SOURCES.txt +0 -0
  41. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/dependency_links.txt +0 -0
  42. {tbkit-0.6.0 → tbkit-0.6.2}/tbkit.egg-info/top_level.txt +0 -0
  43. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_analysis.py +0 -0
  44. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_berry_response.py +0 -0
  45. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_bridges.py +0 -0
  46. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_continuum.py +0 -0
  47. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_correlations.py +0 -0
  48. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_dos.py +0 -0
  49. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_error_handling.py +0 -0
  50. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_error_handling_structures.py +0 -0
  51. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_exceptional.py +0 -0
  52. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_floquet.py +0 -0
  53. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_graphene.py +0 -0
  54. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_green_occupation.py +0 -0
  55. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_hall.py +0 -0
  56. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_higher_order.py +0 -0
  57. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_interactions.py +0 -0
  58. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_invariants.py +0 -0
  59. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_io.py +0 -0
  60. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_kpm.py +0 -0
  61. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_large_lattices.py +0 -0
  62. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_lattice.py +0 -0
  63. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_lattices.py +0 -0
  64. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_magnetic.py +0 -0
  65. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_moire.py +0 -0
  66. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_neighbours.py +0 -0
  67. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_non_hermitian_bands.py +0 -0
  68. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_optics.py +0 -0
  69. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_orbitals.py +0 -0
  70. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_periodic.py +0 -0
  71. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_plot.py +0 -0
  72. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_propagation.py +0 -0
  73. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_regressions.py +0 -0
  74. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_save.py +0 -0
  75. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_smatrix.py +0 -0
  76. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_surface_spectral.py +0 -0
  77. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_system.py +0 -0
  78. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_three_d.py +0 -0
  79. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_topology.py +0 -0
  80. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_transport.py +0 -0
  81. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_transport_response.py +0 -0
  82. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_values.py +0 -0
  83. {tbkit-0.6.0 → tbkit-0.6.2}/tests/test_wannier90.py +0 -0
  84. {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.0
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.15; extra == "docs"
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 | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/1381398706.svg)](https://zenodo.org/badge/latestdoi/1381398706) |
48
- | Quality | [![License](https://badgen.net/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
50
+ | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23386289.svg)](https://doi.org/10.5281/zenodo.23386289) |
51
+ | Quality | [![License](https://img.shields.io/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
49
52
  | Documentation | [![Docs](https://badgen.net/badge/docs/cpoli.github.io%2Ftbkit/blue)](https://cpoli.github.io/tbkit/) |
50
53
  | Downloads | [![Downloads](https://static.pepy.tech/badge/tbkit)](https://pepy.tech/project/tbkit) [![Downloads/Month](https://static.pepy.tech/badge/tbkit/month)](https://pepy.tech/project/tbkit) |
51
- | Community | [![GitHub Stars](https://badgen.net/github/stars/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![GitHub Forks](https://badgen.net/github/forks/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![Contributors](https://badgen.net/github/contributors/cpoli/tbkit)](https://github.com/cpoli/tbkit/graphs/contributors) [![Last Commit](https://badgen.net/github/last-commit/cpoli/tbkit/master)](https://github.com/cpoli/tbkit/commits/master) |
54
+ | Community | [![GitHub Stars](https://img.shields.io/github/stars/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![GitHub Forks](https://img.shields.io/github/forks/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![Contributors](https://img.shields.io/github/contributors/cpoli/tbkit)](https://github.com/cpoli/tbkit/graphs/contributors) [![Last Commit](https://img.shields.io/github/last-commit/cpoli/tbkit/master)](https://github.com/cpoli/tbkit/commits/master) |
52
55
 
53
56
  ![tbkit logo](https://raw.githubusercontent.com/cpoli/tbkit/master/docs/source/_static/image/tbkit_logo.png)
54
57
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  | | |
4
4
  |:--|:-:|
5
- | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/1381398706.svg)](https://zenodo.org/badge/latestdoi/1381398706) |
6
- | Quality | [![License](https://badgen.net/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
5
+ | Package | [![PyPI version](https://badgen.net/pypi/v/tbkit)](https://pypi.org/project/tbkit/) [![conda-forge](https://img.shields.io/conda/vn/conda-forge/tbkit)](https://anaconda.org/conda-forge/tbkit) [![Python versions](https://badgen.net/pypi/python/tbkit)](https://pypi.org/project/tbkit/) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23386289.svg)](https://doi.org/10.5281/zenodo.23386289) |
6
+ | Quality | [![License](https://img.shields.io/github/license/cpoli/tbkit)](https://github.com/cpoli/tbkit/blob/master/LICENSE) [![CI](https://github.com/cpoli/tbkit/actions/workflows/ci.yml/badge.svg)](https://github.com/cpoli/tbkit/actions/workflows/ci.yml) [![Coverage](https://codecov.io/gh/cpoli/tbkit/branch/master/graph/badge.svg)](https://codecov.io/gh/cpoli/tbkit) |
7
7
  | Documentation | [![Docs](https://badgen.net/badge/docs/cpoli.github.io%2Ftbkit/blue)](https://cpoli.github.io/tbkit/) |
8
8
  | Downloads | [![Downloads](https://static.pepy.tech/badge/tbkit)](https://pepy.tech/project/tbkit) [![Downloads/Month](https://static.pepy.tech/badge/tbkit/month)](https://pepy.tech/project/tbkit) |
9
- | Community | [![GitHub Stars](https://badgen.net/github/stars/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![GitHub Forks](https://badgen.net/github/forks/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![Contributors](https://badgen.net/github/contributors/cpoli/tbkit)](https://github.com/cpoli/tbkit/graphs/contributors) [![Last Commit](https://badgen.net/github/last-commit/cpoli/tbkit/master)](https://github.com/cpoli/tbkit/commits/master) |
9
+ | Community | [![GitHub Stars](https://img.shields.io/github/stars/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![GitHub Forks](https://img.shields.io/github/forks/cpoli/tbkit)](https://github.com/cpoli/tbkit) [![Contributors](https://img.shields.io/github/contributors/cpoli/tbkit)](https://github.com/cpoli/tbkit/graphs/contributors) [![Last Commit](https://img.shields.io/github/last-commit/cpoli/tbkit/master)](https://github.com/cpoli/tbkit/commits/master) |
10
10
 
11
11
  ![tbkit logo](https://raw.githubusercontent.com/cpoli/tbkit/master/docs/source/_static/image/tbkit_logo.png)
12
12
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tbkit"
7
- version = "0.6.0"
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.15", "sympy>=1.12"]
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
@@ -6,7 +6,7 @@
6
6
 
7
7
  """tbkit: build and solve Tight-Binding models."""
8
8
 
9
- __version__ = "0.6.0"
9
+ __version__ = "0.6.2"
10
10
 
11
11
  __all__ = [
12
12
  "Lattice", "System", "Plot", "Propagation", "Save", "KSpace",
@@ -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
- :param ham: Square Hermitian matrix, shape (N, N) (e.g. *System.ham*).
34
- :param pairing: Square antisymmetric matrix, shape (N, N): :math:`\Delta`
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
- :param mu: Real number. Default value 0. Chemical potential.
39
+ mu : Real number, default 0
40
+ Chemical potential.
37
41
 
38
- :returns:
39
- * **ham_bdg** -- Sparse CSR matrix, shape (2N, 2N).
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
- :param sys: **System** instance, with hoppings.
60
- :param delta: Complex number. :math:`\Delta`.
64
+ Parameters
65
+ ----------
66
+ sys : **System** instance, with hoppings
67
+ delta : Complex number
68
+ :math:`\Delta`.
61
69
 
62
- :returns:
63
- * **pairing** -- Sparse CSR matrix, shape (sites, sites).
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
- :param n_sites: Positive integer. Number of sites.
82
- :param delta: Complex number. :math:`\Delta`.
90
+ Parameters
91
+ ----------
92
+ n_sites : Positive integer
93
+ Number of sites.
94
+ delta : Complex number
95
+ :math:`\Delta`.
83
96
 
84
- :returns:
85
- * **pairing** -- Sparse CSR matrix, shape (2 n_sites, 2 n_sites).
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
- :param ks: **KSpace** instance (Hermitian, orthogonal basis).
109
- :param pairing: List of dictionaries with keys ('i', 'j', 'R', 'delta'):
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
- :param mu: Real number. Default value 0. Chemical potential.
129
+ mu : Real number, default 0
130
+ Chemical potential.
113
131
 
114
- :returns:
115
- * **ks_bdg** -- **KSpace** instance, 2 norb orbitals.
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
- :param n: Positive integer. Number of particle orbitals.
178
+ Parameters
179
+ ----------
180
+ n : Positive integer
181
+ Number of particle orbitals.
158
182
 
159
- :returns:
160
- * **tau_x** -- Real ndarray, shape (2n, 2n).
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
- :param a: Square antisymmetric matrix, shape (n, n).
199
+ Parameters
200
+ ----------
201
+ a : Square antisymmetric matrix, shape (n, n)
175
202
 
176
- :returns:
177
- * **pf** -- Complex number (a float for a real matrix).
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
- :param ks: **KSpace** instance of a BdG model, 2n orbitals: n particles
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
- :returns:
231
- * **m** -- Integer, -1 (topological) or +1 (trivial).
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
- :ivar delta: Complex ndarray. Gap :math:`\Delta_i` on every site.
253
- :ivar energies: Real ndarray, shape (2N,). Spectrum of the reduced BdG
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
- :ivar states: Complex ndarray, shape (2N, 2N). Its eigenvectors
291
+ states : Complex ndarray, shape (2N, 2N)
292
+ Its eigenvectors
256
293
  :math:`(u_n, v_n)` (columns).
257
- :ivar iterations: Integer. Number of iterations.
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
- :param ham: Square Hermitian matrix, (N, N), spin independent (e.g. *System.ham*).
309
- :param V: Positive real, or array of N non-negative reals. Attraction.
310
- :param mu: Real number. Default value 0. Chemical potential.
311
- :param temperature: Positive real or zero. Default value 0.
312
- :param delta0: Number, or array of N numbers. Default value 0.1.
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
- :param mixing: Real in (0, 1]. Default value 1 (plain iteration).
315
- :param tol: Positive real. Default value 1e-8. Convergence threshold
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
- :param max_iter: Positive integer. Default value 10000.
361
+ max_iter : Positive integer, default 10000
318
362
 
319
- :returns:
320
- * **result** -- :class:`GapResult`.
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
- :param lat: **Lattice** instance, after *get_lattice* (sites may have
48
+ Parameters
49
+ ----------
50
+ lat
51
+ **Lattice** instance, after *get_lattice* (sites may have
49
52
  been removed, but not moved).
50
53
 
51
- :returns:
52
- * **cells** -- Integer ndarray, shape (sites, dim). :math:`n_{s,k}`.
53
- * **orbitals** -- Integer ndarray, shape (sites,). :math:`o_s`.
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
- :param sys: **System** instance with its hoppings set (one orbital per site).
94
- :param periodic: Boolean. Default value None: True if *sys* has
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
- :param tol: Positive real number. Default value 1e-9. Largest allowed
108
+ tol : Positive real number, default 1e-9
109
+ Largest allowed
100
110
  difference between equivalent matrix elements.
101
111
 
102
- :returns:
103
- * **ks** -- **KSpace** instance (spinless), on a new **Lattice**
104
- with the *unit_cell* and *prim_vec* of *sys.lat*.
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
- :param ks: **KSpace** instance.
174
- :param n_cells: Positive integer, or tuple of *dim* positive integers.
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
- :param periodic: Boolean. Default value False. Periodic boundaries (a torus).
192
+ periodic : Boolean, default False
193
+ Periodic boundaries (a torus).
177
194
 
178
- :returns:
179
- * **ham** -- Complex CSR matrix, shape (N*norb, N*norb).
180
- * **positions** -- Real ndarray, shape (N*norb, space_dim). Row
181
- :math:`c\,\mathrm{norb}+o` sits at :math:`\boldsymbol\tau_o + \sum_k n_k\mathbf{a}_k`
182
- (cell *c* has :math:`c = n_1 + N_1 n_2 + N_1N_2 n_3`).
183
- * **tags** -- String ndarray, shape (N*norb,). Sublattice tags.
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
- :param ks: **KSpace** instance, with ``spin=False``.
214
- :param n_cells: Positive integer, or tuple of *dim* positive integers.
215
- :param periodic: Boolean. Default value False. Periodic boundaries (a torus).
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
- :returns:
218
- * **sys** -- **System** instance, with its hoppings set.
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
- :param hamiltonian: sympy expression or Matrix, or a string, in the
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
- :param dim: 1, 2 or 3. Default value None: the last axis whose momentum
162
+ dim : 1, 2 or 3
163
+ Default value None: the last axis whose momentum
160
164
  appears (1 if none).
161
165
 
162
- :returns:
163
- * **hoppings** -- Dictionary. key: tuple of *dim* integers
164
- :math:`\mathbf{R}`, val: sympy Matrix :math:`T(\mathbf{R})`, in
165
- the symbol ``a`` and those of *hamiltonian*.
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
- :param hamiltonian: sympy expression or Matrix, or a string (see
215
- *discretize_symbolic*).
216
- :param a: Real number, at least :math:`\sqrt{0.1}\approx 0.316` (the
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
- :param dim: 1, 2 or 3. Default value None: the last axis whose momentum
229
+ dim : 1, 2 or 3
230
+ Default value None: the last axis whose momentum
220
231
  appears (1 if none).
221
- :param tags: String or list of one-character strings. Default value
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
- :returns:
225
- * **ks** -- **KSpace** instance (spinless, *norb* orbitals). Its
226
- lattice has *prim_vec* :math:`a\hat{\mathbf{x}}, a\hat{\mathbf{y}},
227
- (a\hat{\mathbf{z}})`.
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
- :param energies: Array of (real) eigenenergies. Any shape (e.g. the
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
- :param e_grid: Real ndarray. Default value None. Energies at which to
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
- :param broadening: Positive real number. Default value 0.05. Kernel width
50
+ broadening : Positive real number, default 0.05
51
+ Kernel width
47
52
  :math:`\sigma`.
48
- :param kernel: String. Default value 'gaussian'. 'gaussian' or 'lorentzian'.
53
+ kernel : String, default 'gaussian'
54
+ 'gaussian' or 'lorentzian'.
49
55
 
50
- :returns:
51
- * **e_grid** -- Real ndarray. The energy grid used.
52
- * **dos** -- Real ndarray, same shape as *e_grid*. Density of states.
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
- :param energies: Real array, shape (n1, n2, ..., nbands): the bands on
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
- :param e_grid: Real ndarray, increasing. Default value None. Energies at
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
- :returns:
165
- * **e_grid** -- Real ndarray. The energy grid used.
166
- * **dos** -- Real ndarray, same shape as *e_grid*. Density of states.
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)