quant-met 0.0.16__py3-none-any.whl → 0.0.18__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.
Files changed (32) hide show
  1. quant_met/cli/scf.py +27 -3
  2. quant_met/geometry/__init__.py +1 -1
  3. quant_met/geometry/base_lattice.py +6 -6
  4. quant_met/geometry/bz_path.py +6 -6
  5. quant_met/geometry/graphene.py +3 -3
  6. quant_met/geometry/square.py +3 -3
  7. quant_met/mean_field/__init__.py +2 -4
  8. quant_met/mean_field/hamiltonians/__init__.py +1 -1
  9. quant_met/mean_field/hamiltonians/base_hamiltonian.py +288 -52
  10. quant_met/mean_field/hamiltonians/dressed_graphene.py +6 -6
  11. quant_met/mean_field/hamiltonians/graphene.py +6 -6
  12. quant_met/mean_field/hamiltonians/one_band_tight_binding.py +6 -6
  13. quant_met/mean_field/hamiltonians/three_band_tight_binding.py +6 -6
  14. quant_met/mean_field/hamiltonians/two_band_tight_binding.py +6 -6
  15. quant_met/mean_field/quantum_metric.py +3 -3
  16. quant_met/mean_field/search_crit_temp.py +3 -3
  17. quant_met/mean_field/self_consistency.py +13 -9
  18. quant_met/parameters/__init__.py +5 -5
  19. quant_met/parameters/hamiltonians.py +8 -8
  20. quant_met/parameters/main.py +1 -0
  21. quant_met/plotting/__init__.py +1 -1
  22. quant_met/plotting/plotting.py +9 -9
  23. quant_met/utils.py +27 -5
  24. {quant_met-0.0.16.dist-info → quant_met-0.0.18.dist-info}/METADATA +21 -23
  25. quant_met-0.0.18.dist-info/RECORD +34 -0
  26. {quant_met-0.0.16.dist-info → quant_met-0.0.18.dist-info}/WHEEL +1 -1
  27. quant_met-0.0.18.dist-info/entry_points.txt +2 -0
  28. quant_met/mean_field/superfluid_weight.py +0 -123
  29. quant_met-0.0.16.dist-info/LICENSES/MIT.txt +0 -9
  30. quant_met-0.0.16.dist-info/RECORD +0 -36
  31. quant_met-0.0.16.dist-info/entry_points.txt +0 -3
  32. {quant_met-0.0.16.dist-info → quant_met-0.0.18.dist-info/licenses}/LICENSE.txt +0 -0
quant_met/cli/scf.py CHANGED
@@ -7,6 +7,8 @@
7
7
  import logging
8
8
  from pathlib import Path
9
9
 
10
+ import h5py
11
+
10
12
  from quant_met import mean_field
11
13
  from quant_met.parameters import Parameters
12
14
 
@@ -28,12 +30,13 @@ def scf(parameters: Parameters) -> None:
28
30
  result_path.mkdir(exist_ok=True, parents=True)
29
31
 
30
32
  h = _hamiltonian_factory(parameters=parameters.model, classname=parameters.model.name)
33
+ k_space_grid = h.lattice.generate_bz_grid(
34
+ ncols=parameters.k_points.nk1, nrows=parameters.k_points.nk2
35
+ )
31
36
 
32
37
  solved_h = mean_field.self_consistency_loop(
33
38
  h=h,
34
- k_space_grid=h.lattice.generate_bz_grid(
35
- ncols=parameters.k_points.nk1, nrows=parameters.k_points.nk2
36
- ),
39
+ k_space_grid=k_space_grid,
37
40
  epsilon=parameters.control.conv_treshold,
38
41
  max_iter=parameters.control.max_iter,
39
42
  )
@@ -44,3 +47,24 @@ def scf(parameters: Parameters) -> None:
44
47
  result_file = result_path / f"{parameters.control.prefix}.hdf5"
45
48
  solved_h.save(filename=result_file)
46
49
  logger.info("Results saved to %s", result_file)
