quant-met 0.0.2__tar.gz → 0.0.3__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 (26) hide show
  1. quant_met-0.0.3/LICENSES/MIT.txt +9 -0
  2. {quant_met-0.0.2 → quant_met-0.0.3}/PKG-INFO +11 -7
  3. {quant_met-0.0.2 → quant_met-0.0.3}/README.md +6 -0
  4. quant_met-0.0.3/pyproject.toml +74 -0
  5. quant_met-0.0.3/src/quant_met/__init__.py +5 -0
  6. quant_met-0.0.3/src/quant_met/mean_field/__init__.py +60 -0
  7. quant_met-0.0.3/src/quant_met/mean_field/_utils.py +27 -0
  8. quant_met-0.0.2/src/quant_met/hamiltonians/_base_hamiltonian.py → quant_met-0.0.3/src/quant_met/mean_field/base_hamiltonian.py +151 -27
  9. quant_met-0.0.3/src/quant_met/mean_field/eg_x.py +120 -0
  10. quant_met-0.0.3/src/quant_met/mean_field/free_energy.py +130 -0
  11. quant_met-0.0.2/src/quant_met/hamiltonians/_graphene.py → quant_met-0.0.3/src/quant_met/mean_field/graphene.py +26 -22
  12. quant_met-0.0.3/src/quant_met/mean_field/quantum_metric.py +59 -0
  13. quant_met-0.0.2/src/quant_met/hamiltonians/_superfluid_weight.py → quant_met-0.0.3/src/quant_met/mean_field/superfluid_weight.py +66 -50
  14. quant_met-0.0.3/src/quant_met/plotting/__init__.py +28 -0
  15. quant_met-0.0.3/src/quant_met/plotting/plotting.py +230 -0
  16. quant_met-0.0.3/src/quant_met/utils.py +71 -0
  17. quant_met-0.0.2/pyproject.toml +0 -39
  18. quant_met-0.0.2/src/quant_met/__init__.py +0 -7
  19. quant_met-0.0.2/src/quant_met/hamiltonians/__init__.py +0 -14
  20. quant_met-0.0.2/src/quant_met/hamiltonians/_eg_x.py +0 -124
  21. quant_met-0.0.2/src/quant_met/hamiltonians/_free_energy.py +0 -39
  22. quant_met-0.0.2/src/quant_met/hamiltonians/_utils.py +0 -10
  23. quant_met-0.0.2/src/quant_met/plotting/__init__.py +0 -7
  24. quant_met-0.0.2/src/quant_met/plotting/_plotting.py +0 -156
  25. quant_met-0.0.2/src/quant_met/utils.py +0 -28
  26. {quant_met-0.0.2 → quant_met-0.0.3}/LICENSE.txt +0 -0
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present Tjark <tsievers@physnet.uni-hamburg.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,22 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quant-met
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Calculate superconductivity in flat-band systems.
5
5
  Author: Tjark Sievers
6
6
  Author-email: tsievers@physnet.uni-hamburg.de
7
- Requires-Python: >=3.10,<4.0
7
+ Requires-Python: >=3.11,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
9
  Classifier: Programming Language :: Python :: 3.11
11
10
  Classifier: Programming Language :: Python :: 3.12
12
11
  Requires-Dist: h5py (>=3.11.0,<4.0.0)
13
- Requires-Dist: matplotlib (>=3.8.4,<4.0.0)
14
- Requires-Dist: numpy (>=1.26.4,<2.0.0)
12
+ Requires-Dist: matplotlib (>=3.9.1,<4.0.0)
13
+ Requires-Dist: numpy (>=2.0.0,<3.0.0)
15
14
  Requires-Dist: pandas (>=2.2.2,<3.0.0)
16
- Requires-Dist: scipy (>=1.13.0,<2.0.0)
17
- Requires-Dist: sympy (>=1.12,<2.0)
15
+ Requires-Dist: scipy (>=1.14.0,<2.0.0)
18
16
  Description-Content-Type: text/markdown
19
17
 
18
+ <!--
19
+ SPDX-FileCopyrightText: 2024 Tjark Sievers
20
+
21
+ SPDX-License-Identifier: MIT
22
+ -->
23
+
20
24
  # quant-met
21
25
 
22
26
  [![Test](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml/badge.svg)](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml)
@@ -1,3 +1,9 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2024 Tjark Sievers
3
+
4
+ SPDX-License-Identifier: MIT
5
+ -->
6
+
1
7
  # quant-met
