quant-met 0.0.9__tar.gz → 0.0.11__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 (37) hide show
  1. {quant_met-0.0.9 → quant_met-0.0.11}/PKG-INFO +5 -41
  2. quant_met-0.0.11/README.md +24 -0
  3. {quant_met-0.0.9 → quant_met-0.0.11}/pyproject.toml +1 -1
  4. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/cli/__init__.py +2 -5
  5. quant_met-0.0.11/src/quant_met/cli/main.py +61 -0
  6. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/cli/scf.py +36 -5
  7. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/geometry/__init__.py +1 -1
  8. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/__init__.py +3 -5
  9. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/__init__.py +4 -2
  10. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/base_hamiltonian.py +171 -78
  11. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/dressed_graphene.py +4 -36
  12. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/graphene.py +4 -36
  13. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/one_band_tight_binding.py +6 -38
  14. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/three_band_tight_binding.py +5 -37
  15. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/hamiltonians/two_band_tight_binding.py +5 -37
  16. quant_met-0.0.11/src/quant_met/mean_field/quantum_metric.py +69 -0
  17. quant_met-0.0.11/src/quant_met/mean_field/self_consistency.py +94 -0
  18. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/superfluid_weight.py +6 -6
  19. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/parameters/__init__.py +19 -7
  20. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/parameters/hamiltonians.py +49 -4
  21. quant_met-0.0.11/src/quant_met/parameters/main.py +69 -0
  22. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/plotting/__init__.py +0 -3
  23. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/plotting/plotting.py +0 -34
  24. quant_met-0.0.9/README.md +0 -60
  25. quant_met-0.0.9/src/quant_met/cli/main.py +0 -34
  26. quant_met-0.0.9/src/quant_met/mean_field/quantum_metric.py +0 -109
  27. quant_met-0.0.9/src/quant_met/mean_field/self_consistency.py +0 -40
  28. quant_met-0.0.9/src/quant_met/parameters/main.py +0 -37
  29. {quant_met-0.0.9 → quant_met-0.0.11}/LICENSE.txt +0 -0
  30. {quant_met-0.0.9 → quant_met-0.0.11}/LICENSES/MIT.txt +0 -0
  31. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/__init__.py +0 -0
  32. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/geometry/base_lattice.py +0 -0
  33. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/geometry/bz_path.py +0 -0
  34. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/geometry/graphene.py +0 -0
  35. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/geometry/square.py +0 -0
  36. {quant_met-0.0.9 → quant_met-0.0.11}/src/quant_met/mean_field/_utils.py +0 -0
  37. {quant_met-0.0.9 → quant_met-0.0.11}/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.9
3
+ Version: 0.0.11
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.9"
11
+ version = "0.0.11"
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"
@@ -3,11 +3,8 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
 
