quant-met 0.0.9__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 +35 -3
- 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 +16 -56
- quant_met/mean_field/self_consistency.py +49 -6
- quant_met/parameters/__init__.py +11 -3
- quant_met/parameters/hamiltonians.py +33 -3
- 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.10.dist-info}/METADATA +1 -1
- quant_met-0.0.10.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.10.dist-info}/LICENSE.txt +0 -0
- {quant_met-0.0.9.dist-info → quant_met-0.0.10.dist-info}/LICENSES/MIT.txt +0 -0
- {quant_met-0.0.9.dist-info → quant_met-0.0.10.dist-info}/WHEEL +0 -0
- {quant_met-0.0.9.dist-info → quant_met-0.0.10.dist-info}/entry_points.txt +0 -0
@@ -28,30 +28,14 @@ class DressedGraphene(BaseHamiltonian[DressedGrapheneParameters]):
|
|
28
28
|
if parameters.delta is not None:
|
29
29
|
self.delta_orbital_basis = np.astype(parameters.delta, np.complex64)
|
30
30
|
|
31
|
-
def setup_lattice(self, parameters: DressedGrapheneParameters) -> BaseLattice:
|
32
|
-
"""Set up lattice based on parameters."""
|
31
|
+
def setup_lattice(self, parameters: DressedGrapheneParameters) -> BaseLattice: # noqa: D102
|
33
32
|
return GrapheneLattice(lattice_constant=parameters.lattice_constant)
|
34
33
|
|
35
34
|
@classmethod
|
36
|
-
def get_parameters_model(cls) -> type[DressedGrapheneParameters]:
|
37
|
-
"""Return the specific parameters model for the subclass."""
|
35
|
+
def get_parameters_model(cls) -> type[DressedGrapheneParameters]: # noqa: D102
|
38
36
|
return DressedGrapheneParameters
|
39
37
|
|
40
|
-
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
41
|
-
"""
|
42
|
-
Return the normal state Hamiltonian in orbital basis.
|
43
|
-
|
44
|
-
Parameters
|
45
|
-
----------
|
46
|
-
k : :class:`numpy.ndarray`
|
47
|
-
List of k points.
|
48
|
-
|
49
|
-
Returns
|
50
|
-
-------
|
51
|
-
:class:`numpy.ndarray`
|
52
|
-
Hamiltonian in matrix form.
|
53
|
-
|
54
|
-
"""
|
38
|
+
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]: # noqa: D102
|
55
39
|
assert _check_valid_array(k)
|
56
40
|
|
57
41
|
t_gr = self.hopping_gr
|
@@ -88,25 +72,9 @@ class DressedGraphene(BaseHamiltonian[DressedGrapheneParameters]):
|
|
88
72
|
|
89
73
|
return h.squeeze()
|
90
74
|
|
91
|
-
def hamiltonian_derivative(
|
75
|
+
def hamiltonian_derivative( # noqa: D102
|
92
76
|
self, k: npt.NDArray[np.float64], direction: str
|
93
77
|
) -> npt.NDArray[np.complex64]:
|
94
|
-
"""
|
95
|
-
Deriative of the Hamiltonian.
|
96
|
-
|
97
|
-
Parameters
|
98
|
-
----------
|
99
|
-
k: :class:`numpy.ndarray`
|
100
|
-
List of k points.
|
101
|
-
direction: str
|
102
|
-
Direction for derivative, either 'x' oder 'y'.
|
103
|
-
|
104
|
-
Returns
|
105
|
-
-------
|
106
|
-
:class:`numpy.ndarray`
|
107
|
-
Derivative of Hamiltonian.
|
108
|
-
|
109
|
-
"""
|
110
78
|
assert _check_valid_array(k)
|
111
79
|
assert direction in ["x", "y"]
|
112
80
|
|
@@ -27,30 +27,14 @@ class Graphene(BaseHamiltonian[GrapheneParameters]):
|
|
27
27
|
if parameters.delta is not None:
|
28
28
|
self.delta_orbital_basis = np.astype(parameters.delta, np.complex64)
|
29
29
|
|
30
|
-
def setup_lattice(self, parameters: GrapheneParameters) -> GrapheneLattice:
|
31
|
-
"""Set up lattice based on parameters."""
|
30
|
+
def setup_lattice(self, parameters: GrapheneParameters) -> GrapheneLattice: # noqa: D102
|
32
31
|
return GrapheneLattice(lattice_constant=parameters.lattice_constant)
|
33
32
|
|
34
33
|
@classmethod
|
35
|
-
def get_parameters_model(cls) -> type[GrapheneParameters]:
|
36
|
-
"""Return the specific parameters model for the subclass."""
|
34
|
+
def get_parameters_model(cls) -> type[GrapheneParameters]: # noqa: D102
|
37
35
|
return GrapheneParameters
|
38
36
|
|
39
|
-
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
40
|
-
"""
|
41
|
-
Return the normal state Hamiltonian in orbital basis.
|
42
|
-
|
43
|
-
Parameters
|
44
|
-
----------
|
45
|
-
k : :class:`numpy.ndarray`
|
46
|
-
List of k points.
|
47
|
-
|
48
|
-
Returns
|
49
|
-
-------
|
50
|
-
:class:`numpy.ndarray`
|
51
|
-
Hamiltonian in matrix form.
|
52
|
-
|
53
|
-
"""
|
37
|
+
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]: # noqa: D102
|
54
38
|
assert _check_valid_array(k)
|
55
39
|
hopping = self.hopping
|
56
40
|
lattice_constant = self.lattice.lattice_constant
|
@@ -72,25 +56,9 @@ class Graphene(BaseHamiltonian[GrapheneParameters]):
|
|
72
56
|
|
73
57
|
return h.squeeze()
|
74
58
|
|
75
|
-
def hamiltonian_derivative(
|
59
|
+
def hamiltonian_derivative( # noqa: D102
|
76
60
|
self, k: npt.NDArray[np.float64], direction: str
|
77
61
|
) -> npt.NDArray[np.complex64]:
|
78
|
-
"""
|
79
|
-
Deriative of the Hamiltonian.
|
80
|
-
|
81
|
-
Parameters
|
82
|
-
----------
|
83
|
-
k: :class:`numpy.ndarray`
|
84
|
-
List of k points.
|
85
|
-
direction: str
|
86
|
-
Direction for derivative, either 'x' oder 'y'.
|
87
|
-
|
88
|
-
Returns
|
89
|
-
-------
|
90
|
-
:class:`numpy.ndarray`
|
91
|
-
Derivative of Hamiltonian.
|
92
|
-
|
93
|
-
"""
|
94
62
|
assert _check_valid_array(k)
|
95
63
|
assert direction in ["x", "y"]
|
96
64
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
|
-
"""Provides the implementation for
|
5
|
+
"""Provides the implementation for a one band tight binding model."""
|
6
6
|
|
7
7
|
import numpy as np
|
8
8
|
import numpy.typing as npt
|
@@ -15,7 +15,7 @@ from .base_hamiltonian import BaseHamiltonian
|
|
15
15
|
|
16
16
|
|
17
17
|
class OneBand(BaseHamiltonian[OneBandParameters]):
|
18
|
-
"""Hamiltonian for
|
18
|
+
"""Hamiltonian for one band tight binding model."""
|
19
19
|
|
20
20
|
def __init__(self, parameters: OneBandParameters) -> None:
|
21
21
|
super().__init__(parameters)
|
@@ -24,30 +24,14 @@ class OneBand(BaseHamiltonian[OneBandParameters]):
|
|
24
24
|
if parameters.delta is not None:
|
25
25
|
self.delta_orbital_basis = np.astype(parameters.delta, np.complex64)
|
26
26
|
|
27
|
-
def setup_lattice(self, parameters: OneBandParameters) -> SquareLattice:
|
28
|
-
"""Set up lattice based on parameters."""
|
27
|
+
def setup_lattice(self, parameters: OneBandParameters) -> SquareLattice: # noqa: D102
|
29
28
|
return SquareLattice(lattice_constant=parameters.lattice_constant)
|
30
29
|
|
31
30
|
@classmethod
|
32
|
-
def get_parameters_model(cls) -> type[OneBandParameters]:
|
33
|
-
"""Return the specific parameters model for the subclass."""
|
31
|
+
def get_parameters_model(cls) -> type[OneBandParameters]: # noqa: D102
|
34
32
|
return OneBandParameters
|
35
33
|
|
36
|
-
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
37
|
-
"""
|
38
|
-
Return the normal state Hamiltonian in orbital basis.
|
39
|
-
|
40
|
-
Parameters
|
41
|
-
----------
|
42
|
-
k : :class:`numpy.ndarray`
|
43
|
-
List of k points.
|
44
|
-
|
45
|
-
Returns
|
46
|
-
-------
|
47
|
-
:class:`numpy.ndarray`
|
48
|
-
Hamiltonian in matrix form.
|
49
|
-
|
50
|
-
"""
|
34
|
+
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]: # noqa: D102
|
51
35
|
assert _check_valid_array(k)
|
52
36
|
hopping = self.hopping
|
53
37
|
lattice_constant = self.lattice.lattice_constant
|
@@ -64,25 +48,9 @@ class OneBand(BaseHamiltonian[OneBandParameters]):
|
|
64
48
|
|
65
49
|
return h
|
66
50
|
|
67
|
-
def hamiltonian_derivative(
|
51
|
+
def hamiltonian_derivative( # noqa: D102
|
68
52
|
self, k: npt.NDArray[np.float64], direction: str
|
69
53
|
) -> npt.NDArray[np.complex64]:
|
70
|
-
"""
|
71
|
-
Deriative of the Hamiltonian.
|
72
|
-
|
73
|
-
Parameters
|
74
|
-
----------
|
75
|
-
k: :class:`numpy.ndarray`
|
76
|
-
List of k points.
|
77
|
-
direction: str
|
78
|
-
Direction for derivative, either 'x' oder 'y'.
|
79
|
-
|
80
|
-
Returns
|
81
|
-
-------
|
82
|
-
:class:`numpy.ndarray`
|
83
|
-
Derivative of Hamiltonian.
|
84
|
-
|
85
|
-
"""
|
86
54
|
assert _check_valid_array(k)
|
87
55
|
assert direction in ["x", "y"]
|
88
56
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
|
-
"""Provides the implementation for
|
5
|
+
"""Provides the implementation for a three band tight binding model."""
|
6
6
|
|
7
7
|
import numpy as np
|
8
8
|
import numpy.typing as npt
|
@@ -24,30 +24,14 @@ class ThreeBand(BaseHamiltonian[ThreeBandParameters]):
|
|
24
24
|
if parameters.delta is not None:
|
25
25
|
self.delta_orbital_basis = np.astype(parameters.delta, np.complex64)
|
26
26
|
|
27
|
-
def setup_lattice(self, parameters: ThreeBandParameters) -> SquareLattice:
|
28
|
-
"""Set up lattice based on parameters."""
|
27
|
+
def setup_lattice(self, parameters: ThreeBandParameters) -> SquareLattice: # noqa: D102
|
29
28
|
return SquareLattice(lattice_constant=parameters.lattice_constant)
|
30
29
|
|
31
30
|
@classmethod
|
32
|
-
def get_parameters_model(cls) -> type[ThreeBandParameters]:
|
33
|
-
"""Return the specific parameters model for the subclass."""
|
31
|
+
def get_parameters_model(cls) -> type[ThreeBandParameters]: # noqa: D102
|
34
32
|
return ThreeBandParameters
|
35
33
|
|
36
|
-
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
37
|
-
"""
|
38
|
-
Return the normal state Hamiltonian in orbital basis.
|
39
|
-
|
40
|
-
Parameters
|
41
|
-
----------
|
42
|
-
k : :class:`numpy.ndarray`
|
43
|
-
List of k points.
|
44
|
-
|
45
|
-
Returns
|
46
|
-
-------
|
47
|
-
:class:`numpy.ndarray`
|
48
|
-
Hamiltonian in matrix form.
|
49
|
-
|
50
|
-
"""
|
34
|
+
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]: # noqa: D102
|
51
35
|
assert _check_valid_array(k)
|
52
36
|
hopping = self.hopping
|
53
37
|
lattice_constant = self.lattice.lattice_constant
|
@@ -75,25 +59,9 @@ class ThreeBand(BaseHamiltonian[ThreeBandParameters]):
|
|
75
59
|
|
76
60
|
return h.squeeze()
|
77
61
|
|
78
|
-
def hamiltonian_derivative(
|
62
|
+
def hamiltonian_derivative( # noqa: D102
|
79
63
|
self, k: npt.NDArray[np.float64], direction: str
|
80
64
|
) -> npt.NDArray[np.complex64]:
|
81
|
-
"""
|
82
|
-
Deriative of the Hamiltonian.
|
83
|
-
|
84
|
-
Parameters
|
85
|
-
----------
|
86
|
-
k: :class:`numpy.ndarray`
|
87
|
-
List of k points.
|
88
|
-
direction: str
|
89
|
-
Direction for derivative, either 'x' oder 'y'.
|
90
|
-
|
91
|
-
Returns
|
92
|
-
-------
|
93
|
-
:class:`numpy.ndarray`
|
94
|
-
Derivative of Hamiltonian.
|
95
|
-
|
96
|
-
"""
|
97
65
|
assert _check_valid_array(k)
|
98
66
|
assert direction in ["x", "y"]
|
99
67
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
|
-
"""Provides the implementation for
|
5
|
+
"""Provides the implementation for a two band tight binding model."""
|
6
6
|
|
7
7
|
import numpy as np
|
8
8
|
import numpy.typing as npt
|
@@ -24,30 +24,14 @@ class TwoBand(BaseHamiltonian[TwoBandParameters]):
|
|
24
24
|
if parameters.delta is not None:
|
25
25
|
self.delta_orbital_basis = np.astype(parameters.delta, np.complex64)
|
26
26
|
|
27
|
-
def setup_lattice(self, parameters: TwoBandParameters) -> SquareLattice:
|
28
|
-
"""Set up lattice based on parameters."""
|
27
|
+
def setup_lattice(self, parameters: TwoBandParameters) -> SquareLattice: # noqa: D102
|
29
28
|
return SquareLattice(lattice_constant=parameters.lattice_constant)
|
30
29
|
|
31
30
|
@classmethod
|
32
|
-
def get_parameters_model(cls) -> type[TwoBandParameters]:
|
33
|
-
"""Return the specific parameters model for the subclass."""
|
31
|
+
def get_parameters_model(cls) -> type[TwoBandParameters]: # noqa: D102
|
34
32
|
return TwoBandParameters
|
35
33
|
|
36
|
-
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
|
37
|
-
"""
|
38
|
-
Return the normal state Hamiltonian in orbital basis.
|
39
|
-
|
40
|
-
Parameters
|
41
|
-
----------
|
42
|
-
k : :class:`numpy.ndarray`
|
43
|
-
List of k points.
|
44
|
-
|
45
|
-
Returns
|
46
|
-
-------
|
47
|
-
:class:`numpy.ndarray`
|
48
|
-
Hamiltonian in matrix form.
|
49
|
-
|
50
|
-
"""
|
34
|
+
def hamiltonian(self, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]: # noqa: D102
|
51
35
|
assert _check_valid_array(k)
|
52
36
|
hopping = self.hopping
|
53
37
|
lattice_constant = self.lattice.lattice_constant
|
@@ -68,25 +52,9 @@ class TwoBand(BaseHamiltonian[TwoBandParameters]):
|
|
68
52
|
|
69
53
|
return h.squeeze()
|
70
54
|
|
71
|
-
def hamiltonian_derivative(
|
55
|
+
def hamiltonian_derivative( # noqa: D102
|
72
56
|
self, k: npt.NDArray[np.float64], direction: str
|
73
57
|
) -> npt.NDArray[np.complex64]:
|
74
|
-
"""
|
75
|
-
Deriative of the Hamiltonian.
|
76
|
-
|
77
|
-
Parameters
|
78
|
-
----------
|
79
|
-
k: :class:`numpy.ndarray`
|
80
|
-
List of k points.
|
81
|
-
direction: str
|
82
|
-
Direction for derivative, either 'x' oder 'y'.
|
83
|
-
|
84
|
-
Returns
|
85
|
-
-------
|
86
|
-
:class:`numpy.ndarray`
|
87
|
-
Derivative of Hamiltonian.
|
88
|
-
|
89
|
-
"""
|
90
58
|
assert _check_valid_array(k)
|
91
59
|
assert direction in ["x", "y"]
|
92
60
|
|
@@ -14,21 +14,30 @@ from quant_met.parameters import GenericParameters
|
|
14
14
|
def quantum_metric(
|
15
15
|
h: BaseHamiltonian[GenericParameters], k_grid: npt.NDArray[np.float64], bands: list[int]
|
16
16
|
) -> npt.NDArray[np.float64]:
|
17
|
-
"""Calculate the quantum metric
|
17
|
+
"""Calculate the quantum metric (geometric tensor) for specified bands.
|
18
|
+
|
19
|
+
This function computes the quantum geometric tensor associated with
|
20
|
+
the specified bands of a given Hamiltonian over a grid of k-points.
|
21
|
+
The output is a 2x2 matrix representing the quantum metric.
|
18
22
|
|
19
23
|
Parameters
|
20
24
|
----------
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
h : BaseHamiltonian
|
26
|
+
Hamiltonian object used to compute Bloch states and their derivatives.
|
27
|
+
k_grid : numpy.ndarray
|
28
|
+
Array of k points in the Brillouin zone.
|
29
|
+
bands : list of int
|
30
|
+
Indices of the bands for which the quantum metric is to be calculated.
|
26
31
|
|
27
32
|
Returns
|
28
33
|
-------
|
29
34
|
:class:`numpy.ndarray`
|
30
|
-
|
35
|
+
A 2x2 matrix representing the quantum metric.
|
31
36
|
|
37
|
+
Raises
|
38
|
+
------
|
39
|
+
ValueError
|
40
|
+
If `bands` contains invalid indices or `k_grid` is empty.
|
32
41
|
"""
|
33
42
|
energies, bloch = h.diagonalize_nonint(k_grid)
|
34
43
|
|
@@ -58,52 +67,3 @@ def quantum_metric(
|
|
58
67
|
)
|
59
68
|
|
60
69
|
return np.real(quantum_geom_tensor) / number_k_points
|
61
|
-
|
62
|
-
|
63
|
-
def quantum_metric_bdg(
|
64
|
-
h: BaseHamiltonian[GenericParameters], k_grid: npt.NDArray[np.float64], bands: list[int]
|
65
|
-
) -> npt.NDArray[np.float64]:
|
66
|
-
"""Calculate the quantum metric in the BdG state.
|
67
|
-
|
68
|
-
Parameters
|
69
|
-
----------
|
70
|
-
bands
|
71
|
-
h : :class:`~quant_met.BaseHamiltonian`
|
72
|
-
Hamiltonian object.
|
73
|
-
k_grid : :class:`numpy.ndarray`
|
74
|
-
List of k points.
|
75
|
-
|
76
|
-
Returns
|
77
|
-
-------
|
78
|
-
:class:`numpy.ndarray`
|
79
|
-
Quantum metric in the normal state.
|
80
|
-
|
81
|
-
"""
|
82
|
-
energies, bdg_functions = h.diagonalize_bdg(k_grid)
|
83
|
-
|
84
|
-
number_k_points = len(k_grid)
|
85
|
-
|
86
|
-
quantum_geom_tensor = np.zeros(shape=(2, 2), dtype=np.complex64)
|
87
|
-
|
88
|
-
for band in bands:
|
89
|
-
for i, direction_1 in enumerate(["x", "y"]):
|
90
|
-
h_derivative_dir_1 = h.bdg_hamiltonian_derivative(k=k_grid, direction=direction_1)
|
91
|
-
for j, direction_2 in enumerate(["x", "y"]):
|
92
|
-
h_derivative_dir_2 = h.bdg_hamiltonian_derivative(k=k_grid, direction=direction_2)
|
93
|
-
for k_index in range(len(k_grid)):
|
94
|
-
for n in [i for i in range(2 * h.number_of_bands) if i != band]:
|
95
|
-
quantum_geom_tensor[i, j] += (
|
96
|
-
(
|
97
|
-
bdg_functions[k_index][:, band].conjugate()
|
98
|
-
@ h_derivative_dir_1[k_index]
|
99
|
-
@ bdg_functions[k_index][:, n]
|
100
|
-
)
|
101
|
-
* (
|
102
|
-
bdg_functions[k_index][:, n].conjugate()
|
103
|
-
@ h_derivative_dir_2[k_index]
|
104
|
-
@ bdg_functions[k_index][:, band]
|
105
|
-
)
|
106
|
-
/ (energies[k_index][band] - energies[k_index][n]) ** 2
|
107
|
-
)
|
108
|
-
|
109
|
-
return np.real(quantum_geom_tensor) / number_k_points
|
@@ -4,37 +4,80 @@
|
|
4
4
|
|
5
5
|
"""Self-consistency loop."""
|
6
6
|
|
7
|
+
import logging
|
8
|
+
|
7
9
|
import numpy as np
|
8
10
|
import numpy.typing as npt
|
9
11
|
|
10
12
|
from quant_met.mean_field.hamiltonians.base_hamiltonian import BaseHamiltonian
|
11
13
|
from quant_met.parameters import GenericParameters
|
12
14
|
|
15
|
+
logger = logging.getLogger(__name__)
|
16
|
+
|
13
17
|
|
14
18
|
def self_consistency_loop(
|
15
19
|
h: BaseHamiltonian[GenericParameters],
|
16
20
|
k_space_grid: npt.NDArray[np.float64],
|
17
21
|
epsilon: float,
|
18
22
|
) -> BaseHamiltonian[GenericParameters]:
|
19
|
-
"""Self-
|
23
|
+
"""Self-consistently solves the gap equation for a given Hamiltonian.
|
24
|
+
|
25
|
+
This function performs a self-consistency loop to solve the gap equation
|
26
|
+
for a Hamiltonian `h`.
|
27
|
+
The gaps in the orbital basis are iteratively updated until the change is within
|
28
|
+
a specified tolerance `epsilon`.
|
20
29
|
|
21
30
|
Parameters
|
22
31
|
----------
|
23
|
-
|
24
|
-
|
25
|
-
|
32
|
+
h : :class:`BaseHamiltonian<quant_met.mean_field.hamiltonians.BaseHamiltonian>`
|
33
|
+
The Hamiltonian object with the parameters for the calculation.
|
34
|
+
|
35
|
+
k_space_grid : :class:`numpy.ndarray`
|
36
|
+
A grid of points in the Brillouin zone at which the gap equation is evaluated.
|
37
|
+
See
|
38
|
+
|
39
|
+
epsilon : float
|
40
|
+
The convergence criterion. The loop will terminate when the change
|
41
|
+
in the delta orbital basis is less than this value.
|
42
|
+
|
43
|
+
Returns
|
44
|
+
-------
|
45
|
+
:class:`quant_met.mean_field.BaseHamiltonian`
|
46
|
+
The updated Hamiltonian object with the new gaps.
|
47
|
+
|
48
|
+
Notes
|
49
|
+
-----
|
50
|
+
The function initializes the gaps with random complex numbers before entering the
|
51
|
+
self-consistency loop.
|
52
|
+
The mixing parameter is set to 0.2, which controls how much of the new gaps is taken
|
53
|
+
relative to the previous value in each iteration.
|
26
54
|
"""
|
55
|
+
logger.info("Starting self-consistency loop.")
|
56
|
+
|
27
57
|
rng = np.random.default_rng()
|
28
58
|
delta_init = np.zeros(shape=h.delta_orbital_basis.shape, dtype=np.complex64)
|
29
59
|
delta_init += (0.2 * rng.random(size=h.delta_orbital_basis.shape) - 1) + 1.0j * (
|
30
60
|
0.2 * rng.random(size=h.delta_orbital_basis.shape) - 1
|
31
61
|
)
|
32
62
|
h.delta_orbital_basis = delta_init
|
63
|
+
logger.debug("Initial gaps set to: %s", h.delta_orbital_basis)
|
33
64
|
|
65
|
+
iteration_count = 0
|
34
66
|
while True:
|
67
|
+
iteration_count += 1
|
68
|
+
logger.debug("Iteration %d: Computing new gaps.", iteration_count)
|
69
|
+
|
35
70
|
new_gap = h.gap_equation(k=k_space_grid)
|
36
|
-
|
71
|
+
|
72
|
+
delta_change = np.abs(h.delta_orbital_basis - new_gap)
|
73
|
+
logger.debug("New gaps computed: %s", new_gap)
|
74
|
+
|
75
|
+
if (delta_change < epsilon).all():
|
37
76
|
h.delta_orbital_basis = new_gap
|
77
|
+
logger.info("Convergence achieved after %d iterations.", iteration_count)
|
38
78
|
return h
|
39
|
-
|
79
|
+
|
80
|
+
mixing_greed = 0.2
|
40
81
|
h.delta_orbital_basis = mixing_greed * new_gap + (1 - mixing_greed) * h.delta_orbital_basis
|
82
|
+
logger.debug("Updated gaps: %s", h.delta_orbital_basis)
|
83
|
+
logger.debug("Change in gaps: %s", delta_change)
|
quant_met/parameters/__init__.py
CHANGED
@@ -3,16 +3,24 @@
|
|
3
3
|
# SPDX-License-Identifier: MIT
|
4
4
|
|
5
5
|
"""
|
6
|
-
|
7
|
-
|
6
|
+
Parameter Classes
|
7
|
+
=================
|
8
|
+
|
9
|
+
Main class holding all the parameters for the calculation.
|
10
|
+
|
11
|
+
- :class:`Parameters<quant_met.parameters.Parameters>`
|
12
|
+
|
13
|
+
Classes holding the configuration for the Hamiltonians.
|
8
14
|
|
9
15
|
.. autosummary::
|
10
16
|
:toctree: generated/parameters/
|
11
17
|
|
18
|
+
Parameters # noqa
|
12
19
|
DressedGrapheneParameters
|
13
20
|
GrapheneParameters
|
14
21
|
OneBandParameters
|
15
|
-
|
22
|
+
TwoBandParameters
|
23
|
+
ThreeBandParameters
|
16
24
|
""" # noqa: D205, D400
|
17
25
|
|
18
26
|
from .hamiltonians import (
|
@@ -34,10 +34,22 @@ def validate_float(value: float, info: ValidationInfo) -> float:
|
|
34
34
|
|
35
35
|
|
36
36
|
class HamiltonianParameters(BaseModel):
|
37
|
-
"""Base class for Hamiltonian parameters.
|
37
|
+
"""Base class for Hamiltonian parameters.
|
38
|
+
|
39
|
+
Attributes
|
40
|
+
----------
|
41
|
+
name : str
|
42
|
+
The name of the Hamiltonian model (e.g., "Graphene", "DressedGraphene").
|
43
|
+
beta : float
|
44
|
+
The inverse temperature; default is set to infinity.
|
45
|
+
q : :class:`numpy.ndarray` | None
|
46
|
+
An optional numpy array representing the momentum of Cooper pairs.
|
47
|
+
hubbard_int_orbital_basis : :class:`numpy.ndarray`
|
48
|
+
A numpy array representing the Hubbard interactions in the orbital basis.
|
49
|
+
"""
|
38
50
|
|
39
51
|
name: str
|
40
|
-
beta: float
|
52
|
+
beta: float = Field(default=np.inf, description="Inverse temperature")
|
41
53
|
q: NDArray[Shape["2"], int | float] | None = Field(
|
42
54
|
default=None, description="Momentum of Cooper pairs"
|
43
55
|
)
|
@@ -47,7 +59,25 @@ class HamiltonianParameters(BaseModel):
|
|
47
59
|
|
48
60
|
|
49
61
|
class DressedGrapheneParameters(HamiltonianParameters):
|
50
|
-
"""Parameters for the
|
62
|
+
"""Parameters for the Dressed Graphene model.
|
63
|
+
|
64
|
+
Attributes
|
65
|
+
----------
|
66
|
+
hopping_gr : float
|
67
|
+
Hopping parameter in the graphene layer.
|
68
|
+
hopping_x : float
|
69
|
+
Hopping parameter at the impurity site.
|
70
|
+
hopping_x_gr_a : float
|
71
|
+
Hybridization parameter.
|
72
|
+
lattice_constant : float
|
73
|
+
The lattice constant of the model.
|
74
|
+
chemical_potential : float
|
75
|
+
The chemical potential.
|
76
|
+
hubbard_int_orbital_basis : npt.NDArray[np.float64]
|
77
|
+
Hubbard interaction in the orbital basis.
|
78
|
+
delta : npt.NDArray[np.complex64] | None
|
79
|
+
Initial value for gaps in orbital space.
|
80
|
+
"""
|
51
81
|
|
52
82
|
name: Literal["DressedGraphene"] = "DressedGraphene"
|
53
83
|
hopping_gr: float = Field(..., description="Hopping in graphene")
|
quant_met/parameters/main.py
CHANGED
@@ -12,7 +12,20 @@ from .hamiltonians import DressedGrapheneParameters, GrapheneParameters, OneBand
|
|
12
12
|
|
13
13
|
|
14
14
|
class Control(BaseModel):
|
15
|
-
"""Control for the calculation.
|
15
|
+
"""Control for the calculation.
|
16
|
+
|
17
|
+
Attributes
|
18
|
+
----------
|
19
|
+
calculation : str
|
20
|
+
Specifies the type of calculation to be performed.
|
21
|
+
prefix : str
|
22
|
+
A string used as a prefix for naming output files generated by the simulation.
|
23
|
+
outdir : :class:`pathlib.Path`
|
24
|
+
A path indicating the output directory where results will be saved.
|
25
|
+
conv_treshold : float
|
26
|
+
A float value representing the convergence threshold.
|
27
|
+
The calculation will stop when changes in the results drop below this threshold.
|
28
|
+
"""
|
16
29
|
|
17
30
|
calculation: str
|
18
31
|
prefix: str
|
@@ -21,14 +34,33 @@ class Control(BaseModel):
|
|
21
34
|
|
22
35
|
|
23
36
|
class KPoints(BaseModel):
|
24
|
-
"""Control for k points.
|
37
|
+
"""Control for k points.
|
38
|
+
|
39
|
+
Attributes
|
40
|
+
----------
|
41
|
+
nk1 : int
|
42
|
+
The number of k-points in the first dimension of the k-space grid.
|
43
|
+
nk2 : int
|
44
|
+
The number of k-points in the second dimension of the k-space grid.
|
45
|
+
"""
|
25
46
|
|
26
47
|
nk1: int
|
27
48
|
nk2: int
|
28
49
|
|
29
50
|
|
30
51
|
class Parameters(BaseModel):
|
31
|
-
"""Class to hold the parameters for a calculation.
|
52
|
+
"""Class to hold the parameters for a calculation.
|
53
|
+
|
54
|
+
Attributes
|
55
|
+
----------
|
56
|
+
control : Control
|
57
|
+
An instance of the `Control` class containing settings for the calculation.
|
58
|
+
model :
|
59
|
+
An instance of one of the Hamiltonian parameter classes, holding the specific parameters
|
60
|
+
of the selected Hamiltonian model.
|
61
|
+
k_points : KPoints
|
62
|
+
An instance of the `KPoints` class that specifies the number of k-points for the simulation.
|
63
|
+
"""
|
32
64
|
|
33
65
|
control: Control
|
34
66
|
model: DressedGrapheneParameters | GrapheneParameters | OneBandParameters = Field(
|
quant_met/plotting/__init__.py
CHANGED
@@ -18,13 +18,11 @@ Functions
|
|
18
18
|
scatter_into_bz
|
19
19
|
plot_bandstructure
|
20
20
|
plot_superfluid_weight
|
21
|
-
plot_quantum_metric
|
22
21
|
""" # noqa: D205, D400
|
23
22
|
|
24
23
|
from .plotting import (
|
25
24
|
format_plot,
|
26
25
|
plot_bandstructure,
|
27
|
-
plot_quantum_metric,
|
28
26
|
plot_superfluid_weight,
|
29
27
|
scatter_into_bz,
|
30
28
|
)
|
@@ -34,5 +32,4 @@ __all__ = [
|
|
34
32
|
"format_plot",
|
35
33
|
"plot_bandstructure",
|
36
34
|
"plot_superfluid_weight",
|
37
|
-
"plot_quantum_metric",
|
38
35
|
]
|