2
8
 
3
9
  [![Test](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml/badge.svg)](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml)
@@ -0,0 +1,74 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ [project]
6
+ name = "quant-met"
7
+ requires-python = ">=3.11"
8
+
9
+ [tool.poetry]
10
+ name = "quant-met"
11
+ version = "0.0.3"
12
+ description = "Calculate superconductivity in flat-band systems."
13
+ authors = ["Tjark Sievers <tsievers@physnet.uni-hamburg.de>"]
14
+ readme = "README.md"
15
+
16
+ [tool.poetry.dependencies]
17
+ python = "^3.11"
18
+ numpy = "^2.0.0"
19
+ scipy = "^1.14.0"
20
+ matplotlib = "^3.9.1"
21
+ pandas = "^2.2.2"
22
+ h5py = "^3.11.0"
23
+
24
+ [tool.poetry.group.dev.dependencies]
25
+ pre-commit = "^3.7.0"
26
+ scriv = "^1.5.1"
27
+ jupyter = "^1.0.0"
28
+ ipympl = "^0.9.4"
29
+ sphinx = "^7.3.7"
30
+ myst-parser = "^3.0.1"
31
+ nbsphinx = "^0.9.4"
32
+ sphinx-gallery = "^0.16.0"
33
+ pydata-sphinx-theme = "^0.15.4"
34
+ sphinx-design = "^0.6.0"
35
+ tox = "^4.15.0"
36
+ mypy = "^1.10.0"
37
+ pytest = "^8.2.1"
38
+ pytest-cov = "^5.0.0"
39
+ hypothesis = {extras = ["numpy"], version = "^6.103.0"}
40
+ pytest-regressions = "^2.5.0"
41
+ numpydoc = "^1.7.0"
42
+ ruff = "^0.5.0"
43
+
44
+ [build-system]
45
+ requires = ["poetry-core"]
46
+ build-backend = "poetry.core.masonry.api"
47
+
48
+ # Config for ruff
49
+ [tool.ruff]
50
+ line-length = 100
51
+ force-exclude = true
52
+ extend-exclude = ["tests", "docs/source/conf.py"]
53
+
54
+ [tool.ruff.lint]
55
+ #select = []
56
+ #select = ["D", "E", "F", "I", "W"]
57
+ select = ["ALL"]
58
+ ignore = [
59
+ "D203", # one-blank-line-before-class
60
+ "D212", # multi-line-summary-first-line
61
+ "COM812",
62
+ "ISC001",
63
+ "Q000",
64
+ "Q003",
65
+ "S101", # This checks against using assert
66
+ "PLR0913", # This checks against using more than 5 function arguments
67
+ ]
68
+
69
+
70
+ [tool.ruff.lint.pydocstyle]
71
+ convention = "numpy"
72
+
73
+ #[format]
74
+ #docstring-code-format = true
@@ -0,0 +1,5 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """quant-met, a package to treat superconductivity in flat-band systems."""
@@ -0,0 +1,60 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """
6
+ Mean field treatment (:mod:`quant_met.mean_field`)
7
+ ==================================================
8
+
9
+ Hamiltonians
10
+ ------------
11
+
12
+ Base
13
+
14
+ .. autosummary::
15
+ :toctree: generated/
16
+
17
+ BaseHamiltonian
18
+
19
+ .. autosummary::
20
+ :toctree: generated/
21
+
22
+ GrapheneHamiltonian
23
+ EGXHamiltonian
24
+
25
+
26
+ Functions
27
+ ---------
28
+
29
+ .. autosummary::
30
+ :toctree: generated/
31
+
32
+ superfluid_weight
33
+ quantum_metric
34
+ free_energy
35
+ free_energy_uniform_pairing
36
+ """ # noqa: D205, D400
37
+
38
+ from .base_hamiltonian import BaseHamiltonian
39
+ from .eg_x import EGXHamiltonian
40
+ from .free_energy import (
41
+ free_energy,
42
+ free_energy_complex_gap,
43
+ free_energy_real_gap,
44
+ free_energy_uniform_pairing,
45
+ )
46
+ from .graphene import GrapheneHamiltonian
47
+ from .quantum_metric import quantum_metric
48
+ from .superfluid_weight import superfluid_weight
49
+
50
+ __all__ = [
51
+ "superfluid_weight",
52
+ "quantum_metric",
53
+ "free_energy",
54
+ "free_energy_complex_gap",
55
+ "free_energy_real_gap",
56
+ "free_energy_uniform_pairing",
57
+ "BaseHamiltonian",
58
+ "GrapheneHamiltonian",
59
+ "EGXHamiltonian",
60
+ ]
@@ -0,0 +1,27 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ from typing import Any
6
+
7
+ import numpy as np
8
+ import numpy.typing as npt
9
+
10
+
11
+ def _check_valid_array(array_in: npt.NDArray[Any]) -> bool:
12
+ if np.isnan(array_in).any() or np.isinf(array_in).any():
13
+ msg = "k is NaN or Infinity"
14
+ raise ValueError(msg)
15
+
16
+ return True
17
+
18
+
19
+ def _validate_float(float_in: float, parameter_name: str) -> float:
20
+ if np.isinf(float_in):
21
+ msg = f"{parameter_name} must not be Infinity"
22
+ raise ValueError(msg)
23
+ if np.isnan(float_in):
24
+ msg = f"{parameter_name} must not be NaN"
25
+ raise ValueError(msg)
26
+
27
+ return float_in
@@ -1,3 +1,9 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """Provides the base class for Hamiltonians."""
6
+
1
7
  import pathlib
