quant-met 0.0.20__py3-none-any.whl → 0.0.22__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.
@@ -29,13 +29,11 @@ Functions
29
29
 
30
30
  from quant_met.mean_field import hamiltonians
31
31
 
32
- from .quantum_metric import quantum_metric
33
32
  from .search_crit_temp import search_crit_temp
34
33
  from .self_consistency import self_consistency_loop
35
34
 
36
35
  __all__ = [
37
36
  "hamiltonians",
38
- "quantum_metric",
39
37
  "search_crit_temp",
40
38
  "self_consistency_loop",
41
39
  ]
@@ -714,13 +714,72 @@ class BaseHamiltonian(Generic[GenericParameters], ABC):
714
714
  bdg_functions[i, m].conjugate()
715
715
  * bdg_functions[j, n]
716
716
  * bdg_functions[j, p].conjugate()
717
- * bdg_functions[i, q].conjugate()
717
+ * bdg_functions[i, q]
718
718
  )
719
719
 
720
720
  c_mnpq[m, n, p, q] = 2 * c_tmp
721
721
 
722
722
  return c_mnpq
723
723
 
724
+ def calculate_quantum_metric(
725
+ self, k: npt.NDArray[np.floating], bands: list[int]
726
+ ) -> npt.NDArray[np.floating]:
727
+ """Calculate the quantum metric (geometric tensor) for specified bands.
728
+
729
+ This function computes the quantum geometric tensor associated with
730
+ the specified bands of a given Hamiltonian over a grid of k-points.
731
+ The output is a 2x2 matrix representing the quantum metric.
732
+
733
+ Parameters
734
+ ----------
735
+ h : BaseHamiltonian
736
+ Hamiltonian object used to compute Bloch states and their derivatives.
737
+ k : numpy.ndarray
738
+ Array of k points in the Brillouin zone.
739
+ bands : list of int
740
+ Indices of the bands for which the quantum metric is to be calculated.
741
+
742
+ Returns
743
+ -------
744
+ :class:`numpy.ndarray`
745
+ A 2x2 matrix representing the quantum metric.
746
+
747
+ Raises
748
+ ------
749
+ ValueError
750
+ If `bands` contains invalid indices or `k_grid` is empty.
751
+ """
752
+ energies, bloch = self.diagonalize_nonint(k)
753
+
754
+ number_k_points = len(k)
755
+
756
+ quantum_geom_tensor = np.zeros(shape=(2, 2), dtype=np.complex128)
757
+
758
+ for band in bands:
759
+ for i, direction_1 in enumerate(["x", "y"]):
760
+ h_derivative_direction_1 = self.hamiltonian_derivative(k=k, direction=direction_1)
761
+ for j, direction_2 in enumerate(["x", "y"]):
762
+ h_derivative_direction_2 = self.hamiltonian_derivative(
763
+ k=k, direction=direction_2
764
+ )
765
+ for k_index in range(len(k)):
766
+ for n in [m for m in range(self.number_of_bands) if m != band]:
767
+ quantum_geom_tensor[i, j] += (
768
+ (
769
+ bloch[k_index][:, band].conjugate()
770
+ @ h_derivative_direction_1[k_index]
771
+ @ bloch[k_index][:, n]
772
+ )
773
+ * (
774
+ bloch[k_index][:, n].conjugate()
775
+ @ h_derivative_direction_2[k_index]
776
+ @ bloch[k_index][:, band]
777
+ )
778
+ / (energies[k_index][band] - energies[k_index][n]) ** 2
779
+ )
780
+
781
+ return np.real(quantum_geom_tensor) / number_k_points
782
+
724
783
 
725
784
  def _fermi_dirac_derivative() -> float:
726
785
  return 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quant-met
3
- Version: 0.0.20
3
+ Version: 0.0.22
4
4
  Summary: Calculate superconductivity in flat-band systems.
5
5
  Author-email: Tjark Sievers <tsievers@physnet.uni-hamburg.de>
6
6
  License-File: LICENSE.txt
@@ -14,13 +14,12 @@ quant_met/geometry/base_lattice.py,sha256=OJNDMyzJB-0hK1BLgF-SV4jUYfOSUksIv1XG1b
14
14
  quant_met/geometry/bz_path.py,sha256=vwN5RxyrgFkHTSqm_6cWuOigICgxa-FX5NZ7SkgKScw,2503
15
15
  quant_met/geometry/graphene.py,sha256=ZLE55wV1E-jRCkGxW66pca2y5VWaNtMmXiXi-HB6bgs,1627
16
16
  quant_met/geometry/square.py,sha256=17XZH79lK9TeeDtXiBBa8rd2d9kv5yt2S9F6te0YZPU,1565
17
- quant_met/mean_field/__init__.py,sha256=dO7ATRQyes96tr2WMvmPPqr_S90WL2RCHquRdXWaSjU,662
17
+ quant_met/mean_field/__init__.py,sha256=Unweog9Tst1NxUMQ4X1OYiUQtyxI2ho-OQoCaekoMFk,597
18
18
  quant_met/mean_field/_utils.py,sha256=7hr0DDSdIqjft5Jjluvbw_HGoNLWgYJTxyuPJJvhBnc,356
19
- quant_met/mean_field/quantum_metric.py,sha256=aiZLdUsWmoBLunv-aJr_BCQVfhD7t0GHbeYrT60s3cI,2583
20
19
  quant_met/mean_field/search_crit_temp.py,sha256=Z9te3O7zsyBGLRrPjmNA85vxHOfBfIQ7svdDVFEJedg,8782
21
20
  quant_met/mean_field/self_consistency.py,sha256=YY_zhCurxOK3RLkK-Hglfkx33uhsvqpoAKOP4FuPdfo,3371
