quant-met 0.0.8__py3-none-any.whl → 0.0.10__py3-none-any.whl
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.
- quant_met/cli/__init__.py +2 -5
- quant_met/cli/main.py +30 -3
- quant_met/cli/scf.py +40 -10
- quant_met/geometry/__init__.py +1 -1
- quant_met/geometry/base_lattice.py +18 -4
- quant_met/geometry/graphene.py +10 -2
- quant_met/geometry/square.py +11 -3
- quant_met/mean_field/__init__.py +3 -5
- quant_met/mean_field/_utils.py +0 -11
- quant_met/mean_field/hamiltonians/__init__.py +7 -8
- quant_met/mean_field/hamiltonians/base_hamiltonian.py +202 -176
- quant_met/mean_field/hamiltonians/dressed_graphene.py +21 -108
- quant_met/mean_field/hamiltonians/graphene.py +14 -93
- quant_met/mean_field/hamiltonians/one_band_tight_binding.py +17 -97
- quant_met/mean_field/hamiltonians/three_band_tight_binding.py +84 -0
- quant_met/mean_field/hamiltonians/two_band_tight_binding.py +75 -0
- quant_met/mean_field/quantum_metric.py +18 -57
- quant_met/mean_field/self_consistency.py +54 -20
- quant_met/mean_field/superfluid_weight.py +6 -3
- quant_met/parameters/__init__.py +28 -5
- quant_met/parameters/hamiltonians.py +146 -16
- quant_met/parameters/main.py +35 -6
- quant_met/plotting/__init__.py +0 -3
- quant_met/plotting/plotting.py +0 -34
- {quant_met-0.0.8.dist-info → quant_met-0.0.10.dist-info}/METADATA +1 -1
- quant_met-0.0.10.dist-info/RECORD +33 -0
- quant_met-0.0.8.dist-info/RECORD +0 -31
- {quant_met-0.0.8.dist-info → quant_met-0.0.10.dist-info}/LICENSE.txt +0 -0
- {quant_met-0.0.8.dist-info → quant_met-0.0.10.dist-info}/LICENSES/MIT.txt +0 -0
- {quant_met-0.0.8.dist-info → quant_met-0.0.10.dist-info}/WHEEL +0 -0
- {quant_met-0.0.8.dist-info → quant_met-0.0.10.dist-info}/entry_points.txt +0 -0
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
import pathlib
|
8
8
|
from abc import ABC, abstractmethod
|
9
|
+
from typing import Generic, TypeVar
|
9
10
|
|
10
11
|
import h5py
|
11
12
|
import numpy as np
|
@@ -14,171 +15,186 @@ import pandas as pd
|
|
14
15
|
|
15
16
|
from quant_met.geometry import BaseLattice
|
16
17
|
from quant_met.mean_field._utils import _check_valid_array
|
18
|
+
from quant_met.parameters.hamiltonians import GenericParameters, HamiltonianParameters
|
19
|
+
|
20
|
+
GenericHamiltonian = TypeVar("GenericHamiltonian", bound="BaseHamiltonian[HamiltonianParameters]")
|
21
|
+
|
22
|
+
|
23
|
+
class BaseHamiltonian(Generic[GenericParameters], ABC):
|
24
|
+
"""Base class for Hamiltonians.
|
25
|
+
|
26
|
+
This abstract class provides the essential framework for defining various
|
27
|
+
Hamiltonians used in solid-state physics. It includes methods for constructing
|
28
|
+
the Hamiltonian based on a set of parameters, calculating properties such as
|
29
|
+
energy bands, conducting derivatives, and diagonalizing the Hamiltonian to
|
30
|
+
obtain eigenstates and eigenvalues. Subclasses should implement methods to
|
31
|
+
provide specific Hamiltonian forms.
|
32
|
+
|
33
|
+
Parameters
|
34
|
+
----------
|
35
|
+
parameters : :class:`quant_met.parameters.hamiltonians.GenericParameters`
|
36
|
+
An object containing the necessary parameters to define the Hamiltonian,
|
37
|
+
including lattice parameters, critical constants, and Hubbard interaction
|
38
|
+
strengths.
|
39
|
+
|
40
|
+
Attributes
|
41
|
+
----------
|
42
|
+
name : str
|
43
|
+
Name or identifier of the Hamiltonian.
|
44
|
+
beta : float
|
45
|
+
Inverse temperature (related to thermal excitations).
|
46
|
+
q : :class:`numpy.ndarray`
|
47
|
+
A two-dimensional array defining a momentum offset, typically in
|
48
|
+
reciprocal space.
|
49
|
+
lattice : :class:`quant_met.geometry.BaseLattice`
|
50
|
+
The lattice structure in which the Hamiltonian is defined.
|
51
|
+
hubbard_int_orbital_basis : :class:`numpy.ndarray`
|
52
|
+
Interaction terms for Hubbard-type models represented in orbital basis.
|
53
|
+
number_of_bands : int
|
54
|
+
The total number of bands calculated based on the orbital basis provided.
|
55
|
+
delta_orbital_basis : :class:`numpy.ndarray`
|
56
|
+
An array initialized for the order parameter or pairing potentials.
|
57
|
+
"""
|
58
|
+
|
59
|
+
def __init__(self, parameters: GenericParameters) -> None:
|
60
|
+
self.name = parameters.name
|
61
|
+
self.beta = parameters.beta
|
62
|
+
self.q = parameters.q if parameters.q is not None else np.zeros(2)
|
63
|
+
|
64
|
+
self.lattice = self.setup_lattice(parameters)
|
65
|
+
self.hubbard_int_orbital_basis = parameters.hubbard_int_orbital_basis
|
66
|
+
self.number_of_bands = len(self.hubbard_int_orbital_basis)
|
67
|
+
self.delta_orbital_basis = np.zeros(self.number_of_bands, dtype=np.complex64)
|
17
68
|
|
18
|
-
|
19
|
-
class BaseHamiltonian(ABC):
|
20
|
-
"""Base class for Hamiltonians."""
|
21
|
-
|
22
|
-
@property
|
23
69
|
@abstractmethod
|
24
|
-
def
|
25
|
-
"""
|
26
|
-
|
27
|
-
Returns
|
28
|
-
-------
|
29
|
-
str
|
30
|
-
|
31
|
-
"""
|
32
|
-
raise NotImplementedError
|
33
|
-
|
34
|
-
@property
|
35
|
-
@abstractmethod
|
36
|
-
def number_of_bands(self) -> int:
|
37
|
-
"""Number of bands.
|
38
|
-
|
39
|
-
Returns
|
40
|
-
-------
|
41
|
-
int
|
42
|
-
|
43
|
-
"""
|
44
|
-
raise NotImplementedError
|
70
|
+
def setup_lattice(self, parameters: GenericParameters) -> BaseLattice: # pragma: no cover
|
71
|
+
"""Set up the lattice based on the provided parameters.
|
45
72
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
73
|
+
Parameters
|
74
|
+
----------
|
75
|
+
parameters : GenericParameters
|
76
|
+
Input parameters containing necessary information for lattice construction.
|
50
77
|
|
51
78
|
Returns
|
52
79
|
-------
|
53
80
|
BaseLattice
|
54
|
-
|
81
|
+
An instance of a lattice object configured according to the input parameters.
|
55
82
|
"""
|
56
|
-
raise NotImplementedError
|
57
83
|
|
58
|
-
@
|
84
|
+
@classmethod
|
59
85
|
@abstractmethod
|
60
|
-
def
|
61
|
-
"""
|
62
|
-
hubbard_int interaction split up in orbitals.
|
63
|
-
|
64
|
-
Returns
|
65
|
-
-------
|
66
|
-
:class:`numpy.ndarray`
|
67
|
-
|
68
|
-
"""
|
69
|
-
raise NotImplementedError
|
86
|
+
def get_parameters_model(cls) -> type[GenericParameters]: # pragma: no cover
|
87
|
+
"""Return the specific parameters model for the subclass.
|
70
88
|
|
71
|
-
|
72
|
-
|
73
|
-
def delta_orbital_basis(self) -> npt.NDArray[np.complex64]:
|
74
|
-
"""
|
75
|
-
Order parameter in orbital basis.
|
89
|
+
This method should provide the structure of parameters required by
|
90
|
+
subclasses to initialize the Hamiltonian.
|
76
91
|
|
77
92
|
Returns
|
78
93
|
-------
|
79
|
-
|
80
|
-
|
94
|
+
type
|
95
|
+
The parameters model class type specific to the Hamiltonian subclass.
|
81
96
|
"""
|
82
|
-
raise NotImplementedError
|
83
97
|
|
84
|
-
@delta_orbital_basis.setter
|
85
98
|
@abstractmethod
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
91
|
-
"""
|
92
|
-
Return the normal state Hamiltonian in orbital basis.
|
99
|
+
def hamiltonian(
|
100
|
+
self, k: npt.NDArray[np.float64]
|
101
|
+
) -> npt.NDArray[np.complex64]: # pragma: no cover
|
102
|
+
"""Return the normal state Hamiltonian.
|
93
103
|
|
94
104
|
Parameters
|
95
105
|
----------
|
96
|
-
k :
|
97
|
-
List of k points.
|
106
|
+
k : numpy.ndarray
|
107
|
+
List of k points in reciprocal space.
|
98
108
|
|
99
109
|
Returns
|
100
110
|
-------
|
101
|
-
|
102
|
-
Hamiltonian
|
103
|
-
|
111
|
+
class `numpy.ndarray`
|
112
|
+
The Hamiltonian matrix evaluated at the provided k points.
|
104
113
|
"""
|
105
|
-
raise NotImplementedError
|
106
114
|
|
107
115
|
@abstractmethod
|
108
116
|
def hamiltonian_derivative(
|
109
117
|
self, k: npt.NDArray[np.float64], direction: str
|
110
|
-
) -> npt.NDArray[np.complex64]:
|
111
|
-
"""
|
112
|
-
Deriative of the Hamiltonian.
|
118
|
+
) -> npt.NDArray[np.complex64]: # pragma: no cover
|
119
|
+
"""Calculate the spatial derivative of the Hamiltonian.
|
113
120
|
|
114
121
|
Parameters
|
115
122
|
----------
|
116
|
-
k:
|
117
|
-
List of k points.
|
118
|
-
direction: str
|
119
|
-
Direction for derivative, either 'x'
|
123
|
+
k : numpy.ndarray
|
124
|
+
List of k points in reciprocal space.
|
125
|
+
direction : str
|
126
|
+
Direction for the derivative, either 'x' or 'y'.
|
120
127
|
|
121
128
|
Returns
|
122
129
|
-------
|
123
|
-
:class
|
124
|
-
|
125
|
-
|
130
|
+
:class: `numpy.ndarray`
|
131
|
+
The derivative of the Hamiltonian matrix in the specified direction.
|
126
132
|
"""
|
127
|
-
raise NotImplementedError
|
128
133
|
|
129
134
|
def save(self, filename: pathlib.Path) -> None:
|
130
|
-
"""
|
131
|
-
|
135
|
+
"""Save the Hamiltonian configuration as an HDF5 file.
|
136
|
+
|
137
|
+
This method stores Hamiltonian parameters and the delta orbital basis in
|
138
|
+
a specified HDF5 file format for later retrieval.
|
132
139
|
|
133
140
|
Parameters
|
134
141
|
----------
|
135
|
-
filename :
|
136
|
-
|
137
|
-
|
142
|
+
filename : class:`pathlib.Path`
|
143
|
+
The file path where the Hamiltonian will be saved. Must end with .hdf5.
|
138
144
|
"""
|
139
145
|
with h5py.File(f"{filename.absolute()}", "w") as f:
|
140
146
|
f.create_dataset("delta", data=self.delta_orbital_basis)
|
141
147
|
for key, value in vars(self).items():
|
142
|
-
if
|
143
|
-
f.attrs[key] = value
|
148
|
+
if key != "lattice":
|
149
|
+
f.attrs[key.strip("_")] = value
|
150
|
+
f.attrs["lattice_constant"] = self.lattice.lattice_constant
|
144
151
|
|
145
152
|
@classmethod
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
153
|
+
def from_file(cls: type[GenericHamiltonian], filename: pathlib.Path) -> GenericHamiltonian:
|
154
|
+
"""Initialize a Hamiltonian from a previously saved HDF5 file.
|
155
|
+
|
156
|
+
This class method allows users to reconstruct a Hamiltonian object
|
157
|
+
from saved attributes and matrix configurations stored in an HDF5 file.
|
150
158
|
|
151
159
|
Parameters
|
152
160
|
----------
|
153
161
|
filename : :class:`pathlib.Path`
|
154
|
-
|
162
|
+
The file path to the HDF5 file containing Hamiltonian data.
|
155
163
|
|
164
|
+
Returns
|
165
|
+
-------
|
166
|
+
class:`BaseHamiltonian[GenericParameters]`
|
167
|
+
An instance of the Hamiltonian initialized with data from the file.
|
156
168
|
"""
|
157
|
-
|
169
|
+
with h5py.File(str(filename), "r") as f:
|
170
|
+
config_dict = dict(f.attrs.items())
|
171
|
+
config_dict["delta"] = f["delta"][()]
|
158
172
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
173
|
+
parameters_model = cls.get_parameters_model()
|
174
|
+
parameters = parameters_model.model_validate(config_dict)
|
175
|
+
return cls(parameters=parameters)
|
176
|
+
|
177
|
+
def bdg_hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
178
|
+
"""Generate the Bogoliubov-de Gennes (BdG) Hamiltonian.
|
179
|
+
|
180
|
+
The BdG Hamiltonian incorporates pairing interactions and is used to
|
181
|
+
study superfluid and superconducting phases. This method constructs a
|
182
|
+
2x2 block Hamiltonian based on the normal state Hamiltonian and the
|
183
|
+
pairing terms.
|
164
184
|
|
165
185
|
Parameters
|
166
186
|
----------
|
167
|
-
q
|
168
187
|
k : :class:`numpy.ndarray`
|
169
|
-
List of k points.
|
188
|
+
List of k points in reciprocal space.
|
170
189
|
|
171
190
|
Returns
|
172
191
|
-------
|
173
192
|
:class:`numpy.ndarray`
|
174
|
-
BdG Hamiltonian.
|
175
|
-
|
193
|
+
The BdG Hamiltonian matrix evaluated at the specified k points.
|
176
194
|
"""
|
177
195
|
assert _check_valid_array(k)
|
178
196
|
if k.ndim == 1:
|
179
197
|
k = np.expand_dims(k, axis=0)
|
180
|
-
if q is None:
|
181
|
-
q = np.array([0, 0])
|
182
198
|
|
183
199
|
h = np.zeros(
|
184
200
|
(k.shape[0], 2 * self.number_of_bands, 2 * self.number_of_bands), dtype=np.complex64
|
@@ -189,7 +205,7 @@ class BaseHamiltonian(ABC):
|
|
189
205
|
:,
|
190
206
|
self.number_of_bands : 2 * self.number_of_bands,
|
191
207
|
self.number_of_bands : 2 * self.number_of_bands,
|
192
|
-
] = -self.hamiltonian(q - k).conjugate()
|
208
|
+
] = -self.hamiltonian(self.q - k).conjugate()
|
193
209
|
|
194
210
|
for i in range(self.number_of_bands):
|
195
211
|
h[:, self.number_of_bands + i, i] = self.delta_orbital_basis[i]
|
@@ -205,21 +221,22 @@ class BaseHamiltonian(ABC):
|
|
205
221
|
def bdg_hamiltonian_derivative(
|
206
222
|
self, k: npt.NDArray[np.float64], direction: str
|
207
223
|
) -> npt.NDArray[np.complex64]:
|
208
|
-
"""
|
209
|
-
|
224
|
+
"""Calculate the derivative of the BdG Hamiltonian.
|
225
|
+
|
226
|
+
This method computes the spatial derivative of the Bogoliubov-de Gennes
|
227
|
+
Hamiltonian with respect to the specified direction.
|
210
228
|
|
211
229
|
Parameters
|
212
230
|
----------
|
213
|
-
k: :class:`numpy.ndarray`
|
214
|
-
List of k points.
|
215
|
-
direction: str
|
216
|
-
Direction for derivative, either 'x'
|
231
|
+
k : :class:`numpy.ndarray`
|
232
|
+
List of k points in reciprocal space.
|
233
|
+
direction : str
|
234
|
+
Direction for the derivative, either 'x' or 'y'.
|
217
235
|
|
218
236
|
Returns
|
219
237
|
-------
|
220
238
|
:class:`numpy.ndarray`
|
221
|
-
|
222
|
-
|
239
|
+
The derivative of the BdG Hamiltonian matrix in the specified direction.
|
223
240
|
"""
|
224
241
|
assert _check_valid_array(k)
|
225
242
|
if k.ndim == 1:
|
@@ -243,21 +260,23 @@ class BaseHamiltonian(ABC):
|
|
243
260
|
def diagonalize_nonint(
|
244
261
|
self, k: npt.NDArray[np.float64]
|
245
262
|
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
|
246
|
-
"""
|
247
|
-
|
263
|
+
"""Diagonalizes the normal state Hamiltonian.
|
264
|
+
|
265
|
+
This method computes the eigenvalues and eigenvectors of the normal state
|
266
|
+
Hamiltonian for the given k points. It is essential for analyzing the
|
267
|
+
electronic properties and band structure of materials.
|
248
268
|
|
249
269
|
Parameters
|
250
270
|
----------
|
251
271
|
k : :class:`numpy.ndarray`
|
252
|
-
List of k points.
|
272
|
+
List of k points in reciprocal space.
|
253
273
|
|
254
274
|
Returns
|
255
275
|
-------
|
256
|
-
|
257
|
-
Eigenvalues of the normal state Hamiltonian.
|
258
|
-
|
259
|
-
|
260
|
-
|
276
|
+
tuple
|
277
|
+
- :class:`numpy.ndarray`: Eigenvalues of the normal state Hamiltonian.
|
278
|
+
- :class:`numpy.ndarray`: Eigenvectors (Bloch wavefunctions) corresponding to
|
279
|
+
the eigenvalues.
|
261
280
|
"""
|
262
281
|
k_point_matrix = self.hamiltonian(k)
|
263
282
|
if k_point_matrix.ndim == 2:
|
@@ -276,26 +295,28 @@ class BaseHamiltonian(ABC):
|
|
276
295
|
return band_energies.squeeze(), bloch_wavefunctions.squeeze()
|
277
296
|
|
278
297
|
def diagonalize_bdg(
|
279
|
-
self,
|
298
|
+
self,
|
299
|
+
k: npt.NDArray[np.float64],
|
280
300
|
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex64]]:
|
281
|
-
"""
|
282
|
-
|
301
|
+
"""Diagonalizes the BdG Hamiltonian.
|
302
|
+
|
303
|
+
This method computes the eigenvalues and eigenvectors of the Bogoliubov-de
|
304
|
+
Gennes Hamiltonian, providing insight into the quasiparticle excitations in
|
305
|
+
superconducting states.
|
283
306
|
|
284
307
|
Parameters
|
285
308
|
----------
|
286
|
-
q
|
287
309
|
k : :class:`numpy.ndarray`
|
288
|
-
List of k points.
|
310
|
+
List of k points in reciprocal space.
|
289
311
|
|
290
312
|
Returns
|
291
313
|
-------
|
292
|
-
|
293
|
-
Eigenvalues of the BdG Hamiltonian.
|
294
|
-
|
295
|
-
|
296
|
-
|
314
|
+
tuple
|
315
|
+
- :class:`numpy.ndarray`: Eigenvalues of the BdG Hamiltonian.
|
316
|
+
- :class:`numpy.ndarray`: Eigenvectors corresponding to the eigenvalues of the
|
317
|
+
BdG Hamiltonian.
|
297
318
|
"""
|
298
|
-
bdg_matrix = self.bdg_hamiltonian(k=k
|
319
|
+
bdg_matrix = self.bdg_hamiltonian(k=k)
|
299
320
|
if bdg_matrix.ndim == 2:
|
300
321
|
bdg_matrix = np.expand_dims(bdg_matrix, axis=0)
|
301
322
|
k = np.expand_dims(k, axis=0)
|
@@ -312,47 +333,41 @@ class BaseHamiltonian(ABC):
|
|
312
333
|
return bdg_energies.squeeze(), bdg_wavefunctions.squeeze()
|
313
334
|
|
314
335
|
def gap_equation(
|
315
|
-
self,
|
336
|
+
self,
|
337
|
+
k: npt.NDArray[np.float64],
|
316
338
|
) -> npt.NDArray[np.complex64]:
|
317
|
-
"""
|
339
|
+
"""Calculate the gap equation.
|
340
|
+
|
341
|
+
The gap equation determines the order parameter for superconductivity by
|
342
|
+
relating the pairings to the spectral properties of the BdG Hamiltonian.
|
318
343
|
|
319
344
|
Parameters
|
320
345
|
----------
|
321
|
-
|
322
|
-
|
323
|
-
k
|
346
|
+
k : :class:`numpy.ndarray`
|
347
|
+
List of k points in reciprocal space.
|
324
348
|
|
325
349
|
Returns
|
326
350
|
-------
|
327
351
|
:class:`numpy.ndarray`
|
328
|
-
New gap in orbital basis.
|
329
|
-
|
330
|
-
|
352
|
+
New pairing gap in orbital basis, adjusted to remove global phase.
|
331
353
|
"""
|
332
|
-
|
333
|
-
q = np.array([0, 0])
|
334
|
-
bdg_energies, bdg_wavefunctions = self.diagonalize_bdg(k=k, q=q)
|
335
|
-
bdg_energies_minus_k, _ = self.diagonalize_bdg(k=-k, q=-q)
|
354
|
+
bdg_energies, bdg_wavefunctions = self.diagonalize_bdg(k=k)
|
336
355
|
delta = np.zeros(self.number_of_bands, dtype=np.complex64)
|
337
356
|
|
338
357
|
for i in range(self.number_of_bands):
|
339
358
|
sum_tmp = 0
|
340
|
-
for j in range(self.number_of_bands):
|
359
|
+
for j in range(2 * self.number_of_bands):
|
341
360
|
for k_index in range(len(k)):
|
342
|
-
sum_tmp +=
|
343
|
-
k_index, i
|
344
|
-
|
345
|
-
bdg_energies[k_index, j
|
346
|
-
) + np.conjugate(
|
347
|
-
bdg_wavefunctions[k_index, i, j + self.number_of_bands]
|
348
|
-
) * bdg_wavefunctions[
|
349
|
-
k_index, i + self.number_of_bands, j + self.number_of_bands
|
350
|
-
] * _fermi_dirac(
|
351
|
-
-bdg_energies_minus_k[k_index, j + self.number_of_bands].item(), beta
|
361
|
+
sum_tmp += (
|
362
|
+
np.conjugate(bdg_wavefunctions[k_index, i, j])
|
363
|
+
* bdg_wavefunctions[k_index, i + self.number_of_bands, j]
|
364
|
+
* _fermi_dirac(bdg_energies[k_index, j].item(), self.beta)
|
352
365
|
)
|
353
366
|
delta[i] = (-self.hubbard_int_orbital_basis[i] * sum_tmp / len(k)).conjugate()
|
354
367
|
|
355
|
-
delta_without_phase: npt.NDArray[np.complex64] = delta * np.exp(
|
368
|
+
delta_without_phase: npt.NDArray[np.complex64] = delta * np.exp(
|
369
|
+
-1j * np.angle(delta[np.argmax(np.abs(delta))])
|
370
|
+
)
|
356
371
|
return delta_without_phase
|
357
372
|
|
358
373
|
def calculate_bandstructure(
|
@@ -360,21 +375,24 @@ class BaseHamiltonian(ABC):
|
|
360
375
|
k: npt.NDArray[np.float64],
|
361
376
|
overlaps: tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]] | None = None,
|
362
377
|
) -> pd.DataFrame:
|
363
|
-
"""
|
364
|
-
|
378
|
+
"""Calculate the band structure.
|
379
|
+
|
380
|
+
This method computes the energy bands of the system by diagonalizing
|
381
|
+
the normal state Hamiltonian over the provided k points. It can also
|
382
|
+
calculate overlaps with provided wavefunctions if available.
|
365
383
|
|
366
384
|
Parameters
|
367
385
|
----------
|
368
386
|
k : :class:`numpy.ndarray`
|
369
|
-
List of k points.
|
387
|
+
List of k points in reciprocal space.
|
370
388
|
overlaps : tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`), optional
|
371
|
-
|
389
|
+
A tuple containing two sets of wavefunctions for overlap calculations.
|
372
390
|
|
373
391
|
Returns
|
374
392
|
-------
|
375
393
|
`pandas.DataFrame`
|
376
|
-
|
377
|
-
|
394
|
+
A DataFrame containing the calculated band energies with optional
|
395
|
+
overlap information.
|
378
396
|
"""
|
379
397
|
results = pd.DataFrame(
|
380
398
|
index=range(len(k)),
|
@@ -400,22 +418,25 @@ class BaseHamiltonian(ABC):
|
|
400
418
|
def calculate_density_of_states(
|
401
419
|
self,
|
402
420
|
k: npt.NDArray[np.float64],
|
403
|
-
q: npt.NDArray[np.float64] | None = None,
|
404
421
|
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
|
405
|
-
"""Calculate the density of states.
|
422
|
+
"""Calculate the density of states (DOS).
|
423
|
+
|
424
|
+
This method computes the density of states by evaluating the eigenvalues
|
425
|
+
of the BdG Hamiltonian over a specified energy range. The DOS provides
|
426
|
+
insights into the allowed energy levels of the system.
|
406
427
|
|
407
428
|
Parameters
|
408
429
|
----------
|
409
|
-
|
410
|
-
|
411
|
-
energies
|
430
|
+
k : :class:`numpy.ndarray`
|
431
|
+
List of k points in reciprocal space.
|
412
432
|
|
413
433
|
Returns
|
414
434
|
-------
|
415
|
-
|
416
|
-
|
435
|
+
tuple
|
436
|
+
- numpy.ndarray: Energy levels over which the density of states is calculated.
|
437
|
+
- numpy.ndarray: The density of states corresponding to each energy level.
|
417
438
|
"""
|
418
|
-
bands, _ = self.diagonalize_bdg(k=k
|
439
|
+
bands, _ = self.diagonalize_bdg(k=k)
|
419
440
|
energies = np.linspace(start=np.min(bands), stop=np.max(bands), num=5000)
|
420
441
|
density_of_states = np.zeros(shape=energies.shape, dtype=np.float64)
|
421
442
|
|
@@ -425,22 +446,25 @@ class BaseHamiltonian(ABC):
|
|
425
446
|
) / len(k)
|
426
447
|
return energies, density_of_states
|
427
448
|
|
428
|
-
def calculate_spectral_gap(
|
429
|
-
self, k: npt.NDArray[np.float64], q: npt.NDArray[np.float64] | None = None
|
430
|
-
) -> float:
|
449
|
+
def calculate_spectral_gap(self, k: npt.NDArray[np.float64]) -> float:
|
431
450
|
"""Calculate the spectral gap.
|
432
451
|
|
452
|
+
This method evaluates the spectral gap of the system by examining the
|
453
|
+
density of states. It identifies the range of energy where there are no
|
454
|
+
states and thus determines the energy difference between the highest
|
455
|
+
occupied and lowest unoccupied states.
|
456
|
+
|
433
457
|
Parameters
|
434
458
|
----------
|
435
|
-
k
|
436
|
-
|
459
|
+
k : :class:`numpy.ndarray`
|
460
|
+
List of k points in reciprocal space.
|
437
461
|
|
438
462
|
Returns
|
439
463
|
-------
|
440
|
-
|
441
|
-
|
464
|
+
float
|
465
|
+
The calculated spectral gap.
|
442
466
|
"""
|
443
|
-
energies, density_of_states = self.calculate_density_of_states(k=k
|
467
|
+
energies, density_of_states = self.calculate_density_of_states(k=k)
|
444
468
|
|
445
469
|
coherence_peaks = np.where(np.isclose(density_of_states, np.max(density_of_states)))[0]
|
446
470
|
|
@@ -466,6 +490,8 @@ def _gaussian(x: npt.NDArray[np.float64], sigma: float) -> npt.NDArray[np.float6
|
|
466
490
|
return gaussian
|
467
491
|
|
468
492
|
|
469
|
-
def _fermi_dirac(energy:
|
470
|
-
fermi_dirac:
|
493
|
+
def _fermi_dirac(energy: float, beta: float | None) -> float:
|
494
|
+
fermi_dirac: float = (
|
495
|
+
(1 if energy < 0 else 0) if beta is None else 1 / (1 + np.exp(beta * energy))
|
496
|
+
)
|
471
497
|
return fermi_dirac
|