quant-met 0.0.6__tar.gz → 0.0.7__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.
Files changed (24) hide show
  1. {quant_met-0.0.6 → quant_met-0.0.7}/PKG-INFO +6 -5
  2. {quant_met-0.0.6 → quant_met-0.0.7}/pyproject.toml +5 -5
  3. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/base_hamiltonian.py +32 -1
  4. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/quantum_metric.py +23 -24
  5. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/self_consistency.py +2 -8
  6. {quant_met-0.0.6 → quant_met-0.0.7}/LICENSE.txt +0 -0
  7. {quant_met-0.0.6 → quant_met-0.0.7}/LICENSES/MIT.txt +0 -0
  8. {quant_met-0.0.6 → quant_met-0.0.7}/README.md +0 -0
  9. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/__init__.py +0 -0
  10. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/geometry/__init__.py +0 -0
  11. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/geometry/base_lattice.py +0 -0
  12. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/geometry/bz_path.py +0 -0
  13. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/geometry/graphene.py +0 -0
  14. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/geometry/square.py +0 -0
  15. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/__init__.py +0 -0
  16. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/_utils.py +0 -0
  17. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/eg_x.py +0 -0
  18. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/free_energy.py +0 -0
  19. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/graphene.py +0 -0
  20. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/one_band_tight_binding.py +0 -0
  21. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/mean_field/superfluid_weight.py +0 -0
  22. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/plotting/__init__.py +0 -0
  23. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/plotting/plotting.py +0 -0
  24. {quant_met-0.0.6 → quant_met-0.0.7}/src/quant_met/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quant-met
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Calculate superconductivity in flat-band systems.
5
5
  Home-page: https://quant-met.tjarksievers.de
6
6
  Author: Tjark Sievers
@@ -9,11 +9,12 @@ Requires-Python: >=3.11,<4.0
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
- Requires-Dist: h5py (>=3.11.0,<4.0.0)
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Dist: h5py (>=3.12.1,<4.0.0)
13
14
  Requires-Dist: matplotlib (>=3.9.2,<4.0.0)
14
- Requires-Dist: numpy (>=2.0.0,<3.0.0)
15
- Requires-Dist: pandas (>=2.2.2,<3.0.0)
16
- Requires-Dist: scipy (>=1.14.0,<2.0.0)
15
+ Requires-Dist: numpy (>=2.1.2,<3.0.0)
16
+ Requires-Dist: pandas (>=2.2.3,<3.0.0)
17
+ Requires-Dist: scipy (>=1.14.1,<2.0.0)
17
18
  Project-URL: Repository, https://github.com/Ruberhauptmann/quant-met
18
19
  Description-Content-Type: text/markdown
19
20
 
@@ -8,7 +8,7 @@ requires-python = ">=3.12"
8
8
 
9
9
  [tool.poetry]
10
10
  name = "quant-met"
11
- version = "0.0.6"
11
+ version = "0.0.7"
12
12
  description = "Calculate superconductivity in flat-band systems."
13
13
  authors = ["Tjark Sievers <tsievers@physnet.uni-hamburg.de>"]
14
14
  homepage = "https://quant-met.tjarksievers.de"
@@ -17,11 +17,11 @@ readme = "README.md"
17
17
 
18
18
  [tool.poetry.dependencies]
19
19
  python = "^3.11"
20
- numpy = "^2.0.0"
21
- scipy = "^1.14.0"
20
+ numpy = "^2.1.2"
21
+ scipy = "^1.14.1"
22
22
  matplotlib = "^3.9.2"
23
- pandas = "^2.2.2"
24
- h5py = "^3.11.0"
23
+ pandas = "^2.2.3"
24
+ h5py = "^3.12.1"
25
25
 
26
26
  [tool.poetry.group.dev.dependencies]
27
27
  pre-commit = "^3.7.0"
@@ -312,7 +312,8 @@ class BaseHamiltonian(ABC):
312
312
  )
313
313
  delta[i] = (-self.hubbard_int_orbital_basis[i] * sum_tmp / len(k)).conjugate()
314
314
 
315
- return np.abs(delta)
315
+ delta_without_phase: npt.NDArray[np.complex64] = delta * np.exp(-1j * np.angle(delta[0]))
316
+ return delta_without_phase
316
317
 
