quant-met 0.0.2__py3-none-any.whl → 0.0.4__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.
@@ -1,10 +0,0 @@
1
- import numpy as np
2
-
3
-
4
- def _check_valid_float(float_in: float, parameter_name: str) -> float:
5
- if np.isinf(float_in):
6
- raise ValueError(f"{parameter_name} must not be Infinity")
7
- elif np.isnan(float_in):
8
- raise ValueError(f"{parameter_name} must not be NaN")
9
- else:
10
- return float_in
@@ -1,156 +0,0 @@
1
- from typing import Any, List, Tuple
2
-
3
- import matplotlib.axes
4
- import matplotlib.colors
5
- import matplotlib.figure
6
- import matplotlib.pyplot as plt
7
- import numpy as np
8
- import numpy.typing as npt
9
- from matplotlib.collections import LineCollection
10
- from numpy import dtype, generic, ndarray
11
-
12
-
13
- def scatter_into_bz(
14
- bz_corners: List[npt.NDArray[np.float64]],
15
- k_points: npt.NDArray[np.float64],
16
- data: npt.NDArray[np.float64] | None = None,
17
- data_label: str | None = None,
18
- fig_in: matplotlib.figure.Figure | None = None,
19
- ax_in: matplotlib.axes.Axes | None = None,
20
- ) -> matplotlib.figure.Figure:
21
- if fig_in is None or ax_in is None:
22
- fig, ax = plt.subplots()
23
- else:
24
- fig, ax = fig_in, ax_in
25
-
26
- if data is not None:
27
- scatter = ax.scatter(*zip(*k_points), c=data, cmap="viridis")
28
- fig.colorbar(scatter, ax=ax, fraction=0.046, pad=0.04, label=data_label)
29
- else:
30
- ax.scatter(*zip(*k_points))
31
-
32
- ax.scatter(*zip(*bz_corners), alpha=0.8)
33
- ax.set_aspect("equal", adjustable="box")
34
- ax.set_xlabel(r"$k_x\ [1/a_0]$")
35
- ax.set_ylabel(r"$k_y\ [1/a_0]$")
36
-
37
- return fig
38
-
39
-
40
- def plot_bandstructure(
41
- bands: npt.NDArray[np.float64],
42
- k_point_list: npt.NDArray[np.float64],
43
- ticks: List[float],
44
- labels: List[str],
45
- overlaps: npt.NDArray[np.float64] | None = None,
46
- overlap_labels: List[str] | None = None,
47
- fig_in: matplotlib.figure.Figure | None = None,
48
- ax_in: matplotlib.axes.Axes | None = None,
49
- ) -> matplotlib.figure.Figure:
50
- if fig_in is None or ax_in is None:
51
- fig, ax = plt.subplots()
52
- else:
53
- fig, ax = fig_in, ax_in
54
-
55
- ax.axhline(y=0, alpha=0.7, linestyle="--", color="black")
56
-
57
- if overlaps is None:
58
- for band in bands:
59
- ax.plot(k_point_list, band)
60
- else:
61
- line = LineCollection(segments=[np.array([(0, 0)])])
62
- for band, wx in zip(bands, overlaps):
63
- points = np.array([k_point_list, band]).T.reshape(-1, 1, 2)
64
- segments = np.concatenate([points[:-1], points[1:]], axis=1)
65
-
66
- norm = matplotlib.colors.Normalize(-1, 1)
67
- lc = LineCollection(segments, cmap="seismic", norm=norm)
68
- lc.set_array(wx)
69
- lc.set_linewidth(2)
70
- line = ax.add_collection(lc)
71
-
72
- colorbar = fig.colorbar(line, fraction=0.046, pad=0.04, ax=ax)
73
- color_ticks = [-1, 1]
74
- colorbar.set_ticks(ticks=color_ticks, labels=overlap_labels)
75
-
76
- ax.set_ylim(
77
- top=np.max(bands) + 0.1 * np.max(bands),
78
- bottom=np.min(bands) - 0.1 * np.abs(np.min(bands)),
79
- )
80
- ax.set_box_aspect(1)
81
- ax.set_xticks(ticks, labels)
82
- ax.set_ylabel(r"$E\ [t]$")
83
- ax.set_facecolor("lightgray")
84
- ax.grid(visible=True)
85
- ax.tick_params(
86
- axis="both", direction="in", bottom=True, top=True, left=True, right=True
87
- )
88
-
89
- return fig
90
-
91
-
92
- def _generate_part_of_path(
93
- p_0: npt.NDArray[np.float64],
94
- p_1: npt.NDArray[np.float64],
95
- n: int,
96
- length_whole_path: int,
97
- ) -> npt.NDArray[np.float64]:
98
- distance = np.linalg.norm(p_1 - p_0)
99
- number_of_points = int(n * distance / length_whole_path) + 1
100
-
101
- k_space_path = np.vstack(
102
- [
103
- np.linspace(p_0[0], p_1[0], number_of_points),
104
- np.linspace(p_0[1], p_1[1], number_of_points),
105
- ]
106
- ).T[:-1]
107
-
108
- return k_space_path
109
-
110
-
111
- def generate_bz_path(
112
- points: List[Tuple[npt.NDArray[np.float64], str]], number_of_points: int = 1000
113
- ) -> tuple[
114
- ndarray[Any, dtype[generic | generic | Any]],
115
- ndarray[Any, dtype[generic | generic | Any]],
116
- list[int | Any],
117
- list[str],
118
- ]:
119
- n = number_of_points
120
-
121
- cycle = [
122
- np.linalg.norm(points[i][0] - points[i + 1][0]) for i in range(len(points) - 1)
123
- ]
124
- cycle.append(np.linalg.norm(points[-1][0] - points[0][0]))
125
-
126
- length_whole_path = np.sum(np.array([cycle]))
127
-
128
- ticks = [0]
129
- for i in range(0, len(cycle) - 1):
130
- ticks.append(np.sum(cycle[0 : i + 1]) / length_whole_path)
131
- ticks.append(1)
132
- labels = [rf"${points[i][1]}$" for i in range(len(points))]
133
- labels.append(rf"${points[0][1]}$")
134
-
135
- whole_path_plot = np.concatenate(
136
- [
137
- np.linspace(
138
- ticks[i],
139
- ticks[i + 1],
140
- num=int(n * cycle[i] / length_whole_path),
141
- endpoint=False,
142
- )
143
- for i in range(0, len(ticks) - 1)
144
- ]
145
- )
146
-
147
- points_path = [
148
- _generate_part_of_path(points[i][0], points[i + 1][0], n, length_whole_path)
149
- for i in range(0, len(points) - 1)
150
- ]
151
- points_path.append(
152
- _generate_part_of_path(points[-1][0], points[0][0], n, length_whole_path)
153
- )
154
- whole_path = np.concatenate(points_path)
155
-
156
- return whole_path, whole_path_plot, ticks, labels
@@ -1,15 +0,0 @@
1
- quant_met/__init__.py,sha256=Exc923N_e87XwJA_lO22UiG4WQy7dnmPmnuLiHyamRk,149
2
- quant_met/hamiltonians/__init__.py,sha256=PahN7ppBysli0rKnPLhTBMVaKC_nlD2mJfTvzfrrrRs,427
3
- quant_met/hamiltonians/_base_hamiltonian.py,sha256=N-8Pik-TByDFeaHUH_X442A6mBOaQWlRcN8UdywfFzE,5857
4
- quant_met/hamiltonians/_eg_x.py,sha256=QmVdrO26qMPp2AQA3ClHb1cBGHAx2BVjfF22WcpZMHw,3643
5
- quant_met/hamiltonians/_free_energy.py,sha256=Y7OFL-PFTZsrC4tLY5jegwVhnUeaQwLFE1w_8U9hoPs,1065
6
- quant_met/hamiltonians/_graphene.py,sha256=p8bRCcNsKguz2B3hbbtp-wGGAQtj6MDIZSwIQoY7Yug,2778
7
- quant_met/hamiltonians/_superfluid_weight.py,sha256=_YUJ5yE1x4JswuY8gydo5iN7LS0mP2Aeikhhsjy7CeQ,4260
8
- quant_met/hamiltonians/_utils.py,sha256=w2fMk6APN7kmSF6x4mVk-8CWKul-Ut01oBzQK0V6DbA,311
9
- quant_met/plotting/__init__.py,sha256=b-r6EpFZdc0aX0OrN_SXTo84ojjV8P_htlnnsmVkQWI,165
10
- quant_met/plotting/_plotting.py,sha256=YfJB6G4E_htnpBh-eogs1ieKNIXK7Hw0S4_qX9mGmj4,4737
11
- quant_met/utils.py,sha256=wLW7Q-_RbcKBdxCOJqIW_5BDuReE6leRtagABJvlm6U,821
12
- quant_met-0.0.2.dist-info/LICENSE.txt,sha256=QO_duPQihSJlaxSLxPAXo52X3esROP5wBkhxqBd1Z4E,1104
13
- quant_met-0.0.2.dist-info/METADATA,sha256=c_Y95udJ7geJwTpY4Yb4FCwOs2mb718nzlut_5YAmnM,2602
14
- quant_met-0.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
15
- quant_met-0.0.2.dist-info/RECORD,,