2
8
  from abc import ABC, abstractmethod
3
9
 
@@ -6,6 +12,8 @@ import numpy as np
6
12
  import numpy.typing as npt
7
13
  import pandas as pd
8
14
 
15
+ from ._utils import _check_valid_array
16
+
9
17
 
10
18
  class BaseHamiltonian(ABC):
11
19
  """Base class for Hamiltonians."""
@@ -13,26 +21,40 @@ class BaseHamiltonian(ABC):
13
21
  @property
14
22
  @abstractmethod
15
23
  def number_of_bands(self) -> int:
24
+ """Number of bands in the model."""
16
25
  raise NotImplementedError
17
26
 
18
27
  @property
19
- @abstractmethod
20
28
  def coloumb_orbital_basis(self) -> npt.NDArray[np.float64]:
29
+ """
30
+ Coloumb interaction split up in orbitals.
31
+
32
+ Returns
33
+ -------
34
+ :class:`numpy.ndarray`
35
+
36
+ """
21
37
  raise NotImplementedError
22
38
 
23
39
  @property
24
- def delta_orbital_basis(self) -> npt.NDArray[np.float64]:
40
+ def delta_orbital_basis(self) -> npt.NDArray[np.complex64]:
41
+ """
42
+ Order parameter in orbital basis.
43
+
44
+ Returns
45
+ -------
46
+ :class:`numpy.ndarray`
47
+
48
+ """
25
49
  raise NotImplementedError
26
50
 
27
51
  @delta_orbital_basis.setter
28
52
  @abstractmethod
29
- def delta_orbital_basis(self, new_delta: npt.NDArray[np.float64]) -> None:
53
+ def delta_orbital_basis(self, new_delta: npt.NDArray[np.complex64]) -> None:
30
54
  raise NotImplementedError
31
55
 
32
56
  @abstractmethod
33
- def _hamiltonian_one_point(
34
- self, k_point: npt.NDArray[np.float64]
35
- ) -> npt.NDArray[np.complex64]:
57
+ def _hamiltonian_one_point(self, k_point: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
36
58
  raise NotImplementedError
37
59
 
38
60
  @abstractmethod
@@ -49,15 +71,23 @@ class BaseHamiltonian(ABC):
49
71
  )
50
72
  np.fill_diagonal(delta_matrix, self.delta_orbital_basis)
51
73
 
