quant-met 0.0.7__tar.gz → 0.0.9__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 (35) hide show
  1. {quant_met-0.0.7 → quant_met-0.0.9}/PKG-INFO +5 -3
  2. {quant_met-0.0.7 → quant_met-0.0.9}/pyproject.toml +12 -4
  3. quant_met-0.0.9/src/quant_met/cli/__init__.py +22 -0
  4. quant_met-0.0.9/src/quant_met/cli/main.py +34 -0
  5. quant_met-0.0.9/src/quant_met/cli/scf.py +40 -0
  6. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/geometry/__init__.py +12 -3
  7. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/geometry/base_lattice.py +18 -4
  8. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/geometry/graphene.py +11 -3
  9. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/geometry/square.py +11 -3
  10. quant_met-0.0.9/src/quant_met/mean_field/__init__.py +42 -0
  11. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/mean_field/_utils.py +0 -11
  12. quant_met-0.0.9/src/quant_met/mean_field/hamiltonians/__init__.py +31 -0
  13. {quant_met-0.0.7/src/quant_met/mean_field → quant_met-0.0.9/src/quant_met/mean_field/hamiltonians}/base_hamiltonian.py +88 -77
  14. quant_met-0.0.7/src/quant_met/mean_field/eg_x.py → quant_met-0.0.9/src/quant_met/mean_field/hamiltonians/dressed_graphene.py +26 -58
  15. {quant_met-0.0.7/src/quant_met/mean_field → quant_met-0.0.9/src/quant_met/mean_field/hamiltonians}/graphene.py +20 -45
  16. {quant_met-0.0.7/src/quant_met/mean_field → quant_met-0.0.9/src/quant_met/mean_field/hamiltonians}/one_band_tight_binding.py +20 -48
  17. quant_met-0.0.9/src/quant_met/mean_field/hamiltonians/three_band_tight_binding.py +116 -0
  18. quant_met-0.0.9/src/quant_met/mean_field/hamiltonians/two_band_tight_binding.py +107 -0
  19. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/mean_field/quantum_metric.py +4 -3
  20. quant_met-0.0.9/src/quant_met/mean_field/self_consistency.py +40 -0
  21. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/mean_field/superfluid_weight.py +7 -4
  22. quant_met-0.0.9/src/quant_met/parameters/__init__.py +36 -0
  23. quant_met-0.0.9/src/quant_met/parameters/hamiltonians.py +147 -0
  24. quant_met-0.0.9/src/quant_met/parameters/main.py +37 -0
  25. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/utils.py +1 -1
  26. quant_met-0.0.7/src/quant_met/mean_field/__init__.py +0 -65
  27. quant_met-0.0.7/src/quant_met/mean_field/free_energy.py +0 -130
  28. quant_met-0.0.7/src/quant_met/mean_field/self_consistency.py +0 -39
  29. {quant_met-0.0.7 → quant_met-0.0.9}/LICENSE.txt +0 -0
  30. {quant_met-0.0.7 → quant_met-0.0.9}/LICENSES/MIT.txt +0 -0
  31. {quant_met-0.0.7 → quant_met-0.0.9}/README.md +0 -0
  32. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/__init__.py +0 -0
  33. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/geometry/bz_path.py +0 -0
  34. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/plotting/__init__.py +0 -0
  35. {quant_met-0.0.7 → quant_met-0.0.9}/src/quant_met/plotting/plotting.py +0 -0
@@ -1,19 +1,21 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quant-met
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Calculate superconductivity in flat-band systems.
5
5
  Home-page: https://quant-met.tjarksievers.de
6
6
  Author: Tjark Sievers
7
7
  Author-email: tsievers@physnet.uni-hamburg.de
8
- Requires-Python: >=3.11,<4.0
8
+ Requires-Python: >=3.11,<3.13
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Dist: click (>=8.1.7,<9.0.0)
13
13
  Requires-Dist: h5py (>=3.12.1,<4.0.0)
14
14
  Requires-Dist: matplotlib (>=3.9.2,<4.0.0)
15
15
  Requires-Dist: numpy (>=2.1.2,<3.0.0)
16
+ Requires-Dist: numpydantic (>=1.6.4,<2.0.0)
16
17
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
18
+ Requires-Dist: pydantic (>=2.9.2,<3.0.0)
17
19
  Requires-Dist: scipy (>=1.14.1,<2.0.0)
18
20
  Project-URL: Repository, https://github.com/Ruberhauptmann/quant-met
19
21
  Description-Content-Type: text/markdown
@@ -4,24 +4,30 @@
4
4
 
5
5
  [project]
6
6
  name = "quant-met"
7
- requires-python = ">=3.12"
7
+ requires-python = ">=3.11,<3.13"
8
8
 