50
+
51
+ if parameters.control.calculate_additional is True:
52
+ logger.info("Calculating additional things.")
53
+ current = solved_h.calculate_current_density(k=k_space_grid)
54
+ free_energy = solved_h.calculate_free_energy(k=k_space_grid)
55
+ sf_weight_conv, sf_weight_geom = solved_h.calculate_superfluid_weight(k=k_space_grid)
56
+
57
+ with h5py.File(result_file, "a") as f:
58
+ f.attrs["current_x"] = current[0]
59
+ f.attrs["current_y"] = current[1]
60
+ f.attrs["free_energy"] = free_energy
61
+ f.attrs["sf_weight_conv_xx"] = sf_weight_conv[0, 0]
62
+ f.attrs["sf_weight_conv_xy"] = sf_weight_conv[0, 1]
63
+ f.attrs["sf_weight_conv_yx"] = sf_weight_conv[1, 0]
64
+ f.attrs["sf_weight_conv_yy"] = sf_weight_conv[1, 1]
65
+ f.attrs["sf_weight_geom_xx"] = sf_weight_geom[0, 0]
66
+ f.attrs["sf_weight_geom_xy"] = sf_weight_geom[0, 1]
67
+ f.attrs["sf_weight_geom_yx"] = sf_weight_geom[1, 0]
68
+ f.attrs["sf_weight_geom_yy"] = sf_weight_geom[1, 1]
69
+
70
+ logger.info("Additional results saved to %s", result_file)
@@ -32,4 +32,4 @@ from .bz_path import generate_bz_path
32
32
  from .graphene import GrapheneLattice
33
33
  from .square import SquareLattice
34
34
 
35
- __all__ = ["generate_bz_path", "BaseLattice", "GrapheneLattice", "SquareLattice"]
35
+ __all__ = ["BaseLattice", "GrapheneLattice", "SquareLattice", "generate_bz_path"]
@@ -25,7 +25,7 @@ class BaseLattice(ABC):
25
25
 
26
26
  @property
27
27
  @abstractmethod
28
- def bz_corners(self) -> npt.NDArray[np.float64]: # pragma: no cover
28
+ def bz_corners(self) -> npt.NDArray[np.floating]: # pragma: no cover
29
29
  """Corners of the BZ."""
30
30
  raise NotImplementedError
31
31
 
@@ -33,7 +33,7 @@ class BaseLattice(ABC):
33
33
  @abstractmethod
34
34
  def reciprocal_basis(
35
35
  self,
36
- ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: # pragma: no cover
36
+ ) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]]: # pragma: no cover
37
37
  """Reciprocal basis vectors."""
38
38
  raise NotImplementedError
39
39
 
@@ -41,11 +41,11 @@ class BaseLattice(ABC):
41
41
  @abstractmethod
42
42
  def high_symmetry_points(
43
43
  self,
44
- ) -> tuple[tuple[npt.NDArray[np.float64], str], ...]: # pragma: no cover
44
+ ) -> tuple[tuple[npt.NDArray[np.floating], str], ...]: # pragma: no cover
45
45
  """Tuple of high symmetry points and names."""
46
46
  raise NotImplementedError
47
47
 
