quant-met 0.0.4__tar.gz → 0.0.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quant-met
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Calculate superconductivity in flat-band systems.
5
5
  Author: Tjark Sievers
6
6
  Author-email: tsievers@physnet.uni-hamburg.de
@@ -9,7 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Requires-Dist: h5py (>=3.11.0,<4.0.0)
12
- Requires-Dist: matplotlib (>=3.9.1,<4.0.0)
12
+ Requires-Dist: matplotlib (>=3.9.2,<4.0.0)
13
13
  Requires-Dist: numpy (>=2.0.0,<3.0.0)
14
14
  Requires-Dist: pandas (>=2.2.2,<3.0.0)
15
15
  Requires-Dist: scipy (>=1.14.0,<2.0.0)
@@ -8,7 +8,7 @@ requires-python = ">=3.11"
8
8
 
9
9
  [tool.poetry]
10
10
  name = "quant-met"
11
- version = "0.0.4"
11
+ version = "0.0.5"
12
12
  description = "Calculate superconductivity in flat-band systems."
13
13
  authors = ["Tjark Sievers <tsievers@physnet.uni-hamburg.de>"]
14
14
  readme = "README.md"
@@ -17,7 +17,7 @@ readme = "README.md"
17
17
  python = "^3.11"
18
18
  numpy = "^2.0.0"
19
19
  scipy = "^1.14.0"
20
- matplotlib = "^3.9.1"
20
+ matplotlib = "^3.9.2"
21
21
  pandas = "^2.2.2"
22
22
  h5py = "^3.11.0"
23
23
 
@@ -60,7 +60,7 @@ def quantum_metric(
60
60
 
61
61
 
62
62
  def quantum_metric_bdg(
63
- h: BaseHamiltonian, k_grid: npt.NDArray[np.float64], band: int
63
+ h: BaseHamiltonian, k_grid: npt.NDArray[np.float64], bands: list[int]
64
64
  ) -> npt.NDArray[np.float64]:
65
65
  """Calculate the quantum metric in the BdG state.
66
66
 
@@ -85,24 +85,25 @@ def quantum_metric_bdg(
85
85
 
86
86
  quantum_geom_tensor = np.zeros(shape=(2, 2), dtype=np.complex64)
87
87
 
88
- for i, direction_1 in enumerate(["x", "y"]):
89
- h_derivative_direction_1 = h.bdg_hamiltonian_derivative(k=k_grid, direction=direction_1)
90
- for j, direction_2 in enumerate(["x", "y"]):
91
- h_derivative_direction_2 = h.bdg_hamiltonian_derivative(k=k_grid, direction=direction_2)
92
- for k_index in range(len(k_grid)):
93
- for n in [i for i in range(h.number_of_bands) if i != band]:
94
- quantum_geom_tensor[i, j] += (
95
- (
96
- bdg_functions[k_index][:, band].conjugate()
97
- @ h_derivative_direction_1[k_index]
98
- @ bdg_functions[k_index][:, n]
99
- )
100
- * (
101
- bdg_functions[k_index][:, n].conjugate()
102
- @ h_derivative_direction_2[k_index]
103
- @ bdg_functions[k_index][:, band]
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(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
104
107
  )
105
- / (energies[k_index][band] - energies[k_index][n]) ** 2
106
- )
107
108
 
108
109
  return np.real(quantum_geom_tensor) / number_k_points
@@ -71,34 +71,8 @@ def _current_operator(
71
71
  return j
72
72
 
73
73
 
74
- def _w_matrix(
75
- h: BaseHamiltonian, k: npt.NDArray[np.float64]
76
- ) -> tuple[npt.NDArray[np.complex64], npt.NDArray[np.complex64]]:
77
- _, bloch = h.diagonalize_nonint(k=k)
78
- _, bdg_functions = h.diagonalize_bdg(k=k)
79
-
80
- w_plus = np.zeros((2 * h.number_of_bands, h.number_of_bands), dtype=np.complex64)
81
- for i in range(2 * h.number_of_bands):
82
- for m in range(h.number_of_bands):
83
- w_plus[i, m] = (
84
- np.tensordot(bloch[:, m], np.array([1, 0]), axes=0).reshape(-1)
85
- @ bdg_functions[:, i]
86
- )
87
-
88
- w_minus = np.zeros((2 * h.number_of_bands, h.number_of_bands), dtype=np.complex64)
89
- for i in range(2 * h.number_of_bands):
90
- for m in range(h.number_of_bands):
91
- w_minus[i, m] = (
92
- np.tensordot(bloch[:, m].conjugate(), np.array([0, 1]), axes=0).reshape(-1)
93
- @ bdg_functions[:, i]
94
- )
95
-
96
- return w_plus, w_minus
97
-
98
-
99
74
  def _c_factor(h: BaseHamiltonian, k: npt.NDArray[np.float64]) -> npt.NDArray[np.complex64]:
100
- bdg_energies, _ = h.diagonalize_bdg(k)
101
- w_plus, w_minus = _w_matrix(h, k)
75
+ bdg_energies, bdg_functions = h.diagonalize_bdg(k)
102
76
  c_mnpq = np.zeros(
103
77
  shape=(
104
78
  h.number_of_bands,
@@ -124,10 +98,10 @@ def _c_factor(h: BaseHamiltonian, k: npt.NDArray[np.float64]) -> npt.NDArray[np.
124
98
  c_tmp -= _fermi_dirac_derivative()
125
99
 
126
100
  c_tmp *= (
127
- w_minus[i, m].conjugate()
128
- * w_plus[j, n]
129
- * w_minus[j, p].conjugate()
130
- * w_minus[i, q]
101
+ bdg_functions[i, m].conjugate()
102
+ * bdg_functions[j, n]
103
+ * bdg_functions[j, p].conjugate()
104
+ * bdg_functions[i, q].conjugate()
131
105
  )
132
106
 
133
107
  c_mnpq[m, n, p, q] = 2 * c_tmp
File without changes
File without changes
File without changes