317
318
  def calculate_bandstructure(
318
319
  self,
@@ -356,6 +357,36 @@ class BaseHamiltonian(ABC):
356
357
 
357
358
  return results
358
359
 
360
+ def calculate_density_of_states(
361
+ self, k: npt.NDArray[np.float64], energies: npt.NDArray[np.float64]
362
+ ) -> npt.NDArray[np.float64]:
363
+ """Calculate the density of states.
364
+
365
+ Parameters
366
+ ----------
367
+ k
368
+ energies
369
+
370
+ Returns
371
+ -------
372
+ Density of states.
373
+
374
+ """
375
+ density_of_states = np.zeros(shape=energies.shape, dtype=np.float64)
376
+ bands, _ = self.diagonalize_bdg(k=k)
377
+ for i, energy in enumerate(energies):
378
+ density_of_states[i] = np.sum(
379
+ _gaussian(x=(energy - bands.flatten()), sigma=1e-2)
380
+ ) / len(k)
381
+ return density_of_states
382
+
383
+
384
+ def _gaussian(x: npt.NDArray[np.float64], sigma: float) -> npt.NDArray[np.float64]:
385
+ gaussian: npt.NDArray[np.float64] = np.exp(-(x**2) / (2 * sigma**2)) / np.sqrt(
386
+ 2 * np.pi * sigma**2
387
+ )
388
+ return gaussian
389
+
359
390
 
360
391
  def _fermi_dirac(energy: np.float64, beta: np.float64) -> np.float64:
361
392
  fermi_dirac: np.float64 = 1 / (1 + np.exp(beta * energy))
@@ -11,18 +11,17 @@ from .base_hamiltonian import BaseHamiltonian
11
11
 
12
12
 
13
13
  def quantum_metric(
14
- h: BaseHamiltonian, k_grid: npt.NDArray[np.float64], band: int
14
+ h: BaseHamiltonian, k_grid: npt.NDArray[np.float64], bands: list[int]
15
15
  ) -> npt.NDArray[np.float64]:
16
16
  """Calculate the quantum metric in the normal state.
17
17
 
18
18
  Parameters
19
19
  ----------
20
+ bands
20
21
  h : :class:`~quant_met.BaseHamiltonian`
21
22
  Hamiltonian object.
22
23
  k_grid : :class:`numpy.ndarray`
23
24
  List of k points.
24
- band : int
25
- Index of band for which the quantum metric is calculated.
26
25
 
27
26
  Returns
28
27
  -------
@@ -36,25 +35,26 @@ def quantum_metric(
36
35
 
37
36
  quantum_geom_tensor = np.zeros(shape=(2, 2), dtype=np.complex64)
38
37
 
39
- for i, direction_1 in enumerate(["x", "y"]):
40
- h_derivative_direction_1 = h.hamiltonian_derivative(k=k_grid, direction=direction_1)
41
- for j, direction_2 in enumerate(["x", "y"]):
42
- h_derivative_direction_2 = h.hamiltonian_derivative(k=k_grid, direction=direction_2)
43
- for k_index in range(len(k_grid)):
44
- for n in [i for i in range(h.number_of_bands) if i != band]:
45
- quantum_geom_tensor[i, j] += (
46
- (
47
- bloch[k_index][:, band].conjugate()
48
- @ h_derivative_direction_1[k_index]
49
- @ bloch[k_index][:, n]
50
- )
51
- * (
52
- bloch[k_index][:, n].conjugate()
53
- @ h_derivative_direction_2[k_index]
54
- @ bloch[k_index][:, band]
38
+ for band in bands:
39
+ for i, direction_1 in enumerate(["x", "y"]):
40
+ h_derivative_direction_1 = h.hamiltonian_derivative(k=k_grid, direction=direction_1)
41
+ for j, direction_2 in enumerate(["x", "y"]):
42
+ h_derivative_direction_2 = h.hamiltonian_derivative(k=k_grid, direction=direction_2)
43
+ for k_index in range(len(k_grid)):
44
+ for n in [i for i in range(h.number_of_bands) if i != band]:
45
+ quantum_geom_tensor[i, j] += (
46
+ (
47
+ bloch[k_index][:, band].conjugate()
48
+ @ h_derivative_direction_1[k_index]
49
+ @ bloch[k_index][:, n]
50
+ )
51
+ * (
52
+ bloch[k_index][:, n].conjugate()
53
+ @ h_derivative_direction_2[k_index]
54
+ @ bloch[k_index][:, band]
55
+ )
56
+ / (energies[k_index][band] - energies[k_index][n]) ** 2
55
57
  )
56
- / (energies[k_index][band] - energies[k_index][n]) ** 2
57
- )
58
58
 
59
59
  return np.real(quantum_geom_tensor) / number_k_points
60
60
 
@@ -66,12 +66,11 @@ def quantum_metric_bdg(
66
66
 
67
67
  Parameters
68
68
  ----------
69
+ bands
69
70
  h : :class:`~quant_met.BaseHamiltonian`
70
71
  Hamiltonian object.
71
72
  k_grid : :class:`numpy.ndarray`
72
73
  List of k points.
73
- band : int
74
- Index of band for which the quantum metric is calculated.
75
74
 
76
75
  Returns
77
76
  -------
@@ -91,7 +90,7 @@ def quantum_metric_bdg(
91
90
  for j, direction_2 in enumerate(["x", "y"]):
92
91
  h_derivative_dir_2 = h.bdg_hamiltonian_derivative(k=k_grid, direction=direction_2)
93
92
  for k_index in range(len(k_grid)):
94
- for n in [i for i in range(h.number_of_bands) if i != band]:
93
+ for n in [i for i in range(2 * h.number_of_bands) if i != band]:
95
94
  quantum_geom_tensor[i, j] += (
96
95
  (
97
96
  bdg_functions[k_index][:, band].conjugate()
@@ -28,18 +28,12 @@ def self_consistency_loop(
28
28
  rng = np.random.default_rng()
29
29
  delta_init = np.zeros(shape=h.delta_orbital_basis.shape, dtype=np.float64)
30
30
  rng.random(size=h.delta_orbital_basis.shape, out=delta_init)
31
- h.delta_orbital_basis = delta_init.astype(np.float64)
31
+ h.delta_orbital_basis = delta_init.astype(np.complex64)
32
32
 
33
33
  while True:
34
34
  new_gap = h.gap_equation(k=k_space_grid, beta=beta)
35
- if (np.abs(h.delta_orbital_basis - np.abs(new_gap)) < epsilon).all():
35
+ if (np.abs(h.delta_orbital_basis - new_gap) < epsilon).all():
36
36
  h.delta_orbital_basis = new_gap
37
- print("Finished")
38
37
  return h
39
- """
40
- print(f"Old: {h.delta_orbital_basis}")
41
- print(f"New: {new_gap}")
42
- print(f"Difference {np.abs(h.delta_orbital_basis) - np.abs(new_gap)}")
43
- """
44
38
  mixing_greed = 0.2
45
39
  h.delta_orbital_basis = mixing_greed * new_gap + (1 - mixing_greed) * h.delta_orbital_basis
File without changes
File without changes
File without changes