9
9
  [tool.poetry]
10
10
  name = "quant-met"
11
- version = "0.0.7"
11
+ version = "0.0.9"
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"
15
15
  repository = "https://github.com/Ruberhauptmann/quant-met"
16
16
  readme = "README.md"
17
17
 
18
+ [tool.poetry.scripts]
19
+ quant-met = 'quant_met.cli:cli'
20
+
18
21
  [tool.poetry.dependencies]
19
- python = "^3.11"
22
+ python = ">=3.11,<3.13"
20
23
  numpy = "^2.1.2"
21
24
  scipy = "^1.14.1"
22
25
  matplotlib = "^3.9.2"
23
26
  pandas = "^2.2.3"
24
27
  h5py = "^3.12.1"
28
+ pydantic = "^2.9.2"
29
+ click = "^8.1.7"
30
+ numpydantic = "^1.6.4"
25
31
 
26
32
  [tool.poetry.group.dev.dependencies]
27
33
  pre-commit = "^3.7.0"
@@ -42,6 +48,7 @@ hypothesis = {extras = ["numpy"], version = "^6.103.0"}
42
48
  pytest-regressions = "^2.5.0"
43
49
  numpydoc = "^1.7.0"
44
50
  ruff = "^0.5.0"
51
+ types-pyyaml = "^6.0.12.20240917"
45
52
 
46
53
  [build-system]
47
54
  requires = ["poetry-core"]
@@ -51,7 +58,8 @@ build-backend = "poetry.core.masonry.api"
51
58
  [tool.ruff]
52
59
  line-length = 100
53
60
  force-exclude = true
54
- extend-exclude = ["tests", "docs/source/conf.py"]
61
+ #extend-exclude = ["tests", "docs/source/conf.py"]
62
+ extend-exclude = ["docs/source/conf.py"]
55
63
 
56
64
  [tool.ruff.lint]
57
65
  #select = []
@@ -0,0 +1,22 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """
6
+ Command-Line-Interface (:mod:`quant_met.cli`)
7
+ =============================================
8
+
9
+ Functions
10
+ ---------
11
+
12
+ .. autosummary::
13
+ :toctree: generated/
14
+
15
+ cli
16
+ """ # noqa: D205, D400
17
+
18
+ from .main import cli
19
+
20
+ __all__ = [
21
+ "cli",
22
+ ]
@@ -0,0 +1,34 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """Command line interface."""
6
+
7
+ import sys
8
+ from typing import TextIO
9
+
10
+ import click
11
+ import yaml
12
+
13
+ from quant_met.parameters import Parameters
14
+
15
+ from .scf import scf
16
+
17
+
18
+ @click.command()
19
+ @click.argument("input-file", type=click.File("r"))
20
+ def cli(input_file: TextIO) -> None:
21
+ """Command line interface for quant-met.
22
+
23
+ Parameters
24
+ ----------
25
+ input_file
26
+ """
27
+ params = Parameters(**yaml.safe_load(input_file))
28
+
29
+ match params.control.calculation:
30
+ case "scf":
31
+ scf(params)
32
+ case _:
33
+ print(f"Calculation {params.control.calculation} not found.")
34
+ sys.exit(1)
@@ -0,0 +1,40 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """Functions to run self-consistent calculation for the order parameter."""
6
+
7
+ from pathlib import Path
8
+
9
+ from quant_met import mean_field
10
+ from quant_met.mean_field.hamiltonians import BaseHamiltonian
11
+ from quant_met.parameters import Parameters
12
+ from quant_met.parameters.hamiltonians import HamiltonianParameters
13
+
14
+
15
+ def _hamiltonian_factory(
16
+ classname: str, parameters: HamiltonianParameters
17
+ ) -> BaseHamiltonian[HamiltonianParameters]:
18
+ """Create a hamiltonian by its class name."""
19
+ from quant_met.mean_field import hamiltonians
20
+
21
+ cls = getattr(hamiltonians, classname)
22
+ h: BaseHamiltonian[HamiltonianParameters] = cls(parameters)
23
+ return h
24
+
25
+
26
+ def scf(parameters: Parameters) -> None:
27
+ """Self-consistent calculation for the order parameter."""
28
+ result_path = Path(parameters.control.outdir)
29
+ result_path.mkdir(exist_ok=True, parents=True)
30
+ h = _hamiltonian_factory(parameters=parameters.model, classname=parameters.model.name)
31
+ solved_h = mean_field.self_consistency_loop(
32
+ h=h,
33
+ k_space_grid=h.lattice.generate_bz_grid(
34
+ ncols=parameters.k_points.nk1, nrows=parameters.k_points.nk2
35
+ ),
36
+ epsilon=parameters.control.conv_treshold,
37
+ )
38
+ print(solved_h.delta_orbital_basis)
39
+ result_file = result_path / f"{parameters.control.prefix}.hdf5"
40
+ solved_h.save(filename=result_file)
@@ -15,12 +15,21 @@ Functions
15
15
  :toctree: generated/
