quant-met 0.0.10__tar.gz → 0.0.12__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 (33) hide show
  1. {quant_met-0.0.10 → quant_met-0.0.12}/PKG-INFO +5 -41
  2. quant_met-0.0.12/README.md +24 -0
  3. {quant_met-0.0.10 → quant_met-0.0.12}/pyproject.toml +1 -1
  4. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/cli/scf.py +1 -2
  5. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/quantum_metric.py +7 -7
  6. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/self_consistency.py +10 -3
  7. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/superfluid_weight.py +6 -6
  8. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/parameters/__init__.py +12 -8
  9. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/parameters/hamiltonians.py +16 -1
  10. quant_met-0.0.10/README.md +0 -60
  11. {quant_met-0.0.10 → quant_met-0.0.12}/LICENSE.txt +0 -0
  12. {quant_met-0.0.10 → quant_met-0.0.12}/LICENSES/MIT.txt +0 -0
  13. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/__init__.py +0 -0
  14. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/cli/__init__.py +0 -0
  15. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/cli/main.py +0 -0
  16. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/geometry/__init__.py +0 -0
  17. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/geometry/base_lattice.py +0 -0
  18. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/geometry/bz_path.py +0 -0
  19. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/geometry/graphene.py +0 -0
  20. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/geometry/square.py +0 -0
  21. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/__init__.py +0 -0
  22. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/_utils.py +0 -0
  23. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/__init__.py +0 -0
  24. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/base_hamiltonian.py +0 -0
  25. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/dressed_graphene.py +0 -0
  26. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/graphene.py +0 -0
  27. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/one_band_tight_binding.py +0 -0
  28. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/three_band_tight_binding.py +0 -0
  29. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/mean_field/hamiltonians/two_band_tight_binding.py +0 -0
  30. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/parameters/main.py +0 -0
  31. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/plotting/__init__.py +0 -0
  32. {quant_met-0.0.10 → quant_met-0.0.12}/src/quant_met/plotting/plotting.py +0 -0
  33. {quant_met-0.0.10 → quant_met-0.0.12}/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.10
3
+ Version: 0.0.12
4
4
  Summary: Calculate superconductivity in flat-band systems.
5
5
  Home-page: https://quant-met.tjarksievers.de
6
6
  Author: Tjark Sievers