48
- def generate_bz_grid(self, ncols: int, nrows: int) -> npt.NDArray[np.float64]:
48
+ def generate_bz_grid(self, ncols: int, nrows: int) -> npt.NDArray[np.floating]:
49
49
  """Generate a grid in the BZ.
50
50
 
51
51
  Parameters
@@ -72,8 +72,8 @@ class BaseLattice(ABC):
72
72
  def generate_high_symmetry_path(
73
73
  self, number_of_points: int
74
74
  ) -> tuple[
75
- npt.NDArray[np.float64],
76
- npt.NDArray[np.float64],
75
+ npt.NDArray[np.floating],
76
+ npt.NDArray[np.floating],
77
77
  list[float],
78
78
  list[str],
79
79
  ]:
@@ -9,11 +9,11 @@ import numpy.typing as npt
9
9
 
10
10
 
11
11
  def _generate_part_of_path(
12
- p_0: npt.NDArray[np.float64],
13
- p_1: npt.NDArray[np.float64],
12
+ p_0: npt.NDArray[np.floating],
13
+ p_1: npt.NDArray[np.floating],
14
14
  n: int,
15
15
  length_whole_path: int,
16
- ) -> npt.NDArray[np.float64]:
16
+ ) -> npt.NDArray[np.floating]:
17
17
  distance = np.linalg.norm(p_1 - p_0)
18
18
  number_of_points = int(n * distance / length_whole_path) + 1
19
19
 
@@ -26,10 +26,10 @@ def _generate_part_of_path(
26
26
 
27
27
 
28
28
  def generate_bz_path(
29
- points: list[tuple[npt.NDArray[np.float64], str]], number_of_points: int = 1000
29
+ points: list[tuple[npt.NDArray[np.floating], str]], number_of_points: int = 1000
30
30
  ) -> tuple[
31
- npt.NDArray[np.float64],
32
- npt.NDArray[np.float64],
31
+ npt.NDArray[np.floating],
32
+ npt.NDArray[np.floating],
33
33
  list[float],
34
34
  list[str],
35
35
  ]:
@@ -35,13 +35,13 @@ class GrapheneLattice(BaseLattice):
35
35
  return self._lattice_constant
36
36
 
37
37
  @property
38
- def bz_corners(self) -> npt.NDArray[np.float64]: # noqa: D102
38
+ def bz_corners(self) -> npt.NDArray[np.floating]: # noqa: D102
39
39
  return self._bz_corners
40
40
 
41
41
  @property
42
- def reciprocal_basis(self) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: # noqa: D102
42
+ def reciprocal_basis(self) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]]: # noqa: D102
43
43
  return self._reciprocal_basis
44
44
 
45
45
  @property
46
- def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.float64], str], ...]: # noqa: D102
46
+ def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.floating], str], ...]: # noqa: D102
47
47
  return self._high_symmetry_points
@@ -34,13 +34,13 @@ class SquareLattice(BaseLattice):
34
34
  return self._lattice_constant
35
35
 
36
36
  @property
37
- def bz_corners(self) -> npt.NDArray[np.float64]: # noqa: D102 # pragma: no cover
37
+ def bz_corners(self) -> npt.NDArray[np.floating]: # noqa: D102 # pragma: no cover
38
38
  return self._bz_corners
39
39
 
40
40
  @property
41
- def reciprocal_basis(self) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: # noqa: D102
41
+ def reciprocal_basis(self) -> tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]]: # noqa: D102
42
42
  return self._reciprocal_basis
43
43
 
44
44
  @property
45
- def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.float64], str], ...]: # noqa: D102
45
+ def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.floating], str], ...]: # noqa: D102
46
46
  return self._high_symmetry_points
@@ -32,12 +32,10 @@ from quant_met.mean_field import hamiltonians
32
32
  from .quantum_metric import quantum_metric
33
33
  from .search_crit_temp import search_crit_temp
34
34
  from .self_consistency import self_consistency_loop
35
- from .superfluid_weight import superfluid_weight
36
35
 
37
36
  __all__ = [
38
- "superfluid_weight",
37
+ "hamiltonians",
39
38
  "quantum_metric",
40
- "self_consistency_loop",
41
39
  "search_crit_temp",
42
- "hamiltonians",
40
+ "self_consistency_loop",
43
41
  ]
@@ -30,4 +30,4 @@ from .one_band_tight_binding import OneBand
30
30
  from .three_band_tight_binding import ThreeBand
31
31
  from .two_band_tight_binding import TwoBand
32
32
 
33
- __all__ = ["BaseHamiltonian", "Graphene", "DressedGraphene", "OneBand", "TwoBand", "ThreeBand"]
33
+ __all__ = ["BaseHamiltonian", "DressedGraphene", "Graphene", "OneBand", "ThreeBand", "TwoBand"]