16
16
 
17
17
  generate_bz_path
18
- Graphene
18
+
19
+ Classes
20
+ -------
21
+
22
+ .. autosummary::
23
+ :toctree: generated/
24
+
25
+ BaseLattice
26
+ GrapheneLattice
27
+ SquareLattice
19
28
  """ # noqa: D205, D400
20
29
 
21
30
  from .base_lattice import BaseLattice
22
31
  from .bz_path import generate_bz_path
23
- from .graphene import Graphene
32
+ from .graphene import GrapheneLattice
24
33
  from .square import SquareLattice
25
34
 
26
- __all__ = ["generate_bz_path", "BaseLattice", "Graphene", "SquareLattice"]
35
+ __all__ = ["generate_bz_path", "BaseLattice", "GrapheneLattice", "SquareLattice"]
@@ -19,19 +19,29 @@ class BaseLattice(ABC):
19
19
 
20
20
  @property
21
21
  @abstractmethod
22
- def lattice_constant(self) -> np.float64:
22
+ def lattice_constant(self) -> float: # pragma: no cover
23
23
  """Lattice constant."""
24
24
  raise NotImplementedError
25
25
 
26
26
  @property
27
27
  @abstractmethod
28
- def bz_corners(self) -> npt.NDArray[np.float64]:
28
+ def bz_corners(self) -> npt.NDArray[np.float64]: # pragma: no cover
29
29
  """Corners of the BZ."""
30
30
  raise NotImplementedError
31
31
 
32
32
  @property
33
33
  @abstractmethod
34
- def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.float64], str], ...]:
34
+ def reciprocal_basis(
35
+ self,
36
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: # pragma: no cover
37
+ """Reciprocal basis vectors."""
38
+ raise NotImplementedError
39
+
40
+ @property
41
+ @abstractmethod
42
+ def high_symmetry_points(
43
+ self,
44
+ ) -> tuple[tuple[npt.NDArray[np.float64], str], ...]: # pragma: no cover
35
45
  """Tuple of high symmetry points and names."""
36
46
  raise NotImplementedError
37
47
 
@@ -52,7 +62,11 @@ class BaseLattice(ABC):
52
62
 
53
63
  """
54
64
  return generate_uniform_grid(
55
- ncols, nrows, self.bz_corners[0], self.bz_corners[1], origin=np.array([0, 0])
65
+ ncols,
66
+ nrows,
67
+ self.reciprocal_basis[0],
68
+ self.reciprocal_basis[1],
69
+ origin=np.array([0, 0]),
56
70
  )
57
71
 
58
72
  def generate_high_symmetry_path(
@@ -10,10 +10,10 @@ import numpy.typing as npt
10
10
  from .base_lattice import BaseLattice
11
11
 
12
12
 
13
- class Graphene(BaseLattice):
13
+ class GrapheneLattice(BaseLattice):
14
14
  """Lattice geometry for Graphene."""
15
15
 
16
- def __init__(self, lattice_constant: np.float64) -> None:
16
+ def __init__(self, lattice_constant: float) -> None:
17
17
  self._lattice_constant = lattice_constant
18
18
  self._bz_corners = (
19
19
  4
@@ -25,15 +25,23 @@ class Graphene(BaseLattice):
25
25
  self.M = np.pi / self.lattice_constant * np.array([1, 1 / np.sqrt(3)])
26
26
  self.K = 4 * np.pi / (3 * self.lattice_constant) * np.array([1, 0])
27
27
  self._high_symmetry_points = ((self.M, "M"), (self.Gamma, r"\Gamma"), (self.K, "K"))
28
+ self._reciprocal_basis = (
29
+ 2 * np.pi / self.lattice_constant * np.array([1, 1 / np.sqrt(3)]),
30
+ 2 * np.pi / self.lattice_constant * np.array([1, -1 / np.sqrt(3)]),
31
+ )
28
32
 
29
33
  @property
30
- def lattice_constant(self) -> np.float64: # noqa: D102
34
+ def lattice_constant(self) -> float: # noqa: D102
31
35
  return self._lattice_constant
32
36
 
33
37
  @property
34
38
  def bz_corners(self) -> npt.NDArray[np.float64]: # noqa: D102
35
39
  return self._bz_corners
36
40
 
41
+ @property
42
+ def reciprocal_basis(self) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: # noqa: D102
43
+ return self._reciprocal_basis
44
+
37
45
  @property
38
46
  def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.float64], str], ...]: # noqa: D102
39
47
  return self._high_symmetry_points