@@ -33,51 +33,15 @@ SPDX-License-Identifier: MIT
33
33
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/quant-met)](https://pypi.org/project/quant-met/)
34
34
  [![PyPI - Version](https://img.shields.io/pypi/v/quant-met)](https://pypi.org/project/quant-met/)
35
35
 
36
- This is a python package to treat superconductivity in flat-band systems.
36
+ quant-met is a python package to treat superconductivity in flat-band systems.
37
37
 
38
- * Documentation: [quant-met.tjarksievers.de](https://quant-met.tjarksievers.de)
39
-
40
- ## Installation
41
-
42
- The package can be installed via
43
- ```shell
44
- pip install quant-met
45
- ```
46
-
47
- ## Usage
48
-
49
- For usage examples see [documentation](https://quant-met.tjarksievers.de/en/latest/examples.html).
38
+ - Documentation: [quant-met.tjarksievers.de](https://quant-met.tjarksievers.de)
39
+ - user guide see [documentation](https://quant-met.tjarksievers.de/en/latest/examples.html).
50
40
 
51
41
  ## Contributing
52
42
 
53
43
  This is a personal project, very geared to the work I did in my master's thesis.
54
44
  If someone is using this and experiencing bugs or want the software extended, feel free to open an issue!
55
45
 
56
- ### Developing
57
-
58
- You can also help develop this software further.
59
- This should help you get set up to start this.
60
-
61
- Prerequisites:
62
- * make
63
- * python
64
- * conda
65
-
66
- Set up the development environment:
67
- * clone the repository
68
- * run `make environment`
69
- * now activate the conda environment `conda activate quant-met-dev`
70
-
71
- You can manually run tests using for example `tox -e py312` (for running against python 3.12).
72
- After pushing your branch, all tests will also be run via Github Actions.
73
-
74
- Using `pre-commit`, automatic linting and formatting is done before every commit, which may cause the first commit to fail.
75
- A second try should then succeed.
76
-
77
- To fix the reuse copyright:
78
- ```bash
79
- reuse annotate --license=MIT --copyright="Tjark Sievers" --skip-unrecognised -r .
80
- ```
81
-
82
- After you are done working on an issue and all tests are running successful, you can add a new piece of changelog via `scriv create` and make a pull request.
46
+ If you want to contribute, see [documentation](https://quant-met.tjarksievers.de/en/latest/examples.html).
83
47
 
@@ -0,0 +1,24 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: 2024 Tjark Sievers
3
+
4
+ SPDX-License-Identifier: MIT
5
+ -->
6
+
7
+ # quant-met
8
+
9
+ [![Test](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml/badge.svg)](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml)
10
+ [![Coverage Status](https://coveralls.io/repos/github/Ruberhauptmann/quant-met/badge.svg?branch=main)](https://coveralls.io/github/Ruberhauptmann/quant-met?branch=main)
11
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/quant-met)](https://pypi.org/project/quant-met/)
12
+ [![PyPI - Version](https://img.shields.io/pypi/v/quant-met)](https://pypi.org/project/quant-met/)
13
+
14
+ quant-met is a python package to treat superconductivity in flat-band systems.
15
+
16
+ - Documentation: [quant-met.tjarksievers.de](https://quant-met.tjarksievers.de)
17
+ - user guide see [documentation](https://quant-met.tjarksievers.de/en/latest/examples.html).
18
+
19
+ ## Contributing
20
+
21
+ This is a personal project, very geared to the work I did in my master's thesis.
22
+ If someone is using this and experiencing bugs or want the software extended, feel free to open an issue!
23
+
24
+ If you want to contribute, see [documentation](https://quant-met.tjarksievers.de/en/latest/examples.html).
@@ -8,7 +8,7 @@ requires-python = ">=3.11,<3.13"
8
8
 
9
9
  [tool.poetry]
10
10
  name = "quant-met"
11
- version = "0.0.10"
11
+ version = "0.0.12"
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"
@@ -9,8 +9,7 @@ from pathlib import Path
9
9
 
10
10
  from quant_met import mean_field
11
11
  from quant_met.mean_field.hamiltonians import BaseHamiltonian
12
- from quant_met.parameters import Parameters
13
- from quant_met.parameters.hamiltonians import HamiltonianParameters
12
+ from quant_met.parameters import HamiltonianParameters, Parameters
14
13
 
15
14
  logger = logging.getLogger(__name__)
16
15
 
@@ -12,7 +12,7 @@ from quant_met.parameters import GenericParameters
12
12
 
13
13
 
14
14
  def quantum_metric(
15
- h: BaseHamiltonian[GenericParameters], k_grid: npt.NDArray[np.float64], bands: list[int]
15
+ h: BaseHamiltonian[GenericParameters], k: npt.NDArray[np.float64], bands: list[int]
16
16
  ) -> npt.NDArray[np.float64]:
17
17
  """Calculate the quantum metric (geometric tensor) for specified bands.
18
18
 
@@ -24,7 +24,7 @@ def quantum_metric(
24
24
  ----------
25
25
  h : BaseHamiltonian
26
26
  Hamiltonian object used to compute Bloch states and their derivatives.
27
- k_grid : numpy.ndarray
27
+ k : numpy.ndarray
28
28
  Array of k points in the Brillouin zone.
29
29
  bands : list of int
30
30
  Indices of the bands for which the quantum metric is to be calculated.
@@ -39,18 +39,18 @@ def quantum_metric(
39
39
  ValueError
40
40
  If `bands` contains invalid indices or `k_grid` is empty.
41
41
  """
42
- energies, bloch = h.diagonalize_nonint(k_grid)
42
+ energies, bloch = h.diagonalize_nonint(k)
43
43
 
44
- number_k_points = len(k_grid)
44
+ number_k_points = len(k)
45
45
 
46
46
  quantum_geom_tensor = np.zeros(shape=(2, 2), dtype=np.complex64)
47
47
 
48
48
  for band in bands:
49
49
  for i, direction_1 in enumerate(["x", "y"]):
50
- h_derivative_direction_1 = h.hamiltonian_derivative(k=k_grid, direction=direction_1)
50
+ h_derivative_direction_1 = h.hamiltonian_derivative(k=k, direction=direction_1)
51
51
  for j, direction_2 in enumerate(["x", "y"]):
52
- h_derivative_direction_2 = h.hamiltonian_derivative(k=k_grid, direction=direction_2)
53
- for k_index in range(len(k_grid)):
52
+ h_derivative_direction_2 = h.hamiltonian_derivative(k=k, direction=direction_2)
53
+ for k_index in range(len(k)):
54
54
  for n in [i for i in range(h.number_of_bands) if i != band]:
55
55
  quantum_geom_tensor[i, j] += (
56
56
  (
@@ -5,6 +5,7 @@
5
5
  """Self-consistency loop."""
6
6
 
7
7
  import logging
8
+ import sys
8
9
 
9
10
  import numpy as np
10
11
  import numpy.typing as npt
@@ -19,6 +20,7 @@ def self_consistency_loop(
19
20
  h: BaseHamiltonian[GenericParameters],
20
21
  k_space_grid: npt.NDArray[np.float64],
21
22
  epsilon: float,
23
+ max_iter: int = 1000,
22
24
  ) -> BaseHamiltonian[GenericParameters]:
23
25
  """Self-consistently solves the gap equation for a given Hamiltonian.
24
26
 
@@ -40,6 +42,9 @@ def self_consistency_loop(
40
42
  The convergence criterion. The loop will terminate when the change
41
43
  in the delta orbital basis is less than this value.
42
44
 
45
+ max_iter : int
46
+ Maximal number of iterations, default 300.
47
+
43
48
  Returns
44
49
  -------
45
50
  :class:`quant_met.mean_field.BaseHamiltonian`
@@ -65,14 +70,16 @@ def self_consistency_loop(
65
70
  iteration_count = 0
66
71
  while True:
67
72
  iteration_count += 1
73
+ if iteration_count > max_iter:
74
+ sys.exit("Maximum number of iterations reached.")
75
+
68
76
  logger.debug("Iteration %d: Computing new gaps.", iteration_count)
69
77
 
70
78
  new_gap = h.gap_equation(k=k_space_grid)
71
79
 
72
- delta_change = np.abs(h.delta_orbital_basis - new_gap)
73
80
  logger.debug("New gaps computed: %s", new_gap)
74
81
 
75
- if (delta_change < epsilon).all():
82
+ if np.allclose(h.delta_orbital_basis, new_gap, atol=1e-10, rtol=epsilon):
76
83
  h.delta_orbital_basis = new_gap
77
84
  logger.info("Convergence achieved after %d iterations.", iteration_count)
78
85
  return h
@@ -80,4 +87,4 @@ def self_consistency_loop(
80
87
  mixing_greed = 0.2
81
88
  h.delta_orbital_basis = mixing_greed * new_gap + (1 - mixing_greed) * h.delta_orbital_basis
82
89
  logger.debug("Updated gaps: %s", h.delta_orbital_basis)
83
- logger.debug("Change in gaps: %s", delta_change)
90
+ logger.debug("Change in gaps: %s", np.abs(h.delta_orbital_basis - new_gap))
@@ -13,7 +13,7 @@ from quant_met.parameters import GenericParameters
13
13
 
14
14
  def superfluid_weight(
15
15
  h: BaseHamiltonian[GenericParameters],
16
- k_grid: npt.NDArray[np.float64],
16
+ k: npt.NDArray[np.float64],
17
17
  ) -> tuple[npt.NDArray[np.complex64], npt.NDArray[np.complex64]]:
18
18
  """Calculate the superfluid weight.
19
19
 
@@ -21,7 +21,7 @@ def superfluid_weight(
21
21
  ----------
22
22
  h : :class:`~quant_met.mean_field.Hamiltonian`
23
23
  Hamiltonian.
24
- k_grid : :class:`numpy.ndarray`
24
+ k : :class:`numpy.ndarray`
25
25
  List of k points.
26
26
 
27
27
  Returns
@@ -37,10 +37,10 @@ def superfluid_weight(
37
37
 
38
38
  for i, direction_1 in enumerate(["x", "y"]):
39
39
  for j, direction_2 in enumerate(["x", "y"]):
40
- for k in k_grid:
41
- c_mnpq = _c_factor(h, k)
42
- j_up = _current_operator(h, direction_1, k)
43
- j_down = _current_operator(h, direction_2, -k)
40
+ for k_point in k:
41
+ c_mnpq = _c_factor(h, k_point)
42
+ j_up = _current_operator(h, direction_1, k_point)
43
+ j_down = _current_operator(h, direction_2, -k_point)
44
44
  for m in range(h.number_of_bands):
45
45
  for n in range(h.number_of_bands):
46
46
  for p in range(h.number_of_bands):
@@ -8,33 +8,37 @@ Parameter Classes
8
8
 
9
9
  Main class holding all the parameters for the calculation.
10
10
 
11
- - :class:`Parameters<quant_met.parameters.Parameters>`
12
-
13
11
  Classes holding the configuration for the Hamiltonians.
14
12
 
13
+ .. autosummary::
14
+ :toctree: generated/parameters/hamiltonians
15
+
16
+ hamiltonians
17
+
15
18
  .. autosummary::
16
19
  :toctree: generated/parameters/
17
20
 
18
21
  Parameters # noqa
19
- DressedGrapheneParameters
20
- GrapheneParameters
21
- OneBandParameters
22
- TwoBandParameters
23
- ThreeBandParameters
22
+ Control # noqa
23
+ KPoints # noqa
24
24
  """ # noqa: D205, D400
25
25
 
26
26
  from .hamiltonians import (
27
27
  DressedGrapheneParameters,
28
28
  GenericParameters,
29
29
  GrapheneParameters,
30
+ HamiltonianParameters,
30
31
  OneBandParameters,
31
32
  ThreeBandParameters,
32
33
  TwoBandParameters,
33
34
  )
34
- from .main import Parameters
35
+ from .main import Control, KPoints, Parameters
35
36
 
36
37
  __all__ = [
37
38
  "Parameters",
39
+ "Control",
40
+ "KPoints",
41
+ "HamiltonianParameters",
38
42
  "DressedGrapheneParameters",
39
43
  "GrapheneParameters",
40
44
  "OneBandParameters",
@@ -2,7 +2,22 @@
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
4
 
5
- """Pydantic models to hold parameters for Hamiltonians."""
5
+ """
6
+ Hamiltonian Parameter Classes
7
+ =============================
8
+
9
+ Classes holding the configuration for the Hamiltonians.
10
+
11
+ .. autosummary::
12
+ :toctree: generated/parameters/
13
+
14
+ HamiltonianParameters
15
+ DressedGrapheneParameters
16
+ GrapheneParameters
17
+ OneBandParameters
18
+ TwobandParameters
19
+ ThreeBandParameters
20
+ """ # noqa: D205, D400
6
21
 
7
22
  from typing import Literal, TypeVar
8
23
 
@@ -1,60 +0,0 @@
1
- <!--
2
- SPDX-FileCopyrightText: 2024 Tjark Sievers
3
-
4
- SPDX-License-Identifier: MIT
5
- -->
6
-
7
- # quant-met
8
-
9
- [![Test](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml/badge.svg)](https://github.com/Ruberhauptmann/quant-met/actions/workflows/test.yml)
10
- [![Coverage Status](https://coveralls.io/repos/github/Ruberhauptmann/quant-met/badge.svg?branch=main)](https://coveralls.io/github/Ruberhauptmann/quant-met?branch=main)
11
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/quant-met)](https://pypi.org/project/quant-met/)
12
- [![PyPI - Version](https://img.shields.io/pypi/v/quant-met)](https://pypi.org/project/quant-met/)
13
-
14
- This is a python package to treat superconductivity in flat-band systems.
15
-
16
- * Documentation: [quant-met.tjarksievers.de](https://quant-met.tjarksievers.de)
17
-
18
- ## Installation
19
-
20
- The package can be installed via
21
- ```shell
22
- pip install quant-met
23
- ```
24
-
25
- ## Usage
26
-
27
- For usage examples see [documentation](https://quant-met.tjarksievers.de/en/latest/examples.html).
28
-
29
- ## Contributing
30
-
31
- This is a personal project, very geared to the work I did in my master's thesis.
32
- If someone is using this and experiencing bugs or want the software extended, feel free to open an issue!
33
-
34
- ### Developing
35
-
36
- You can also help develop this software further.
37
- This should help you get set up to start this.
38
-
39
- Prerequisites:
40
- * make
41
- * python
42
- * conda
43
-
44
- Set up the development environment:
45
- * clone the repository
46
- * run `make environment`
47
- * now activate the conda environment `conda activate quant-met-dev`
48
-
49
- You can manually run tests using for example `tox -e py312` (for running against python 3.12).
50
- After pushing your branch, all tests will also be run via Github Actions.
51
-
52
- Using `pre-commit`, automatic linting and formatting is done before every commit, which may cause the first commit to fail.
53
- A second try should then succeed.
54
-
55
- To fix the reuse copyright:
56
- ```bash
57
- reuse annotate --license=MIT --copyright="Tjark Sievers" --skip-unrecognised -r .
58
- ```
59
-
60
- After you are done working on an issue and all tests are running successful, you can add a new piece of changelog via `scriv create` and make a pull request.
File without changes
File without changes