52
- h = np.block(
74
+ return np.block(
53
75
  [
54
76
  [self.hamiltonian(k_point), delta_matrix],
55
77
  [np.conjugate(delta_matrix), -np.conjugate(self.hamiltonian(-k_point))],
56
78
  ]
57
79
  )
58
- return h
59
80
 
60
81
  def save(self, filename: pathlib.Path) -> None:
82
+ """
83
+ Save the Hamiltonian as a HDF5 file.
84
+
85
+ Parameters
86
+ ----------
87
+ filename : :class:`pathlib.Path`
88
+ Filename to save the Hamiltonian to, should end in .hdf5
89
+
90
+ """
61
91
  with h5py.File(f"{filename}", "a") as f:
62
92
  f.create_dataset("delta", data=self.delta_orbital_basis)
63
93
  for key, value in vars(self).items():
@@ -66,17 +96,39 @@ class BaseHamiltonian(ABC):
66
96
 
67
97
  @classmethod
68
98
  def from_file(cls, filename: pathlib.Path) -> "BaseHamiltonian":
69
- config_dict = {}
99
+ """
100
+ Initialise a Hamiltonian from a HDF5 file.
101
+
102
+ Parameters
103
+ ----------
104
+ filename : :class:`pathlib.Path`
105
+ File to load the Hamiltonian from.
106
+
107
+ """
70
108
  with h5py.File(f"{filename}", "r") as f:
109
+ config_dict = dict(f.attrs.items())
71
110
  config_dict["delta"] = f["delta"][()]
72
- for key, value in f.attrs.items():
73
- config_dict[key] = value
74
111
 
75
112
  return cls(**config_dict)
76
113
 
77
114
  def bdg_hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
115
+ """
116
+ Bogoliuobov de Genne Hamiltonian.
117
+
118
+ Parameters
119
+ ----------
120
+ k : :class:`numpy.ndarray`
121
+ List of k points.
122
+
123
+ Returns
124
+ -------
125
+ :class:`numpy.ndarray`
126
+ BdG Hamiltonian.
127
+
128
+ """
78
129
  if np.isnan(k).any() or np.isinf(k).any():
79
- raise ValueError("k is NaN or Infinity")
130
+ msg = "k is NaN or Infinity"
131
+ raise ValueError(msg)
80
132
  if k.ndim == 1:
81
133
  h = self._bdg_hamiltonian_one_point(k)
82
134
  else:
@@ -84,8 +136,21 @@ class BaseHamiltonian(ABC):
84
136
  return h
85
137
 
86
138
  def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
87
- if np.isnan(k).any() or np.isinf(k).any():
88
- raise ValueError("k is NaN or Infinity")
139
+ """
140
+ Return the normal state Hamiltonian in orbital basis.
141
+
142
+ Parameters
143
+ ----------
144
+ k : :class:`numpy.ndarray`
145
+ List of k points.
146
+
147
+ Returns
148
+ -------
149
+ :class:`numpy.ndarray`
150
+ Hamiltonian in matrix form.
151
+
152
+ """
153
+ assert _check_valid_array(k)
89
154
  if k.ndim == 1:
90
155
  h = self._hamiltonian_one_point(k)
91
156
  else:
@@ -95,19 +160,48 @@ class BaseHamiltonian(ABC):
95
160
  def hamiltonian_derivative(
96
161
  self, k: npt.NDArray[np.float64], direction: str
97
162
  ) -> npt.NDArray[np.complex64]:
98
- if np.isnan(k).any() or np.isinf(k).any():
99
- raise ValueError("k is NaN or Infinity")
163
+ """
164
+ Deriative of the Hamiltonian.
165
+
166
+ Parameters
167
+ ----------
168
+ k: :class:`numpy.ndarray`
169
+ List of k points.
170
+ direction: str
171
+ Direction for derivative, either 'x' oder 'y'.
172
+
173
+ Returns
174
+ -------
175
+ :class:`numpy.ndarray`
176
+ Derivative of Hamiltonian.
177
+
178
+ """
179
+ assert _check_valid_array(k)
100
180
  if k.ndim == 1:
101
181
  h = self._hamiltonian_derivative_one_point(k, direction)
102
182
  else:
103
- h = np.array(
104
- [self._hamiltonian_derivative_one_point(k, direction) for k in k]
105
- )
183
+ h = np.array([self._hamiltonian_derivative_one_point(k, direction) for k in k])
106
184
  return h
107
185
 
108
186
  def diagonalize_nonint(
109
187
  self, k: npt.NDArray[np.float64]
110
188
  ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
189
+ """
190
+ Diagonalize the normal state Hamiltonian.
191
+
192
+ Parameters
193
+ ----------
194
+ k : :class:`numpy.ndarray`
195
+ List of k points.
196
+
197
+ Returns
198
+ -------
199
+ :class:`numpy.ndarray`
200
+ Eigenvalues of the normal state Hamiltonian.
201
+ :class:`numpy.ndarray`
202
+ Diagonalising matrix of the normal state Hamiltonian.
203
+
204
+ """
111
205
  k_point_matrix = self.hamiltonian(k)
112
206
 
113
207
  if k.ndim == 1:
@@ -119,16 +213,30 @@ class BaseHamiltonian(ABC):
119
213
  )
120
214
  band_energies = np.zeros((len(k), self.number_of_bands))
121
215
 
122
- for i, k in enumerate(k):
123
- band_energies[i], bloch_wavefunctions[i] = np.linalg.eigh(
124
- k_point_matrix[i]
125
- )
216
+ for i in range(len(k)):
217
+ band_energies[i], bloch_wavefunctions[i] = np.linalg.eigh(k_point_matrix[i])
126
218
 
127
219
  return band_energies, bloch_wavefunctions
128
220
 
129
221
  def diagonalize_bdg(
130
222
  self, k: npt.NDArray[np.float64]
131
223
  ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex64]]:
