quant-met 0.0.9__py3-none-any.whl → 0.0.11__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 +36 -5
- quant_met/geometry/__init__.py +1 -1
- quant_met/mean_field/__init__.py +3 -5
- quant_met/mean_field/hamiltonians/__init__.py +4 -2
- quant_met/mean_field/hamiltonians/base_hamiltonian.py +171 -78
- quant_met/mean_field/hamiltonians/dressed_graphene.py +4 -36
- quant_met/mean_field/hamiltonians/graphene.py +4 -36
- quant_met/mean_field/hamiltonians/one_band_tight_binding.py +6 -38
- quant_met/mean_field/hamiltonians/three_band_tight_binding.py +5 -37
- quant_met/mean_field/hamiltonians/two_band_tight_binding.py +5 -37
- quant_met/mean_field/quantum_metric.py +22 -62
- quant_met/mean_field/self_consistency.py +60 -6
- quant_met/mean_field/superfluid_weight.py +6 -6
- quant_met/parameters/__init__.py +19 -7
- quant_met/parameters/hamiltonians.py +49 -4
- quant_met/parameters/main.py +35 -3
- quant_met/plotting/__init__.py +0 -3
- quant_met/plotting/plotting.py +0 -34
- {quant_met-0.0.9.dist-info → quant_met-0.0.11.dist-info}/METADATA +5 -41
- quant_met-0.0.11.dist-info/RECORD +33 -0
- quant_met-0.0.9.dist-info/RECORD +0 -33
- {quant_met-0.0.9.dist-info → quant_met-0.0.11.dist-info}/LICENSE.txt +0 -0
- {quant_met-0.0.9.dist-info → quant_met-0.0.11.dist-info}/LICENSES/MIT.txt +0 -0
- {quant_met-0.0.9.dist-info → quant_met-0.0.11.dist-info}/WHEEL +0 -0
- {quant_met-0.0.9.dist-info → quant_met-0.0.11.dist-info}/entry_points.txt +0 -0
quant_met/cli/__init__.py
CHANGED
@@ -3,11 +3,8 @@
|
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
5
|
"""
|
6
|
-
Command-Line-Interface
|
7
|
-
|
8
|
-
|
9
|
-
Functions
|
10
|
-
---------
|
6
|
+
Command-Line-Interface
|
7
|
+
======================
|
11
8
|
|
12
9
|
.. autosummary::
|
13
10
|
:toctree: generated/
|
quant_met/cli/main.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
"""Command line interface."""
|
6
6
|
|
7
|
+
import logging
|
7
8
|
import sys
|
8
9
|
from typing import TextIO
|
9
10
|
|
@@ -14,21 +15,47 @@ from quant_met.parameters import Parameters
|
|
14
15
|
|
15
16
|
from .scf import scf
|
16
17
|
|
18
|
+
logger = logging.getLogger(__name__)
|
19
|
+
|
17
20
|
|
18
21
|
@click.command()
|
19
22
|
@click.argument("input-file", type=click.File("r"))
|
20
|
-
|
23
|
+
@click.option("--debug", is_flag=True, help="Enable debug logging.")
|
24
|
+
def cli(input_file: TextIO, *, debug: bool) -> None:
|
21
25
|
"""Command line interface for quant-met.
|
22
26
|
|
23
27
|
Parameters
|
24
28
|
----------
|
25
|
-
input_file
|
29
|
+
input_file: TextIO
|
30
|
+
A file object containing YAML formatted parameters for the simulation.
|
31
|
+
debug : bool
|
32
|
+
If set, enables debug logging instead of the default info logging.
|
33
|
+
|
34
|
+
This command reads the parameters from the specified file and runs the
|
35
|
+
desired calculation based on the provided parameters.
|
26
36
|
"""
|
37
|
+
if debug:
|
38
|
+
logging.basicConfig(
|
39
|
+
level=logging.DEBUG,
|
40
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
41
|
+
stream=sys.stdout,
|
42
|
+
)
|
43
|
+
logger.setLevel(logging.DEBUG)
|
44
|
+
logger.info("Debug logging is enabled.")
|
45
|
+
else:
|
46
|
+
logging.basicConfig(
|
47
|
+
level=logging.INFO,
|
48
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
49
|
+
stream=sys.stdout,
|
50
|
+
)
|
51
|
+
|
27
52
|
params = Parameters(**yaml.safe_load(input_file))
|
53
|
+
logger.info("Loaded parameters successfully.")
|
28
54
|
|
29
55
|
match params.control.calculation:
|
30
56
|
case "scf":
|
57
|
+
logger.info("Starting SCF calculation.")
|
31
58
|
scf(params)
|
32
59
|
case _:
|
33
|
-
|
60
|
+
logger.error("Calculation %s not found.", params.control.calculation)
|
34
61
|
sys.exit(1)
|
quant_met/cli/scf.py
CHANGED
@@ -4,18 +4,34 @@
|
|
4
4
|
|
5
5
|
"""Functions to run self-consistent calculation for the order parameter."""
|
6
6
|
|
7
|
+
import logging
|
7
8
|
from pathlib import Path
|
8
9
|
|
9
10
|
from quant_met import mean_field
|
10
11
|
from quant_met.mean_field.hamiltonians import BaseHamiltonian
|
11
|
-
from quant_met.parameters import Parameters
|
12
|
-
|
12
|
+
from quant_met.parameters import HamiltonianParameters, Parameters
|
13
|
+
|
14
|
+
logger = logging.getLogger(__name__)
|
13
15
|
|
14
16
|
|
15
17
|
def _hamiltonian_factory(
|
16
18
|
classname: str, parameters: HamiltonianParameters
|
17
19
|
) -> BaseHamiltonian[HamiltonianParameters]:
|
18
|
-
"""Create a
|
20
|
+
"""Create a Hamiltonian by its class name.
|
21
|
+
|
22
|
+
Parameters
|
23
|
+
----------
|
24
|
+
classname: str
|
25
|
+
The name of the Hamiltonian class to instantiate.
|
26
|
+
parameters: HamiltonianParameters
|
27
|
+
An instance of HamiltonianParameters containing all necessary
|
28
|
+
configuration for the specific Hamiltonian.
|
29
|
+
|
30
|
+
Returns
|
31
|
+
-------
|
32
|
+
BaseHamiltonian[HamiltonianParameters]
|
33
|
+
An instance of the specified Hamiltonian class.
|
34
|
+
"""
|
19
35
|
from quant_met.mean_field import hamiltonians
|
20
36
|
|
21
37
|
cls = getattr(hamiltonians, classname)
|
@@ -24,10 +40,21 @@ def _hamiltonian_factory(
|
|
24
40
|
|
25
41
|
|
26
42
|
def scf(parameters: Parameters) -> None:
|
27
|
-
"""Self-consistent calculation for the order parameter.
|
43
|
+
"""Self-consistent calculation for the order parameter.
|
44
|
+
|
45
|
+
Parameters
|
46
|
+
----------
|
47
|
+
parameters: Parameters
|
48
|
+
An instance of Parameters containing control settings, the model,
|
49
|
+
and k-point specifications for the self-consistency calculation.
|
50
|
+
"""
|
28
51
|
result_path = Path(parameters.control.outdir)
|
29
52
|
result_path.mkdir(exist_ok=True, parents=True)
|
53
|
+
|
54
|
+
logger.info("Initializing Hamiltonian factory.")
|
30
55
|
h = _hamiltonian_factory(parameters=parameters.model, classname=parameters.model.name)
|
56
|
+
|
57
|
+
logger.info("Starting self-consistency loop.")
|
31
58
|
solved_h = mean_field.self_consistency_loop(
|
32
59
|
h=h,
|
33
60
|
k_space_grid=h.lattice.generate_bz_grid(
|
@@ -35,6 +62,10 @@ def scf(parameters: Parameters) -> None:
|
|
35
62
|
),
|
36
63
|
epsilon=parameters.control.conv_treshold,
|
37
64
|
)
|
38
|
-
|
65
|
+
|
66
|
+
logger.info("Self-consistency loop completed successfully.")
|
67
|
+
logger.debug("Obtained delta values: %s", solved_h.delta_orbital_basis)
|
68
|
+
|
39
69
|
result_file = result_path / f"{parameters.control.prefix}.hdf5"
|
40
70
|
solved_h.save(filename=result_file)
|
71
|
+
logger.info("Results saved to %s", result_file)
|
quant_met/geometry/__init__.py
CHANGED
quant_met/mean_field/__init__.py
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
5
|
"""
|
6
|
-
Mean field
|
7
|
-
|
6
|
+
Mean field
|
7
|
+
==========
|
8
8
|
|
9
9
|
Submodules
|
10
10
|
----------
|
@@ -23,20 +23,18 @@ Functions
|
|
23
23
|
|
24
24
|
superfluid_weight
|
25
25
|
quantum_metric
|
26
|
-
quantum_metric_bdg
|
27
26
|
self_consistency_loop
|
28
27
|
""" # noqa: D205, D400
|
29
28
|
|
30
29
|
from quant_met.mean_field import hamiltonians
|
31
30
|
|
32
|
-
from .quantum_metric import quantum_metric
|
31
|
+
from .quantum_metric import quantum_metric
|
33
32
|
from .self_consistency import self_consistency_loop
|
34
33
|
from .superfluid_weight import superfluid_weight
|
35
34
|
|
36
35
|
__all__ = [
|
37
36
|
"superfluid_weight",
|
38
37
|
"quantum_metric",
|
39
|
-
"quantum_metric_bdg",
|
40
38
|
"self_consistency_loop",
|
41
39
|
"hamiltonians",
|
42
40
|
]
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
5
|
"""
|
6
|
-
|
7
|
-
|
6
|
+
hamiltonians
|
7
|
+
============
|
8
8
|
|
9
9
|
Base
|
10
10
|
|
@@ -19,6 +19,8 @@ Base
|
|
19
19
|
Graphene
|
20
20
|
DressedGraphene
|
21
21
|
OneBand
|
22
|
+
TwoBand
|
23
|
+
ThreeBand
|
22
24
|
""" # noqa: D205, D400
|
23
25
|
|
24
26
|
from .base_hamiltonian import BaseHamiltonian
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
import pathlib
|
8
8
|
from abc import ABC, abstractmethod
|
9
|
-
from typing import Generic
|
9
|
+
from typing import Generic, TypeVar
|
10
10
|
|
11
11
|
import h5py
|
12
12
|
import numpy as np
|
@@ -15,15 +15,50 @@ import pandas as pd
|
|
15
15
|
|
16
16
|
from quant_met.geometry import BaseLattice
|
17
17
|
from quant_met.mean_field._utils import _check_valid_array
|
18
|
-
from quant_met.parameters.hamiltonians import GenericParameters
|
18
|
+
from quant_met.parameters.hamiltonians import GenericParameters, HamiltonianParameters
|
19
|
+
|
20
|
+
GenericHamiltonian = TypeVar("GenericHamiltonian", bound="BaseHamiltonian[HamiltonianParameters]")
|
19
21
|
|
20
22
|
|
21
23
|
class BaseHamiltonian(Generic[GenericParameters], ABC):
|
22
|
-
"""Base class for Hamiltonians.
|
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
|
+
"""
|
23
58
|
|
24
59
|
def __init__(self, parameters: GenericParameters) -> None:
|
25
60
|
self.name = parameters.name
|
26
|
-
self.beta = parameters.beta
|
61
|
+
self.beta = parameters.beta
|
27
62
|
self.q = parameters.q if parameters.q is not None else np.zeros(2)
|
28
63
|
|
29
64
|
self.lattice = self.setup_lattice(parameters)
|
@@ -33,62 +68,79 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
33
68
|
|
34
69
|
@abstractmethod
|
35
70
|
def setup_lattice(self, parameters: GenericParameters) -> BaseLattice: # pragma: no cover
|
36
|
-
"""Set up lattice based on parameters.
|
71
|
+
"""Set up the lattice based on the provided parameters.
|
72
|
+
|
73
|
+
Parameters
|
74
|
+
----------
|
75
|
+
parameters : GenericParameters
|
76
|
+
Input parameters containing necessary information for lattice construction.
|
77
|
+
|
78
|
+
Returns
|
79
|
+
-------
|
80
|
+
BaseLattice
|
81
|
+
An instance of a lattice object configured according to the input parameters.
|
82
|
+
"""
|
37
83
|
|
38
84
|
@classmethod
|
39
85
|
@abstractmethod
|
40
86
|
def get_parameters_model(cls) -> type[GenericParameters]: # pragma: no cover
|
41
|
-
"""Return the specific parameters model for the subclass.
|
87
|
+
"""Return the specific parameters model for the subclass.
|
88
|
+
|
89
|
+
This method should provide the structure of parameters required by
|
90
|
+
subclasses to initialize the Hamiltonian.
|
91
|
+
|
92
|
+
Returns
|
93
|
+
-------
|
94
|
+
type
|
95
|
+
The parameters model class type specific to the Hamiltonian subclass.
|
96
|
+
"""
|
42
97
|
|
43
98
|
@abstractmethod
|
44
99
|
def hamiltonian(
|
45
100
|
self, k: npt.NDArray[np.float64]
|
46
101
|
) -> npt.NDArray[np.complex64]: # pragma: no cover
|
47
|
-
"""
|
48
|
-
Return the normal state Hamiltonian in orbital basis.
|
102
|
+
"""Return the normal state Hamiltonian.
|
49
103
|
|
50
104
|
Parameters
|
51
105
|
----------
|
52
|
-
k :
|
53
|
-
List of k points.
|
106
|
+
k : numpy.ndarray
|
107
|
+
List of k points in reciprocal space.
|
54
108
|
|
55
109
|
Returns
|
56
110
|
-------
|
57
|
-
|
58
|
-
Hamiltonian
|
59
|
-
|
111
|
+
class `numpy.ndarray`
|
112
|
+
The Hamiltonian matrix evaluated at the provided k points.
|
60
113
|
"""
|
61
114
|
|
62
115
|
@abstractmethod
|
63
116
|
def hamiltonian_derivative(
|
64
117
|
self, k: npt.NDArray[np.float64], direction: str
|
65
118
|
) -> npt.NDArray[np.complex64]: # pragma: no cover
|
66
|
-
"""
|
67
|
-
Deriative of the Hamiltonian.
|
119
|
+
"""Calculate the spatial derivative of the Hamiltonian.
|
68
120
|
|
69
121
|
Parameters
|
70
122
|
----------
|
71
|
-
k:
|
72
|
-
List of k points.
|
73
|
-
direction: str
|
74
|
-
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'.
|
75
127
|
|
76
128
|
Returns
|
77
129
|
-------
|
78
|
-
:class
|
79
|
-
|
80
|
-
|
130
|
+
:class: `numpy.ndarray`
|
131
|
+
The derivative of the Hamiltonian matrix in the specified direction.
|
81
132
|
"""
|
82
133
|
|
83
134
|
def save(self, filename: pathlib.Path) -> None:
|
84
|
-
"""
|
85
|
-
|
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.
|
86
139
|
|
87
140
|
Parameters
|
88
141
|
----------
|
89
|
-
filename :
|
90
|
-
|
91
|
-
|
142
|
+
filename : class:`pathlib.Path`
|
143
|
+
The file path where the Hamiltonian will be saved. Must end with .hdf5.
|
92
144
|
"""
|
93
145
|
with h5py.File(f"{filename.absolute()}", "w") as f:
|
94
146
|
f.create_dataset("delta", data=self.delta_orbital_basis)
|
@@ -98,8 +150,22 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
98
150
|
f.attrs["lattice_constant"] = self.lattice.lattice_constant
|
99
151
|
|
100
152
|
@classmethod
|
101
|
-
def from_file(cls, filename: pathlib.Path) ->
|
102
|
-
"""Initialize a Hamiltonian from
|
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.
|
158
|
+
|
159
|
+
Parameters
|
160
|
+
----------
|
161
|
+
filename : :class:`pathlib.Path`
|
162
|
+
The file path to the HDF5 file containing Hamiltonian data.
|
163
|
+
|
164
|
+
Returns
|
165
|
+
-------
|
166
|
+
class:`BaseHamiltonian[GenericParameters]`
|
167
|
+
An instance of the Hamiltonian initialized with data from the file.
|
168
|
+
"""
|
103
169
|
with h5py.File(str(filename), "r") as f:
|
104
170
|
config_dict = dict(f.attrs.items())
|
105
171
|
config_dict["delta"] = f["delta"][()]
|
@@ -109,19 +175,22 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
109
175
|
return cls(parameters=parameters)
|
110
176
|
|
111
177
|
def bdg_hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
112
|
-
"""
|
113
|
-
|
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.
|
114
184
|
|
115
185
|
Parameters
|
116
186
|
----------
|
117
187
|
k : :class:`numpy.ndarray`
|
118
|
-
List of k points.
|
188
|
+
List of k points in reciprocal space.
|
119
189
|
|
120
190
|
Returns
|
121
191
|
-------
|
122
192
|
:class:`numpy.ndarray`
|
123
|
-
BdG Hamiltonian.
|
124
|
-
|
193
|
+
The BdG Hamiltonian matrix evaluated at the specified k points.
|
125
194
|
"""
|
126
195
|
assert _check_valid_array(k)
|
127
196
|
if k.ndim == 1:
|
@@ -152,21 +221,22 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
152
221
|
def bdg_hamiltonian_derivative(
|
153
222
|
self, k: npt.NDArray[np.float64], direction: str
|
154
223
|
) -> npt.NDArray[np.complex64]:
|
155
|
-
"""
|
156
|
-
|
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.
|
157
228
|
|
158
229
|
Parameters
|
159
230
|
----------
|
160
|
-
k: :class:`numpy.ndarray`
|
161
|
-
List of k points.
|
162
|
-
direction: str
|
163
|
-
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'.
|
164
235
|
|
165
236
|
Returns
|
166
237
|
-------
|
167
238
|
:class:`numpy.ndarray`
|
168
|
-
|
169
|
-
|
239
|
+
The derivative of the BdG Hamiltonian matrix in the specified direction.
|
170
240
|
"""
|
171
241
|
assert _check_valid_array(k)
|
172
242
|
if k.ndim == 1:
|
@@ -190,21 +260,23 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
190
260
|
def diagonalize_nonint(
|
191
261
|
self, k: npt.NDArray[np.float64]
|
192
262
|
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
|
193
|
-
"""
|
194
|
-
|
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.
|
195
268
|
|
196
269
|
Parameters
|
197
270
|
----------
|
198
271
|
k : :class:`numpy.ndarray`
|
199
|
-
List of k points.
|
272
|
+
List of k points in reciprocal space.
|
200
273
|
|
201
274
|
Returns
|
202
275
|
-------
|
203
|
-
|
204
|
-
Eigenvalues of the normal state Hamiltonian.
|
205
|
-
|
206
|
-
|
207
|
-
|
276
|
+
tuple
|
277
|
+
- :class:`numpy.ndarray`: Eigenvalues of the normal state Hamiltonian.
|
278
|
+
- :class:`numpy.ndarray`: Eigenvectors (Bloch wavefunctions) corresponding to
|
279
|
+
the eigenvalues.
|
208
280
|
"""
|
209
281
|
k_point_matrix = self.hamiltonian(k)
|
210
282
|
if k_point_matrix.ndim == 2:
|
@@ -226,21 +298,23 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
226
298
|
self,
|
227
299
|
k: npt.NDArray[np.float64],
|
228
300
|
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.complex64]]:
|
229
|
-
"""
|
230
|
-
|
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.
|
231
306
|
|
232
307
|
Parameters
|
233
308
|
----------
|
234
309
|
k : :class:`numpy.ndarray`
|
235
|
-
List of k points.
|
310
|
+
List of k points in reciprocal space.
|
236
311
|
|
237
312
|
Returns
|
238
313
|
-------
|
239
|
-
|
240
|
-
Eigenvalues of the BdG Hamiltonian.
|
241
|
-
|
242
|
-
|
243
|
-
|
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.
|
244
318
|
"""
|
245
319
|
bdg_matrix = self.bdg_hamiltonian(k=k)
|
246
320
|
if bdg_matrix.ndim == 2:
|
@@ -262,18 +336,20 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
262
336
|
self,
|
263
337
|
k: npt.NDArray[np.float64],
|
264
338
|
) -> npt.NDArray[np.complex64]:
|
265
|
-
"""
|
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.
|
266
343
|
|
267
344
|
Parameters
|
268
345
|
----------
|
269
|
-
k
|
346
|
+
k : :class:`numpy.ndarray`
|
347
|
+
List of k points in reciprocal space.
|
270
348
|
|
271
349
|
Returns
|
272
350
|
-------
|
273
351
|
:class:`numpy.ndarray`
|
274
|
-
New gap in orbital basis.
|
275
|
-
|
276
|
-
|
352
|
+
New pairing gap in orbital basis, adjusted to remove global phase.
|
277
353
|
"""
|
278
354
|
bdg_energies, bdg_wavefunctions = self.diagonalize_bdg(k=k)
|
279
355
|
delta = np.zeros(self.number_of_bands, dtype=np.complex64)
|
@@ -299,21 +375,24 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
299
375
|
k: npt.NDArray[np.float64],
|
300
376
|
overlaps: tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]] | None = None,
|
301
377
|
) -> pd.DataFrame:
|
302
|
-
"""
|
303
|
-
|
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.
|
304
383
|
|
305
384
|
Parameters
|
306
385
|
----------
|
307
386
|
k : :class:`numpy.ndarray`
|
308
|
-
List of k points.
|
387
|
+
List of k points in reciprocal space.
|
309
388
|
overlaps : tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`), optional
|
310
|
-
|
389
|
+
A tuple containing two sets of wavefunctions for overlap calculations.
|
311
390
|
|
312
391
|
Returns
|
313
392
|
-------
|
314
393
|
`pandas.DataFrame`
|
315
|
-
|
316
|
-
|
394
|
+
A DataFrame containing the calculated band energies with optional
|
395
|
+
overlap information.
|
317
396
|
"""
|
318
397
|
results = pd.DataFrame(
|
319
398
|
index=range(len(k)),
|
@@ -340,16 +419,22 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
340
419
|
self,
|
341
420
|
k: npt.NDArray[np.float64],
|
342
421
|
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
|
343
|
-
"""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.
|
344
427
|
|
345
428
|
Parameters
|
346
429
|
----------
|
347
|
-
k
|
430
|
+
k : :class:`numpy.ndarray`
|
431
|
+
List of k points in reciprocal space.
|
348
432
|
|
349
433
|
Returns
|
350
434
|
-------
|
351
|
-
|
352
|
-
|
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.
|
353
438
|
"""
|
354
439
|
bands, _ = self.diagonalize_bdg(k=k)
|
355
440
|
energies = np.linspace(start=np.min(bands), stop=np.max(bands), num=5000)
|
@@ -364,14 +449,20 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
|
|
364
449
|
def calculate_spectral_gap(self, k: npt.NDArray[np.float64]) -> float:
|
365
450
|
"""Calculate the spectral gap.
|
366
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
|
+
|
367
457
|
Parameters
|
368
458
|
----------
|
369
|
-
k
|
459
|
+
k : :class:`numpy.ndarray`
|
460
|
+
List of k points in reciprocal space.
|
370
461
|
|
371
462
|
Returns
|
372
463
|
-------
|
373
|
-
|
374
|
-
|
464
|
+
float
|
465
|
+
The calculated spectral gap.
|
375
466
|
"""
|
376
467
|
energies, density_of_states = self.calculate_density_of_states(k=k)
|
377
468
|
|
@@ -399,6 +490,8 @@ def _gaussian(x: npt.NDArray[np.float64], sigma: float) -> npt.NDArray[np.float6
|
|
399
490
|
return gaussian
|
400
491
|
|
401
492
|
|
402
|
-
def _fermi_dirac(energy: float, beta: float) -> float:
|
403
|
-
fermi_dirac: float =
|
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
|
+
)
|
404
497
|
return fermi_dirac
|