@@ -13,26 +13,34 @@ from .base_lattice import BaseLattice
13
13
  class SquareLattice(BaseLattice):
14
14
  """Lattice geometry for Square Lattice."""
15
15
 
16
- def __init__(self, lattice_constant: np.float64) -> None:
16
+ def __init__(self, lattice_constant: float) -> None:
17
17
  self._lattice_constant = lattice_constant
18
18
  self._bz_corners = (
19
19
  np.pi
20
20
  / lattice_constant
21
21
  * np.array([np.array([1, 1]), np.array([-1, 1]), np.array([1, -1]), np.array([-1, -1])])
22
22
  )
23
+ self._reciprocal_basis = (
24
+ 2 * np.pi / self.lattice_constant * np.array([1, 0]),
25
+ 2 * np.pi / self.lattice_constant * np.array([0, 1]),
26
+ )
23
27
  self.Gamma = np.array([0, 0])
24
28
  self.M = np.pi / lattice_constant * np.array([1, 1])
25
29
  self.X = np.pi / lattice_constant * np.array([1, 0])
26
30
  self._high_symmetry_points = ((self.Gamma, r"\Gamma"), (self.M, "M"))
27
31
 
28
32
  @property
29
- def lattice_constant(self) -> np.float64: # noqa: D102
33
+ def lattice_constant(self) -> float: # noqa: D102
30
34
  return self._lattice_constant
31
35
 
32
36
  @property
33
- def bz_corners(self) -> npt.NDArray[np.float64]: # noqa: D102
37
+ def bz_corners(self) -> npt.NDArray[np.float64]: # noqa: D102 # pragma: no cover
34
38
  return self._bz_corners
35
39
 
40
+ @property
41
+ def reciprocal_basis(self) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]: # noqa: D102
42
+ return self._reciprocal_basis
43
+
36
44
  @property
37
45
  def high_symmetry_points(self) -> tuple[tuple[npt.NDArray[np.float64], str], ...]: # noqa: D102
38
46
  return self._high_symmetry_points
@@ -0,0 +1,42 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """
6
+ Mean field treatment (:mod:`quant_met.mean_field`)
7
+ ==================================================
8
+
9
+ Submodules
10
+ ----------
11
+
12
+ .. autosummary::
13
+ :toctree: generated/
14
+
15
+ hamiltonians
16
+
17
+
18
+ Functions
19
+ ---------
20
+
21
+ .. autosummary::
22
+ :toctree: generated/
23
+
24
+ superfluid_weight
25
+ quantum_metric
26
+ quantum_metric_bdg
27
+ self_consistency_loop
28
+ """ # noqa: D205, D400
29
+
30
+ from quant_met.mean_field import hamiltonians
31
+
32
+ from .quantum_metric import quantum_metric, quantum_metric_bdg
33
+ from .self_consistency import self_consistency_loop
34
+ from .superfluid_weight import superfluid_weight
35
+
36
+ __all__ = [
37
+ "superfluid_weight",
38
+ "quantum_metric",
39
+ "quantum_metric_bdg",
40
+ "self_consistency_loop",
41
+ "hamiltonians",
42
+ ]
@@ -14,14 +14,3 @@ def _check_valid_array(array_in: npt.NDArray[Any]) -> bool:
14
14
  raise ValueError(msg)
15
15
 
16
16
  return True
17
-
18
-
19
- def _validate_float(float_in: float, parameter_name: str) -> float:
20
- if np.isinf(float_in):
21
- msg = f"{parameter_name} must not be Infinity"
22
- raise ValueError(msg)
23
- if np.isnan(float_in):
24
- msg = f"{parameter_name} must not be NaN"
25
- raise ValueError(msg)
26
-
27
- return float_in
@@ -0,0 +1,31 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """
6
+ Hamiltonians (:mod:`quant_met.mean_field.hamiltonians`)
7
+ =======================================================
8
+
9
+ Base
10
+
11
+ .. autosummary::
12
+ :toctree: hamiltonians/
13
+
14
+ BaseHamiltonian
15
+
16
+ .. autosummary::
17
+ :toctree: hamiltonians/
18
+
19
+ Graphene
20
+ DressedGraphene
21
+ OneBand
22
+ """ # noqa: D205, D400
23
+
24
+ from .base_hamiltonian import BaseHamiltonian
25
+ from .dressed_graphene import DressedGraphene
26
+ from .graphene import Graphene
27
+ from .one_band_tight_binding import OneBand
28
+ from .three_band_tight_binding import ThreeBand
29
+ from .two_band_tight_binding import TwoBand
30
+
31
+ __all__ = ["BaseHamiltonian", "Graphene", "DressedGraphene", "OneBand", "TwoBand", "ThreeBand"]