224
+ """
225
+ Diagonalize the BdG Hamiltonian.
226
+
227
+ Parameters
228
+ ----------
229
+ k : :class:`numpy.ndarray`
230
+ List of k points.
231
+
232
+ Returns
233
+ -------
234
+ :class:`numpy.ndarray`
235
+ Eigenvalues of the BdG Hamiltonian.
236
+ :class:`numpy.ndarray`
237
+ Diagonalising matrix of the BdG Hamiltonian.
238
+
239
+ """
132
240
  bdg_matrix = self.bdg_hamiltonian(k)
133
241
 
134
242
  if k.ndim == 1:
@@ -140,7 +248,7 @@ class BaseHamiltonian(ABC):
140
248
  )
141
249
  bdg_energies = np.zeros((len(k), 2 * self.number_of_bands))
142
250
 
143
- for i, k in enumerate(k):
251
+ for i in range(len(k)):
144
252
  bdg_energies[i], bdg_wavefunctions[i] = np.linalg.eigh(bdg_matrix[i])
145
253
 
146
254
  return bdg_energies, bdg_wavefunctions
@@ -150,6 +258,22 @@ class BaseHamiltonian(ABC):
150
258
  k: npt.NDArray[np.float64],
151
259
  overlaps: tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]] | None = None,
152
260
  ) -> pd.DataFrame:
261
+ """
262
+ Calculate the band structure.
263
+
264
+ Parameters
265
+ ----------
266
+ k : :class:`numpy.ndarray`
267
+ List of k points.
268
+ overlaps : tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`), optional
269
+ Overlaps.
270
+
271
+ Returns
272
+ -------
273
+ `pandas.DataFrame`
274
+ Band structure.
275
+
276
+ """
153
277
  k_point_matrix = self.hamiltonian(k)
154
278
 
155
279
  results = pd.DataFrame(
@@ -157,14 +281,14 @@ class BaseHamiltonian(ABC):
157
281
  dtype=float,
158
282
  )
159
283
 
160
- for i, k in enumerate(k):
284
+ for i in range(len(k)):
161
285
  energies, eigenvectors = np.linalg.eigh(k_point_matrix[i])
162
286
 
163
287
  for band_index in range(self.number_of_bands):
164
- results.at[i, f"band_{band_index}"] = energies[band_index]
288
+ results.loc[i, f"band_{band_index}"] = energies[band_index]
165
289
 
166
290
  if overlaps is not None:
167
- results.at[i, f"wx_{band_index}"] = (
291
+ results.loc[i, f"wx_{band_index}"] = (
168
292
  np.abs(np.dot(eigenvectors[:, band_index], overlaps[0])) ** 2
169
293
  - np.abs(np.dot(eigenvectors[:, band_index], overlaps[1])) ** 2
170
294
  )
@@ -0,0 +1,120 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """Provides the implementation for the EG-X model."""
6
+
7
+ import numpy as np
8
+ import numpy.typing as npt
9
+
10
+ from ._utils import _validate_float
11
+ from .base_hamiltonian import BaseHamiltonian
12
+
13
+
14
+ class EGXHamiltonian(BaseHamiltonian):
15
+ """Hamiltonian for the EG-X model."""
16
+
17
+ def __init__(
18
+ self,
19
+ hopping_gr: float,
20
+ hopping_x: float,
21
+ hopping_x_gr_a: float,
22
+ lattice_constant: float,
23
+ mu: float,
24
+ coloumb_gr: float,
25
+ coloumb_x: float,
26
+ delta: npt.NDArray[np.complex64] | None = None,
27
+ ) -> None:
28
+ self.hopping_gr = _validate_float(hopping_gr, "Hopping graphene")
29
+ self.hopping_x = _validate_float(hopping_x, "Hopping impurity")
30
+ self.hopping_x_gr_a = _validate_float(hopping_x_gr_a, "Hybridisation")
31
+ self.lattice_constant = _validate_float(lattice_constant, "Lattice constant")
32
+ self.mu = _validate_float(mu, "Chemical potential")
33
+ self.coloumb_gr = _validate_float(coloumb_gr, "Coloumb interaction graphene")
34
+ self.coloumb_x = _validate_float(coloumb_x, "Coloumb interaction impurity")
35
+ self._coloumb_orbital_basis = np.array([self.coloumb_gr, self.coloumb_gr, self.coloumb_x])
36
+ self._number_of_bands = 3
37
+ if delta is None:
38
+ self._delta_orbital_basis = np.zeros(3, dtype=np.complex64)
39
+ else:
40
+ self._delta_orbital_basis = delta
41
+
42
+ @property
43
+ def coloumb_orbital_basis(self) -> npt.NDArray[np.float64]: # noqa: D102
44
+ return self._coloumb_orbital_basis
45
+
46
+ @property
47
+ def delta_orbital_basis(self) -> npt.NDArray[np.complex64]: # noqa: D102
48
+ return self._delta_orbital_basis
49
+
50
+ @delta_orbital_basis.setter
51
+ def delta_orbital_basis(self, new_delta: npt.NDArray[np.complex64]) -> None:
52
+ self._delta_orbital_basis = new_delta
53
+
54
+ @property
55
+ def number_of_bands(self) -> int: # noqa: D102
56
+ return self._number_of_bands
57
+
58
+ def _hamiltonian_derivative_one_point(
59
+ self, k: npt.NDArray[np.float64], direction: str
60
+ ) -> npt.NDArray[np.complex64]:
61
+ assert direction in ["x", "y"]
62
+
63
+ t_gr = self.hopping_gr
64
+ t_x = self.hopping_x
65
+ a = self.lattice_constant
66
+
67
+ h = np.zeros((self.number_of_bands, self.number_of_bands), dtype=np.complex64)
68
+
69
+ if direction == "x":
70
+ h[0, 1] = t_gr * a * np.exp(-0.5j * a / np.sqrt(3) * k[1]) * np.sin(0.5 * a * k[0])
71
+ h[1, 0] = h[0, 1].conjugate()
72
+ h[2, 2] = (
73
+ 2
74
+ * a
75
+ * t_x
76
+ * (np.sin(a * k[0]) + np.sin(0.5 * a * k[0]) * np.cos(0.5 * np.sqrt(3) * a * k[1]))
77
+ )
78
+ else:
79
+ h[0, 1] = (
80
+ -t_gr
81
+ * 1j
82
+ * a
83
+ / np.sqrt(3)
84
+ * (
85
+ np.exp(1j * a / np.sqrt(3) * k[1])
86
+ - np.exp(-0.5j * a / np.sqrt(3) * k[1]) * np.cos(0.5 * a * k[0])
87
+ )
88
+ )
89
+ h[1, 0] = h[0, 1].conjugate()
90
+ h[2, 2] = np.sqrt(3) * a * t_x * np.cos(0.5 * np.sqrt(3) * a * k[1])
91
+
92
+ return h
93
+
94
+ def _hamiltonian_one_point(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
95
+ t_gr = self.hopping_gr
96
+ t_x = self.hopping_x
97
+ a = self.lattice_constant
98
+ v = self.hopping_x_gr_a
99
+ mu = self.mu
100
+
101
+ h = np.zeros((self.number_of_bands, self.number_of_bands), dtype=np.complex64)
102
+
103
+ h[0, 1] = -t_gr * (
104
+ np.exp(1j * k[1] * a / np.sqrt(3))
105
+ + 2 * np.exp(-0.5j * a / np.sqrt(3) * k[1]) * (np.cos(0.5 * a * k[0]))
106
+ )
107
+
108
+ h[1, 0] = h[0, 1].conjugate()
109
+
110
+ h[2, 0] = v
111
+ h[0, 2] = v
112
+
113
+ h[2, 2] = (
114
+ -2
115
+ * t_x
116
+ * (np.cos(a * k[0]) + 2 * np.cos(0.5 * a * k[0]) * np.cos(0.5 * np.sqrt(3) * a * k[1]))
117
+ )
118
+ h -= mu * np.eye(3, dtype=np.complex64)
119
+
120
+ return h