22
21
  quant_met/mean_field/hamiltonians/__init__.py,sha256=r-8TaLqRnRbAro-TMIyxzCCZHwVqyKrausODpQJb2tw,681
23
- quant_met/mean_field/hamiltonians/base_hamiltonian.py,sha256=5Dtka_WJKj1lh-Ty36Z4GENSkbwWwsJxn_yljSI4cJw,26880
22
+ quant_met/mean_field/hamiltonians/base_hamiltonian.py,sha256=xoSpPy5qUXN3jCB6M6mh9oshDPLFfw8kbWBo1VsGGUw,29371
24
23
  quant_met/mean_field/hamiltonians/dressed_graphene.py,sha256=Q5LiA3rgK88ZZV1V7JflgjlkEpve7uNZFzFCIoQND-w,4048
25
24
  quant_met/mean_field/hamiltonians/graphene.py,sha256=sa3H8jVq9Fkc_qcz5gJTCMgN8YD3N18JWLRBImhLyxo,3276
26
25
  quant_met/mean_field/hamiltonians/one_band_tight_binding.py,sha256=DZXaD95yWv1VZSMqgxkqEZv3PGihNGy7PuqupnN75ew,2512
@@ -31,8 +30,8 @@ quant_met/parameters/hamiltonians.py,sha256=PiWVV-miCdT4Z9GWloDVvIU_1QpRHHV-zVOg
31
30
  quant_met/parameters/main.py,sha256=QP7Z24-QePMcy6txujqxbx5ztQTdC67m6elNsJtGtXQ,2325
32
31
  quant_met/plotting/__init__.py,sha256=VypHrLAGmCiQaQggGh5Cs4EF4YAjRiETddf_7mOX9MQ,544
33
32
  quant_met/plotting/plotting.py,sha256=4ZYclWJH3hlE8S7b7bL_JJlP3CKaCGcVzdIsqolCAaM,6592
34
- quant_met-0.0.20.dist-info/METADATA,sha256=ngtl5LaLCHQ0j2en5vFuMxNlpk7YHbkcQ6LeF_H7c6Y,1978
35
- quant_met-0.0.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
- quant_met-0.0.20.dist-info/entry_points.txt,sha256=1Al3Kt-cMeQxwMp84ZSNL0qFwlbOVBu1o8A19MH8lEU,48
37
- quant_met-0.0.20.dist-info/licenses/LICENSE.txt,sha256=QO_duPQihSJlaxSLxPAXo52X3esROP5wBkhxqBd1Z4E,1104
38
- quant_met-0.0.20.dist-info/RECORD,,
33
+ quant_met-0.0.22.dist-info/METADATA,sha256=ELPjCoeSLhAy0iwhHCkW0cD3eMSFOQHuTB1J8UsuuJI,1978
34
+ quant_met-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ quant_met-0.0.22.dist-info/entry_points.txt,sha256=1Al3Kt-cMeQxwMp84ZSNL0qFwlbOVBu1o8A19MH8lEU,48
36
+ quant_met-0.0.22.dist-info/licenses/LICENSE.txt,sha256=QO_duPQihSJlaxSLxPAXo52X3esROP5wBkhxqBd1Z4E,1104
37
+ quant_met-0.0.22.dist-info/RECORD,,
@@ -1,69 +0,0 @@
1
- # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
- #
3
- # SPDX-License-Identifier: MIT
4
-
5
- """Functions to calculate the quantum metric."""
6
-
7
- import numpy as np
8
- import numpy.typing as npt
9
-
10
- from quant_met.mean_field.hamiltonians.base_hamiltonian import BaseHamiltonian
11
- from quant_met.parameters import GenericParameters
12
-
13
-
14
- def quantum_metric(
15
- h: BaseHamiltonian[GenericParameters], k: npt.NDArray[np.floating], bands: list[int]
16
- ) -> npt.NDArray[np.floating]:
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.
22
-
23
- Parameters
24
- ----------
25
- h : BaseHamiltonian
26
- Hamiltonian object used to compute Bloch states and their derivatives.
27
- k : 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.
31
-
32
- Returns
33
- -------
34
- :class:`numpy.ndarray`
35
- A 2x2 matrix representing the quantum metric.
36
-
37
- Raises
38
- ------
39
- ValueError
40
- If `bands` contains invalid indices or `k_grid` is empty.
41
- """
42
- energies, bloch = h.diagonalize_nonint(k)
43
-
44
- number_k_points = len(k)
45
-
46
- quantum_geom_tensor = np.zeros(shape=(2, 2), dtype=np.complex128)
47
-
48
- for band in bands:
49
- for i, direction_1 in enumerate(["x", "y"]):
50
- h_derivative_direction_1 = h.hamiltonian_derivative(k=k, direction=direction_1)
51
- for j, direction_2 in enumerate(["x", "y"]):
52
- h_derivative_direction_2 = h.hamiltonian_derivative(k=k, direction=direction_2)
53
- for k_index in range(len(k)):
54
- for n in [i for i in range(h.number_of_bands) if i != band]:
55
- quantum_geom_tensor[i, j] += (
56
- (
57
- bloch[k_index][:, band].conjugate()
58
- @ h_derivative_direction_1[k_index]
59
- @ bloch[k_index][:, n]
60
- )
61
- * (
62
- bloch[k_index][:, n].conjugate()
63
- @ h_derivative_direction_2[k_index]
64
- @ bloch[k_index][:, band]
65
- )
66
- / (energies[k_index][band] - energies[k_index][n]) ** 2
67
- )
68
-
69
- return np.real(quantum_geom_tensor) / number_k_points