AdsorPy 1.2.0__tar.gz → 1.2.1__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.
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/PULL_REQUEST_TEMPLATE.md +1 -1
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/workflows/docs-ci.yml +1 -1
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/workflows/tests-ci.yml +3 -3
- {adsorpy-1.2.0 → adsorpy-1.2.1}/CHANGELOG.md +13 -1
- {adsorpy-1.2.0 → adsorpy-1.2.1}/PKG-INFO +27 -5
- {adsorpy-1.2.0 → adsorpy-1.2.1}/README.md +20 -4
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/conf.py +14 -3
- {adsorpy-1.2.0 → adsorpy-1.2.1}/pyproject.toml +23 -5
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/randomsequentialadsorption.py +35 -45
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/run_simulation.py +2 -2
- adsorpy-1.2.1/tach.toml +35 -0
- adsorpy-1.2.1/tox.toml +44 -0
- adsorpy-1.2.0/tox.toml +0 -35
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/dependabot.yml +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/.github/workflows/publish_to_PyPI.yml +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/CODE_OF_CONDUCT.md +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/CONTRIBUTING.md +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/LICENSE.md +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/SECURITY.md +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/Makefile +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/make.bat +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.molecule_lib.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.randomsequentialadsorption.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.rsa_calculator.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.rsa_config.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.run_simulation.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/adsorpy.typing.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/index.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/docs/source/modules.rst +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/images/AdsorPy_Covered_Surface.png +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/py.typed +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/__init__.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/__main__.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/VdW_Radii.csv +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/__init__.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/config.json +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/molecule_colour.json +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/molecule_lib.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/rsa_calculator.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/rsa_config.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/src/adsorpy/typing.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/tests/__init__.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/tests/rsa_test.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/tests/run_simulation_test.py +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/tests/test_data/config_test_hard.json +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/tests/test_data/config_test_periodic.json +0 -0
- {adsorpy-1.2.0 → adsorpy-1.2.1}/tests/test_data/config_test_soft.json +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
1. [ ] Does your submission pass all ``pytest`` tests?
|
|
11
11
|
2. [ ] Have you lint your code locally before submission?
|
|
12
|
-
3. [ ] Does your code pass the ``mypy``, ``pyright``, and ``ruff`` checks?
|
|
12
|
+
3. [ ] Does your code pass the ``mypy``, ``pyright``, ``tach``, ``slotscheck``, and ``ruff`` checks?
|
|
13
13
|
|
|
14
14
|
### Changes to Core Features:
|
|
15
15
|
|
|
@@ -33,13 +33,13 @@ jobs:
|
|
|
33
33
|
run: python -m pip install --upgrade pip
|
|
34
34
|
|
|
35
35
|
- name: Install tox and plugins
|
|
36
|
-
run: pip install tox tox-gh
|
|
36
|
+
run: pip install tox tox-gh
|
|
37
37
|
|
|
38
38
|
- name: Run tests with tox
|
|
39
|
-
run: tox
|
|
39
|
+
run: tox
|
|
40
40
|
|
|
41
41
|
- name: Upload test results
|
|
42
|
-
if: always() && matrix.python-version == '3.
|
|
42
|
+
if: always() && matrix.python-version == '3.14'
|
|
43
43
|
uses: actions/upload-artifact@v7
|
|
44
44
|
with:
|
|
45
45
|
name: junit-results
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
All important changes to ``AdsorPy`` will be documented in this file.
|
|
3
3
|
|
|
4
|
-
This format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
4
|
+
This format is based on [Keep a Changelog](http://keepachangelog.com/). This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
## [unreleased]
|
|
@@ -10,6 +10,18 @@ This format is based on [Keep a Changelog](http://keepachangelog.com/) and this
|
|
|
10
10
|
### Fixed
|
|
11
11
|
### Removed
|
|
12
12
|
|
|
13
|
+
## 1.2.1 - 2026-05-08
|
|
14
|
+
### Added
|
|
15
|
+
- Add ``tach`` for internal dependency sanitation.
|
|
16
|
+
- Add ``slotscheck`` to ensure correct use of slots in dataclasses.
|
|
17
|
+
- Add ``pydantic`` to ensure correctness of ``config.json``.
|
|
18
|
+
- Add intersphinx mapping for ``pydantic``, ``shapely``, ``numba``, ``matplotlib``, and ``rtree``.
|
|
19
|
+
### Changed
|
|
20
|
+
- Change lint checking version of Python from 3.13 to 3.14.
|
|
21
|
+
### Fixed
|
|
22
|
+
- Reduce the complexity of the ``tests-ci.yml`` and ``tox.toml``.
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
13
25
|
## 1.2.0 - 2026-05-06
|
|
14
26
|
### Added
|
|
15
27
|
- Add ``pyright`` linting in strict mode.
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adsorpy
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Random sequential adsorption (RSA) simulation, 2D lattice-based.
|
|
5
5
|
Project-URL: github, https://github.com/JoostFWMaas/AdsorPy
|
|
6
6
|
Project-URL: Documentation, https://joostfwmaas.github.io/AdsorPy
|
|
7
7
|
Project-URL: Changelog, https://github.com/JoostFWMaas/AdsorPy/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: homepage, https://pypi.org/project/adsorpy/
|
|
9
|
+
Project-URL: issues, https://github.com/JoostFWMaas/AdsorPy/issues
|
|
10
|
+
Project-URL: download, https://pypi.org/project/adsorpy/#files
|
|
8
11
|
Author-email: "J.F.W. Maas" <j.f.w.maas@tue.nl>
|
|
9
12
|
License-Expression: MIT
|
|
10
13
|
License-File: LICENSE.md
|
|
@@ -34,6 +37,7 @@ Requires-Dist: matplotlib>=3.10.9
|
|
|
34
37
|
Requires-Dist: numba>=0.65.1
|
|
35
38
|
Requires-Dist: numpy>=2.2.6; python_version == '3.10'
|
|
36
39
|
Requires-Dist: numpy>=2.4.4; python_version >= '3.11'
|
|
40
|
+
Requires-Dist: pydantic>=2.13.4
|
|
37
41
|
Requires-Dist: rtree>=1.4.1
|
|
38
42
|
Requires-Dist: shapely>=2.1.2
|
|
39
43
|
Provides-Extra: docs
|
|
@@ -46,6 +50,8 @@ Provides-Extra: lint
|
|
|
46
50
|
Requires-Dist: mypy>=2.0.0; extra == 'lint'
|
|
47
51
|
Requires-Dist: pyright>=1.1.409; extra == 'lint'
|
|
48
52
|
Requires-Dist: ruff>=0.15.12; extra == 'lint'
|
|
53
|
+
Requires-Dist: slotscheck>=0.19.1; extra == 'lint'
|
|
54
|
+
Requires-Dist: tach>=0.34.1; extra == 'lint'
|
|
49
55
|
Provides-Extra: test
|
|
50
56
|
Requires-Dist: codecov>=2.1.13; extra == 'test'
|
|
51
57
|
Requires-Dist: hypothesis>=6.152.4; extra == 'test'
|
|
@@ -57,12 +63,13 @@ Description-Content-Type: text/markdown
|
|
|
57
63
|
|
|
58
64
|
# AdsorPy
|
|
59
65
|
|
|
60
|
-

|
|
61
66
|

|
|
62
67
|
[](https://codecov.io/github/JoostFWMaas/AdsorPy)
|
|
63
68
|
|
|
64
69
|
Lattice-based random sequential adsorption (RSA) Python 3.10+ script.
|
|
65
70
|
|
|
71
|
+
<img src="https://raw.githubusercontent.com/JoostFWMaas/AdsorPy/ccedff9c0a4cca1e89c4d461dbfeb91c49e38b21/images/AdsorPy_Covered_Surface.png" alt="Output of an AdsorPy run, an image of a covered surface." style="width:50%; height:auto;">
|
|
72
|
+
|
|
66
73
|
In RSA, molecules arrive one by one at a surface. Adsorption takes place if the molecule does not overlap with molecules
|
|
67
74
|
already on the surface.
|
|
68
75
|
The list of available orientations for the molecule is traversed in random order until the first orientation that fits
|
|
@@ -72,14 +79,27 @@ gap size distribution.
|
|
|
72
79
|
|
|
73
80
|
## How to use
|
|
74
81
|
|
|
82
|
+
The easiest way to run this package:
|
|
83
|
+
```bash
|
|
84
|
+
pip install adsorpy
|
|
85
|
+
```
|
|
86
|
+
|
|
75
87
|
Run the `adsorpy.main` in order to run a simple single run using the standard disk-shaped molecule on hexagonal aluminium oxide.
|
|
76
88
|
New molecules can be created by running the `adsorpy.molecule_lib` or by calling the `adsorpy.molecule_lib.first_time_loader()` function. Molecules can be generated from `.xyz` files. It is
|
|
77
89
|
recommended to run `adsorpy.molecule_lib` directly from command line to define the molecule orientation, then store the new
|
|
78
90
|
molecule string for repeated use.
|
|
79
91
|
|
|
80
92
|
Run the `adsorpy.run_simulation.run_simulation()` function with the molecule footprints generated in the previous step. Output can be printed to stdout, plotted, and saved.
|
|
93
|
+
An example for dog-bone molecules with rotations of 360 // 12 = 30 degrees:
|
|
94
|
+
```python
|
|
95
|
+
from adsorpy.run_simulation import run_simulation
|
|
96
|
+
from adsorpy.molecule_lib import dogbonium
|
|
97
|
+
molecule = dogbonium()
|
|
98
|
+
output = run_simulation(molecules_list=molecule, rotation_counts=12, plot_output_flag=True)
|
|
99
|
+
```
|
|
100
|
+
|
|
81
101
|
|
|
82
|
-
User
|
|
102
|
+
User-friendliness will be updated at a later stage, allowing the user to define simulation modes, surfaces, and
|
|
83
103
|
molecules more easily.
|
|
84
104
|
|
|
85
105
|
Documentation (generated with `sphinx`): https://joostfwmaas.github.io/AdsorPy/
|
|
@@ -94,13 +114,15 @@ Because AdsorPy has been made with scientific rigour in mind, the package is tes
|
|
|
94
114
|
- Unit tests (`pytest`) of the code ensure correct behaviour for expected input.
|
|
95
115
|
- Property tests (`hypothesis`) of the most critical code components ensure correct behaviour for unexpected input as well.
|
|
96
116
|
- `mypy` (in `--strict` mode) and `pyright` (`strict`) ensure that the package is correctly-typed, as if it were static. The `py.typed` file, a promise that the code is type-hinted properly, is added because the code passes this test.
|
|
97
|
-
- `ruff` is used as a linter with almost all rules enabled (see the pyproject.toml for the list of exclusions and reasons).
|
|
117
|
+
- `ruff` is used as a linter with almost all rules enabled (see the `pyproject.toml` for the list of exclusions and reasons).
|
|
118
|
+
- `slotscheck` ensures that all dataclass slots are set up correctly.
|
|
119
|
+
- `tach` ensures that internal dependencies are handled correctly (from low level to high), preventing circular dependencies.
|
|
98
120
|
- `tox` is used to run all of the aforementioned tests in parallel for multiple Python versions to ensure correct behaviour.
|
|
99
121
|
- CI is used for automated testing.
|
|
100
122
|
|
|
101
123
|
The package also makes use of an optional config file that falls back on standard behaviour, because configs are often used in scientific software (set-and-forget).
|
|
102
124
|
|
|
103
|
-
|
|
125
|
+
## Openness and academic collaboration
|
|
104
126
|
|
|
105
127
|
The script was made public for the sake of openness and academic collaboration. Please let me know if you have questions about the script, or if you have discovered any issues/bugs.
|
|
106
128
|
At the end of this file, I will place a list of papers that make use of this work. Feel free to contact me if you want your work to be added to the list as well.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# AdsorPy
|
|
2
2
|
|
|
3
|
-

|
|
4
3
|

|
|
5
4
|
[](https://codecov.io/github/JoostFWMaas/AdsorPy)
|
|
6
5
|
|
|
7
6
|
Lattice-based random sequential adsorption (RSA) Python 3.10+ script.
|
|
8
7
|
|
|
8
|
+
<img src="https://raw.githubusercontent.com/JoostFWMaas/AdsorPy/ccedff9c0a4cca1e89c4d461dbfeb91c49e38b21/images/AdsorPy_Covered_Surface.png" alt="Output of an AdsorPy run, an image of a covered surface." style="width:50%; height:auto;">
|
|
9
|
+
|
|
9
10
|
In RSA, molecules arrive one by one at a surface. Adsorption takes place if the molecule does not overlap with molecules
|
|
10
11
|
already on the surface.
|
|
11
12
|
The list of available orientations for the molecule is traversed in random order until the first orientation that fits
|
|
@@ -15,14 +16,27 @@ gap size distribution.
|
|
|
15
16
|
|
|
16
17
|
## How to use
|
|
17
18
|
|
|
19
|
+
The easiest way to run this package:
|
|
20
|
+
```bash
|
|
21
|
+
pip install adsorpy
|
|
22
|
+
```
|
|
23
|
+
|
|
18
24
|
Run the `adsorpy.main` in order to run a simple single run using the standard disk-shaped molecule on hexagonal aluminium oxide.
|
|
19
25
|
New molecules can be created by running the `adsorpy.molecule_lib` or by calling the `adsorpy.molecule_lib.first_time_loader()` function. Molecules can be generated from `.xyz` files. It is
|
|
20
26
|
recommended to run `adsorpy.molecule_lib` directly from command line to define the molecule orientation, then store the new
|
|
21
27
|
molecule string for repeated use.
|
|
22
28
|
|
|
23
29
|
Run the `adsorpy.run_simulation.run_simulation()` function with the molecule footprints generated in the previous step. Output can be printed to stdout, plotted, and saved.
|
|
30
|
+
An example for dog-bone molecules with rotations of 360 // 12 = 30 degrees:
|
|
31
|
+
```python
|
|
32
|
+
from adsorpy.run_simulation import run_simulation
|
|
33
|
+
from adsorpy.molecule_lib import dogbonium
|
|
34
|
+
molecule = dogbonium()
|
|
35
|
+
output = run_simulation(molecules_list=molecule, rotation_counts=12, plot_output_flag=True)
|
|
36
|
+
```
|
|
37
|
+
|
|
24
38
|
|
|
25
|
-
User
|
|
39
|
+
User-friendliness will be updated at a later stage, allowing the user to define simulation modes, surfaces, and
|
|
26
40
|
molecules more easily.
|
|
27
41
|
|
|
28
42
|
Documentation (generated with `sphinx`): https://joostfwmaas.github.io/AdsorPy/
|
|
@@ -37,13 +51,15 @@ Because AdsorPy has been made with scientific rigour in mind, the package is tes
|
|
|
37
51
|
- Unit tests (`pytest`) of the code ensure correct behaviour for expected input.
|
|
38
52
|
- Property tests (`hypothesis`) of the most critical code components ensure correct behaviour for unexpected input as well.
|
|
39
53
|
- `mypy` (in `--strict` mode) and `pyright` (`strict`) ensure that the package is correctly-typed, as if it were static. The `py.typed` file, a promise that the code is type-hinted properly, is added because the code passes this test.
|
|
40
|
-
- `ruff` is used as a linter with almost all rules enabled (see the pyproject.toml for the list of exclusions and reasons).
|
|
54
|
+
- `ruff` is used as a linter with almost all rules enabled (see the `pyproject.toml` for the list of exclusions and reasons).
|
|
55
|
+
- `slotscheck` ensures that all dataclass slots are set up correctly.
|
|
56
|
+
- `tach` ensures that internal dependencies are handled correctly (from low level to high), preventing circular dependencies.
|
|
41
57
|
- `tox` is used to run all of the aforementioned tests in parallel for multiple Python versions to ensure correct behaviour.
|
|
42
58
|
- CI is used for automated testing.
|
|
43
59
|
|
|
44
60
|
The package also makes use of an optional config file that falls back on standard behaviour, because configs are often used in scientific software (set-and-forget).
|
|
45
61
|
|
|
46
|
-
|
|
62
|
+
## Openness and academic collaboration
|
|
47
63
|
|
|
48
64
|
The script was made public for the sake of openness and academic collaboration. Please let me know if you have questions about the script, or if you have discovered any issues/bugs.
|
|
49
65
|
At the end of this file, I will place a list of papers that make use of this work. Feel free to contact me if you want your work to be added to the list as well.
|
|
@@ -36,8 +36,13 @@ extensions = [
|
|
|
36
36
|
]
|
|
37
37
|
|
|
38
38
|
intersphinx_mapping = {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
"numpy": ("https://numpy.org/doc/stable/", None),
|
|
40
|
+
"python": ("https://docs.python.org/3/", None),
|
|
41
|
+
"pydantic": ("https://docs.pydantic.dev/latest/", None),
|
|
42
|
+
"shapely": ("https://shapely.readthedocs.io/en/stable/", None),
|
|
43
|
+
"numba": ("https://numba.readthedocs.io/en/stable/", None),
|
|
44
|
+
"matplotlib": ("https://matplotlib.org/stable/", None),
|
|
45
|
+
"rtree": ("https://rtree.readthedocs.io/en/latest/", None),
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
sd_custom_directives = {
|
|
@@ -77,7 +82,11 @@ autodoc_default_options = {
|
|
|
77
82
|
|
|
78
83
|
autodoc_member_order = "bysource"
|
|
79
84
|
|
|
80
|
-
suppress_warnings = [
|
|
85
|
+
suppress_warnings = [
|
|
86
|
+
"config.cache",
|
|
87
|
+
"sphinx_autodoc_typehints.guarded_import",
|
|
88
|
+
"sphinx_autodoc_typehints.forward_reference",
|
|
89
|
+
]
|
|
81
90
|
|
|
82
91
|
# -- Options for HTML output -------------------------------------------------
|
|
83
92
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
@@ -97,6 +106,8 @@ py_files = module_directory.glob("*.py")
|
|
|
97
106
|
module_names = [f.stem for f in py_files]
|
|
98
107
|
print(module_names)
|
|
99
108
|
|
|
109
|
+
autodoc_typehints = "description"
|
|
110
|
+
|
|
100
111
|
# List of modules to mock during documentation build
|
|
101
112
|
autodoc_mock_imports = module_names
|
|
102
113
|
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "adsorpy"
|
|
7
7
|
#dynamic = ["version"] # The Python guide says that this will use the Git tag to fill it in.
|
|
8
|
-
version = "1.2.
|
|
8
|
+
version = "1.2.1" # The Python guide says that this will use the Git tag to fill it in.
|
|
9
9
|
description = "Random sequential adsorption (RSA) simulation, 2D lattice-based."
|
|
10
10
|
authors = [{ name = "J.F.W. Maas", email = "j.f.w.maas@tue.nl" }]
|
|
11
11
|
readme = "README.md"
|
|
@@ -62,6 +62,7 @@ dependencies = [
|
|
|
62
62
|
"numba>=0.65.1",
|
|
63
63
|
"matplotlib>=3.10.9",
|
|
64
64
|
"shapely>=2.1.2",
|
|
65
|
+
"pydantic>=2.13.4",
|
|
65
66
|
"rtree>=1.4.1",
|
|
66
67
|
]
|
|
67
68
|
|
|
@@ -78,6 +79,8 @@ lint = [
|
|
|
78
79
|
"mypy>=2.0.0",
|
|
79
80
|
"ruff>=0.15.12",
|
|
80
81
|
"pyright>=1.1.409",
|
|
82
|
+
"tach>=0.34.1",
|
|
83
|
+
"slotscheck>=0.19.1",
|
|
81
84
|
]
|
|
82
85
|
docs = [
|
|
83
86
|
"sphinx>=9.1.0",
|
|
@@ -91,7 +94,9 @@ docs = [
|
|
|
91
94
|
github = "https://github.com/JoostFWMaas/AdsorPy"
|
|
92
95
|
Documentation = "https://joostfwmaas.github.io/AdsorPy"
|
|
93
96
|
Changelog = "https://github.com/JoostFWMaas/AdsorPy/blob/main/CHANGELOG.md"
|
|
94
|
-
|
|
97
|
+
homepage = "https://pypi.org/project/adsorpy/"
|
|
98
|
+
issues = "https://github.com/JoostFWMaas/AdsorPy/issues"
|
|
99
|
+
download = "https://pypi.org/project/adsorpy/#files"
|
|
95
100
|
|
|
96
101
|
[tool.hatch.package_data]
|
|
97
102
|
"adsorpy" = ["py.typed"]
|
|
@@ -132,7 +137,6 @@ exclude_also = [
|
|
|
132
137
|
"@njit", # Compiled code is not seen by coverage. This code is tested with Hypothesis though. False negative.
|
|
133
138
|
]
|
|
134
139
|
|
|
135
|
-
|
|
136
140
|
[tool.mypy]
|
|
137
141
|
mypy_path = ["src", "optional", "tests"]
|
|
138
142
|
ignore_missing_imports = true
|
|
@@ -141,7 +145,12 @@ disallow_any_explicit = true
|
|
|
141
145
|
#disallow_any_decorated = true # Throws an error because geo.Polygon in a tuple is turned into Any for the @staticmethod.
|
|
142
146
|
#warn_unreachable = true # Set this to true when pushing to main?
|
|
143
147
|
exclude = ['/Scripts']
|
|
148
|
+
plugins = ["pydantic.mypy"]
|
|
144
149
|
|
|
150
|
+
[tool.pydantic-mypy]
|
|
151
|
+
init_forbid_extra = true
|
|
152
|
+
init_typed = true
|
|
153
|
+
warn_required_dynamic_aliases = true
|
|
145
154
|
|
|
146
155
|
[tool.flake8]
|
|
147
156
|
max-line-length = 120
|
|
@@ -193,7 +202,6 @@ pylint.max-statements = 80
|
|
|
193
202
|
mccabe.max-complexity = 20
|
|
194
203
|
future-annotations = true # Future annotations enabled.
|
|
195
204
|
|
|
196
|
-
|
|
197
205
|
ignore = [
|
|
198
206
|
"ERA001",
|
|
199
207
|
"TD",
|
|
@@ -206,13 +214,14 @@ ignore = [
|
|
|
206
214
|
"ARG001", # Unused function argument.
|
|
207
215
|
"D203", # Conflicts with D211: no blank line before class.
|
|
208
216
|
"D213", # Conflicts with D212: multi-line summary first line.
|
|
209
|
-
# "DOC",
|
|
210
217
|
]
|
|
211
218
|
|
|
212
219
|
[tool.ruff.lint.per-file-ignores]
|
|
213
220
|
"__init__.py" = ["D104"] # Missing docstring in public package. Not needed, package is empty.
|
|
214
221
|
"test*.py" = ["S101", "TC"] # Assert should not be used in production code! But this is test code, so here it is expected.
|
|
215
222
|
|
|
223
|
+
[tool.ruff.lint.flake8-type-checking]
|
|
224
|
+
runtime-evaluated-decorators = ["pydantic.dataclasses.dataclass"]
|
|
216
225
|
|
|
217
226
|
[tool.pyright]
|
|
218
227
|
include = ["src", "tests"]
|
|
@@ -238,3 +247,12 @@ reportPrivateUsage = "warning"
|
|
|
238
247
|
reportUnnecessaryTypeIgnoreComment = "warning"
|
|
239
248
|
reportUnnecessaryComparison = "warning" # These are usually included to prevent the user from breaking things.
|
|
240
249
|
|
|
250
|
+
|
|
251
|
+
[tool.slotscheck]
|
|
252
|
+
strict-imports = true
|
|
253
|
+
include-modules = """
|
|
254
|
+
(
|
|
255
|
+
src
|
|
256
|
+
# |tests
|
|
257
|
+
)
|
|
258
|
+
"""
|
|
@@ -16,6 +16,7 @@ import shapely.affinity as aff
|
|
|
16
16
|
from matplotlib import pyplot as plt # Plotting.
|
|
17
17
|
from matplotlib.collections import PatchCollection, PolyCollection # To make pointers.
|
|
18
18
|
from matplotlib.patches import CirclePolygon, Rectangle
|
|
19
|
+
from pydantic import Field, PositiveFloat, PositiveInt, dataclasses
|
|
19
20
|
from rtree.index import Index, Property # RTree, helps lookups!
|
|
20
21
|
from shapely import MultiPoint, Point, Polygon, STRtree, box, contains_xy, prepare
|
|
21
22
|
|
|
@@ -58,30 +59,49 @@ plt.rcParams.update(
|
|
|
58
59
|
)
|
|
59
60
|
|
|
60
61
|
|
|
61
|
-
@dataclass(frozen=True, slots=True)
|
|
62
|
+
@dataclasses.dataclass(frozen=True, slots=True)
|
|
62
63
|
class Config:
|
|
63
64
|
"""Dataclass containing the config variables read from data/config."""
|
|
64
65
|
|
|
65
|
-
rsa_config: RsaConfig
|
|
66
|
-
"The RSA config."
|
|
67
|
-
sites:
|
|
66
|
+
# rsa_config: RsaConfig
|
|
67
|
+
# "The RSA config."
|
|
68
|
+
sites: PositiveInt | None # Site count in the x-direction.
|
|
68
69
|
"The number of sites in the x-direction."
|
|
69
|
-
xsize:
|
|
70
|
+
xsize: PositiveFloat | None # The sizes are not yet properly implemented for this.
|
|
70
71
|
"Under construction, do not use."
|
|
71
|
-
ysize:
|
|
72
|
+
ysize: PositiveFloat | None
|
|
72
73
|
"Under construction, do not use."
|
|
73
|
-
zsize:
|
|
74
|
+
zsize: PositiveFloat | None
|
|
74
75
|
"Under construction, do not use."
|
|
75
|
-
max_molecule_count:
|
|
76
|
+
max_molecule_count: PositiveInt # Maximum amount of molecules to attempt.
|
|
76
77
|
"The maximum amount of molecule placements to attempt."
|
|
77
|
-
lattice_a:
|
|
78
|
+
lattice_a: PositiveFloat # The lattice constant. Spacing between nearest points.
|
|
78
79
|
"The lattice spacing in Angstrom."
|
|
79
|
-
boundary_type:
|
|
80
|
+
boundary_type: Literal["soft", "hard", "periodic"] # Boundary condition: soft, hard, or periodic.
|
|
80
81
|
"The boundary type. 'soft', 'hard', or 'periodic'."
|
|
81
|
-
sticking_probability:
|
|
82
|
+
sticking_probability: PositiveFloat = Field(le=1.) # Lower probability means more rejection.
|
|
82
83
|
"The sticking probability of the molecules, between 0 and 1."
|
|
83
84
|
|
|
84
85
|
|
|
86
|
+
def _config_loader(rsa_config: RsaConfig) -> Config:
|
|
87
|
+
"""Load the RsaConfig into the Config class.
|
|
88
|
+
|
|
89
|
+
:param rsa_config: The RsaConfig.
|
|
90
|
+
:returns: The Config.
|
|
91
|
+
"""
|
|
92
|
+
return Config(
|
|
93
|
+
# rsa_config=rsa_config,
|
|
94
|
+
sites=rsa_config.get_value("sites", required=False), # type: ignore[arg-type]
|
|
95
|
+
xsize=rsa_config.get_value("xsize", required=False), # type: ignore[arg-type]
|
|
96
|
+
ysize=rsa_config.get_value("ysize", required=False), # type: ignore[arg-type]
|
|
97
|
+
zsize=rsa_config.get_value("zsize", required=False), # type: ignore[arg-type]
|
|
98
|
+
max_molecule_count=rsa_config.get_value("max_molecule_count"), # type: ignore[arg-type]
|
|
99
|
+
lattice_a=rsa_config.get_value("lattice_a"), # type: ignore[arg-type]
|
|
100
|
+
boundary_type=rsa_config.get_value("boundary_type"), # type: ignore[arg-type]
|
|
101
|
+
sticking_probability=rsa_config.get_value("sticking_probability"), # type: ignore[arg-type]
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
85
105
|
class BoundaryParameters:
|
|
86
106
|
"""Store the boundary parameters for the surface and the molecule groups.
|
|
87
107
|
|
|
@@ -329,17 +349,7 @@ class MoleculeGroup:
|
|
|
329
349
|
self.group_id: Final[int] = next(mgc) # Automatically assigns next mol number.
|
|
330
350
|
"ID value of the molecule group. Automatically iterates when making new molecule groups."
|
|
331
351
|
|
|
332
|
-
self.config: Final[Config] =
|
|
333
|
-
rsa_config=rsa_config,
|
|
334
|
-
sites=rsa_config.get_value("sites", required=False), # type: ignore[arg-type]
|
|
335
|
-
xsize=rsa_config.get_value("xsize", required=False), # type: ignore[arg-type]
|
|
336
|
-
ysize=rsa_config.get_value("ysize", required=False), # type: ignore[arg-type]
|
|
337
|
-
zsize=rsa_config.get_value("zsize", required=False), # type: ignore[arg-type]
|
|
338
|
-
max_molecule_count=rsa_config.get_value("max_molecule_count"), # type: ignore[arg-type]
|
|
339
|
-
lattice_a=rsa_config.get_value("lattice_a"), # type: ignore[arg-type]
|
|
340
|
-
boundary_type=rsa_config.get_value("boundary_type"), # type: ignore[arg-type]
|
|
341
|
-
sticking_probability=rsa_config.get_value("sticking_probability"), # type: ignore[arg-type]
|
|
342
|
-
)
|
|
352
|
+
self.config: Final[Config] = _config_loader(rsa_config)
|
|
343
353
|
"Config values."
|
|
344
354
|
|
|
345
355
|
self.molecule: Final[Polygon] = molecule # The molecule polygon data.
|
|
@@ -462,7 +472,7 @@ class MoleculeGroup:
|
|
|
462
472
|
return bopa # If the boundary condition was hard, bounding box coordinates have been added.
|
|
463
473
|
|
|
464
474
|
|
|
465
|
-
@dataclass(
|
|
475
|
+
@dataclass(slots=True)
|
|
466
476
|
class CandidateMolecule: # Molecule is mistaken for Any by mypy.
|
|
467
477
|
"""Create a candidate molecule with temporary data.
|
|
468
478
|
|
|
@@ -553,17 +563,7 @@ class Simulator:
|
|
|
553
563
|
:param boundary_type: type of boundary conditions, optional. If None, defaults to config.json (periodic).
|
|
554
564
|
:raises ValueError: if no molecules are provided.
|
|
555
565
|
"""
|
|
556
|
-
self.config: Final[Config] =
|
|
557
|
-
rsa_config=rsa_config,
|
|
558
|
-
sites=rsa_config.get_value("sites", required=False), # type: ignore[arg-type]
|
|
559
|
-
xsize=rsa_config.get_value("xsize", required=False), # type: ignore[arg-type]
|
|
560
|
-
ysize=rsa_config.get_value("ysize", required=False), # type: ignore[arg-type]
|
|
561
|
-
zsize=rsa_config.get_value("zsize", required=False), # type: ignore[arg-type]
|
|
562
|
-
max_molecule_count=rsa_config.get_value("max_molecule_count"), # type: ignore[arg-type]
|
|
563
|
-
lattice_a=rsa_config.get_value("lattice_a"), # type: ignore[arg-type]
|
|
564
|
-
boundary_type=rsa_config.get_value("boundary_type") if boundary_type is None else boundary_type, # type: ignore[arg-type]
|
|
565
|
-
sticking_probability=rsa_config.get_value("sticking_probability"), # type: ignore[arg-type]
|
|
566
|
-
)
|
|
566
|
+
self.config: Final[Config] = _config_loader(rsa_config)
|
|
567
567
|
"Config values."
|
|
568
568
|
|
|
569
569
|
self.rng: np.random.Generator = rng
|
|
@@ -1127,17 +1127,7 @@ class Surface:
|
|
|
1127
1127
|
:param sticking_probability: Sticking probability. Default is 1.0 from config.
|
|
1128
1128
|
:raise ValueError: If only x or y is provided for a custom surface. Currently unusable.
|
|
1129
1129
|
"""
|
|
1130
|
-
self.config: Final[Config] =
|
|
1131
|
-
rsa_config=rsa_config,
|
|
1132
|
-
sites=rsa_config.get_value("sites", required=False), # type: ignore[arg-type]
|
|
1133
|
-
xsize=rsa_config.get_value("xsize", required=False), # type: ignore[arg-type]
|
|
1134
|
-
ysize=rsa_config.get_value("ysize", required=False), # type: ignore[arg-type]
|
|
1135
|
-
zsize=rsa_config.get_value("zsize", required=False), # type: ignore[arg-type]
|
|
1136
|
-
max_molecule_count=rsa_config.get_value("max_molecule_count"), # type: ignore[arg-type]
|
|
1137
|
-
lattice_a=rsa_config.get_value("lattice_a"), # type: ignore[arg-type]
|
|
1138
|
-
boundary_type=rsa_config.get_value("boundary_type") if boundary_type is None else boundary_type, # type: ignore[arg-type]
|
|
1139
|
-
sticking_probability=rsa_config.get_value("sticking_probability"), # type: ignore[arg-type]
|
|
1140
|
-
)
|
|
1130
|
+
self.config: Final[Config] = _config_loader(rsa_config)
|
|
1141
1131
|
"Config values."
|
|
1142
1132
|
|
|
1143
1133
|
# Constants:
|
|
@@ -98,7 +98,7 @@ def run_simulation( # noqa: PLR0913
|
|
|
98
98
|
5. The Simulator class.
|
|
99
99
|
:raises TypeError: If the sticking probability is an invalid type.
|
|
100
100
|
"""
|
|
101
|
-
rsa_config = RsaConfig(
|
|
101
|
+
rsa_config = RsaConfig(Path(__file__).parent / "config.json") if rsa_config is None else rsa_config
|
|
102
102
|
|
|
103
103
|
mol_lst: GeoArray
|
|
104
104
|
rot_syms: IdxArray
|
|
@@ -544,7 +544,7 @@ def main() -> Literal[0]:
|
|
|
544
544
|
:return: 0 on success.
|
|
545
545
|
"""
|
|
546
546
|
config_path = Path(__file__).parent / "config.json"
|
|
547
|
-
rsa_config = RsaConfig(
|
|
547
|
+
rsa_config = RsaConfig(config_path)
|
|
548
548
|
start = time.perf_counter()
|
|
549
549
|
run_simulation(rsa_config, plot_output_flag=True, include_rejected_flux=False)
|
|
550
550
|
end = time.perf_counter()
|
adsorpy-1.2.1/tach.toml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interfaces = []
|
|
2
|
+
exclude = [
|
|
3
|
+
"**/*__pycache__",
|
|
4
|
+
"**/*egg-info",
|
|
5
|
+
"**/docs",
|
|
6
|
+
"**/tests",
|
|
7
|
+
"**/venv",
|
|
8
|
+
]
|
|
9
|
+
source_roots = [
|
|
10
|
+
".",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[[modules]]
|
|
14
|
+
path = "src.adsorpy.rsa_calculator"
|
|
15
|
+
depends_on = []
|
|
16
|
+
|
|
17
|
+
[[modules]]
|
|
18
|
+
path = "src.adsorpy.randomsequentialadsorption"
|
|
19
|
+
depends_on = ["src.adsorpy.rsa_calculator"]
|
|
20
|
+
|
|
21
|
+
[[modules]]
|
|
22
|
+
path = "src.adsorpy.rsa_config"
|
|
23
|
+
depends_on = []
|
|
24
|
+
|
|
25
|
+
[[modules]]
|
|
26
|
+
path = "src.adsorpy.molecule_lib"
|
|
27
|
+
depends_on = []
|
|
28
|
+
|
|
29
|
+
[[modules]]
|
|
30
|
+
path = "src.adsorpy.run_simulation"
|
|
31
|
+
depends_on = [
|
|
32
|
+
"src.adsorpy.randomsequentialadsorption",
|
|
33
|
+
"src.adsorpy.rsa_config",
|
|
34
|
+
"src.adsorpy.molecule_lib"
|
|
35
|
+
]
|
adsorpy-1.2.1/tox.toml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
min_version = "4.53.1"
|
|
2
|
+
env_list = ["py310", "py311", "py312", "py313", "py314", "ruff", "mypy", "pyright", "tach", "slotscheck"]
|
|
3
|
+
isolated_build = true
|
|
4
|
+
recreate = true
|
|
5
|
+
labels = { test = ["py310", "py311", "py312", "py313", "py314"], static = ["ruff", "mypy", "pyright", "tach", "slotscheck"] }
|
|
6
|
+
|
|
7
|
+
[gh.python]
|
|
8
|
+
"3.10" = ["py310"]
|
|
9
|
+
"3.11" = ["py311"]
|
|
10
|
+
"3.12" = ["py312"]
|
|
11
|
+
"3.13" = ["py313"]
|
|
12
|
+
"3.14" = ["ruff", "mypy", "pyright", "tach", "slotscheck", "py314"]
|
|
13
|
+
|
|
14
|
+
[env_run_base]
|
|
15
|
+
pass_env = ["CI", "GITHUB_*", "CODECOV_*"]
|
|
16
|
+
#set_env.COVERAGE_FILE = "{envtmpdir}/.coverage"
|
|
17
|
+
deps = ["-e .[test]"]
|
|
18
|
+
commands = [["pytest", "--basetemp={envtmpdir}", "--cov-report=term", "--junitxml=results.xml"],
|
|
19
|
+
["codecov"],
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[env.ruff]
|
|
23
|
+
skip_install = true
|
|
24
|
+
deps = ["ruff"]
|
|
25
|
+
commands = [["ruff", "check", "src", "tests"]]
|
|
26
|
+
|
|
27
|
+
[env.mypy]
|
|
28
|
+
skip_install = true
|
|
29
|
+
deps = ["mypy", "numpy", "pydantic"]
|
|
30
|
+
commands = [["mypy", "--strict", "--ignore-missing-imports", "--disallow-any-explicit", "--allow-untyped-decorators", "--exclude", "/scripts/", "src", "tests"],
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[env.pyright]
|
|
34
|
+
deps = ["pyright", "[test]"]
|
|
35
|
+
commands = [["pyright"]]
|
|
36
|
+
|
|
37
|
+
[env.slotscheck]
|
|
38
|
+
deps = ["slotscheck"]
|
|
39
|
+
commands = [["python", "-m", "slotscheck", "."]]
|
|
40
|
+
|
|
41
|
+
[env.tach]
|
|
42
|
+
skip_install = true
|
|
43
|
+
deps = ["tach"]
|
|
44
|
+
commands = [["tach", "check"]]
|
adsorpy-1.2.0/tox.toml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
min_version = "4.53.0"
|
|
2
|
-
env_list = ["py310", "py311", "py312", "py313", "py314", "ruff", "mypy", "pyright"]
|
|
3
|
-
isolated_build = true
|
|
4
|
-
#labels = { test = ["py310", "py311", "py312", "py313", "py314"], static = ["ruff", "mypy"] }
|
|
5
|
-
|
|
6
|
-
[gh.python]
|
|
7
|
-
"310" = ["py310"]
|
|
8
|
-
"311" = ["py311"]
|
|
9
|
-
"312" = ["py312"]
|
|
10
|
-
"313" = ["ruff", "mypy", "pyright", "py313"]
|
|
11
|
-
"314" = ["py314"]
|
|
12
|
-
|
|
13
|
-
[env_run_base]
|
|
14
|
-
set_env = { PYTHONPATH = "{toxinidir}" }
|
|
15
|
-
pass_env = ["CI", "GITHUB_*", "CODECOV_*"]
|
|
16
|
-
deps = ["-e .[test]"]
|
|
17
|
-
commands = [["pytest", "--basetemp={envtmpdir}", "--cov-report=term", "--junitxml=results.xml"],
|
|
18
|
-
["codecov"],
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
[env.ruff]
|
|
22
|
-
base_python = "python3.13"
|
|
23
|
-
deps = ["-e .[lint]"]
|
|
24
|
-
commands = [["ruff", "check", "src", "tests"]]
|
|
25
|
-
|
|
26
|
-
[env.mypy]
|
|
27
|
-
base_python = "python3.13"
|
|
28
|
-
deps = ["-e .[lint]"]
|
|
29
|
-
commands = [["mypy", "--strict", "--ignore-missing-imports", "--disallow-any-explicit", "--allow-untyped-decorators", "--exclude", "/scripts/", "src", "tests"],
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
[env.pyright]
|
|
33
|
-
base_python = "python3.13"
|
|
34
|
-
deps = ["-e .[lint,test]"]
|
|
35
|
-
commands = [["pyright"]]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|