5
5
  """
6
- Command-Line-Interface (:mod:`quant_met.cli`)
7
- =============================================
8
-
9
- Functions
10
- ---------
6
+ Command-Line-Interface
7
+ ======================
11
8
 
12
9
  .. autosummary::
13
10
  :toctree: generated/
@@ -0,0 +1,61 @@
1
+ # SPDX-FileCopyrightText: 2024 Tjark Sievers
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ """Command line interface."""
6
+
7
+ import logging
8
+ import sys
9
+ from typing import TextIO
10
+
11
+ import click
12
+ import yaml
13
+
14
+ from quant_met.parameters import Parameters
15
+
16
+ from .scf import scf
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+
21
+ @click.command()
22
+ @click.argument("input-file", type=click.File("r"))
23
+ @click.option("--debug", is_flag=True, help="Enable debug logging.")
24
+ def cli(input_file: TextIO, *, debug: bool) -> None:
25
+ """Command line interface for quant-met.
26
+
27
+ Parameters
28
+ ----------
29
+ input_file: TextIO
30
+ A file object containing YAML formatted parameters for the simulation.
31
+ debug : bool
32
+ If set, enables debug logging instead of the default info logging.
33
+
34
+ This command reads the parameters from the specified file and runs the
35
+ desired calculation based on the provided parameters.
36
+ """
37
+ if debug:
38
+ logging.basicConfig(
39
+ level=logging.DEBUG,
40
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
41
+ stream=sys.stdout,
42
+ )
43
+ logger.setLevel(logging.DEBUG)
44
+ logger.info("Debug logging is enabled.")
45
+ else:
46
+ logging.basicConfig(
47
+ level=logging.INFO,
48
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
49
+ stream=sys.stdout,
50
+ )
51
+
52
+ params = Parameters(**yaml.safe_load(input_file))
53
+ logger.info("Loaded parameters successfully.")
54
+
55
+ match params.control.calculation:
56
+ case "scf":
57
+ logger.info("Starting SCF calculation.")
58
+ scf(params)
59
+ case _:
60
+ logger.error("Calculation %s not found.", params.control.calculation)
61
+ sys.exit(1)
@@ -4,18 +4,34 @@
4
4
 
5
5
  """Functions to run self-consistent calculation for the order parameter."""
6
6
 
7
+ import logging
7
8
  from pathlib import Path
8
9
 
9
10
  from quant_met import mean_field
10
11
  from quant_met.mean_field.hamiltonians import BaseHamiltonian
11
- from quant_met.parameters import Parameters
12
- from quant_met.parameters.hamiltonians import HamiltonianParameters
12
+ from quant_met.parameters import HamiltonianParameters, Parameters
13
+
14
+ logger = logging.getLogger(__name__)
13
15
 
14
16
 
15
17
  def _hamiltonian_factory(
16
18
  classname: str, parameters: HamiltonianParameters
17
19
  ) -> BaseHamiltonian[HamiltonianParameters]:
18
- """Create a hamiltonian by its class name."""
20
+ """Create a Hamiltonian by its class name.
21
+
22
+ Parameters
23
+ ----------
24
+ classname: str
25
+ The name of the Hamiltonian class to instantiate.
26
+ parameters: HamiltonianParameters
27
+ An instance of HamiltonianParameters containing all necessary
28
+ configuration for the specific Hamiltonian.
29
+
30
+ Returns
31
+ -------
32
+ BaseHamiltonian[HamiltonianParameters]
33
+ An instance of the specified Hamiltonian class.
34
+ """
19
35
  from quant_met.mean_field import hamiltonians
20
36
 
21
37
  cls = getattr(hamiltonians, classname)
@@ -24,10 +40,21 @@ def _hamiltonian_factory(
24
40
 
25
41
 
26
42
  def scf(parameters: Parameters) -> None:
27
- """Self-consistent calculation for the order parameter."""
43
+ """Self-consistent calculation for the order parameter.
44
+
45
+ Parameters
46
+ ----------
47
+ parameters: Parameters
48
+ An instance of Parameters containing control settings, the model,
49
+ and k-point specifications for the self-consistency calculation.
50
+ """
28
51
  result_path = Path(parameters.control.outdir)
29
52
  result_path.mkdir(exist_ok=True, parents=True)
53
+
54
+ logger.info("Initializing Hamiltonian factory.")
30
55
  h = _hamiltonian_factory(parameters=parameters.model, classname=parameters.model.name)
56
+
57
+ logger.info("Starting self-consistency loop.")
31
58
  solved_h = mean_field.self_consistency_loop(
32
59
  h=h,
33
60
  k_space_grid=h.lattice.generate_bz_grid(
@@ -35,6 +62,10 @@ def scf(parameters: Parameters) -> None:
35
62
  ),
36
63
  epsilon=parameters.control.conv_treshold,
37
64
  )
38
- print(solved_h.delta_orbital_basis)
65
+
66
+ logger.info("Self-consistency loop completed successfully.")
67
+ logger.debug("Obtained delta values: %s", solved_h.delta_orbital_basis)
68
+
39
69
  result_file = result_path / f"{parameters.control.prefix}.hdf5"
40
70
  solved_h.save(filename=result_file)
71
+ logger.info("Results saved to %s", result_file)
@@ -3,7 +3,7 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
 
5
5
  """
6
- Geometry (:mod:`quant_met.geometry`)
6
+ Geometry
7
7
  ========
8
8
 
9
9
  .. currentmodule:: quant_met.geometry
@@ -3,8 +3,8 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
 
5
5
  """
6
- Mean field treatment (:mod:`quant_met.mean_field`)
7
- ==================================================
6
+ Mean field
7
+ ==========
8
8
 
9
9
  Submodules
10
10
  ----------
@@ -23,20 +23,18 @@ Functions
23
23
 
24
24
  superfluid_weight
25
25
  quantum_metric
26
- quantum_metric_bdg
27
26
  self_consistency_loop
28
27
  """ # noqa: D205, D400
29
28
 
30
29
  from quant_met.mean_field import hamiltonians
31
30
 
32
- from .quantum_metric import quantum_metric, quantum_metric_bdg
31
+ from .quantum_metric import quantum_metric
33
32
  from .self_consistency import self_consistency_loop
34
33
  from .superfluid_weight import superfluid_weight
35
34
 
36
35
  __all__ = [
37
36
  "superfluid_weight",
38
37
  "quantum_metric",
39
- "quantum_metric_bdg",
40
38
  "self_consistency_loop",
41
39
  "hamiltonians",
42
40
  ]
@@ -3,8 +3,8 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
 
5
5
  """
6
- Hamiltonians (:mod:`quant_met.mean_field.hamiltonians`)
7
- =======================================================
6
+ hamiltonians
7
+ ============
8
8
 
9
9
  Base
10
10
 
@@ -19,6 +19,8 @@ Base
19
19
  Graphene
20
20
  DressedGraphene
21
21
  OneBand
22
+ TwoBand
23
+ ThreeBand
22
24
  """ # noqa: D205, D400
23
25
 
24
26
  from .base_hamiltonian import BaseHamiltonian