ml-peg 0.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.
Files changed (120) hide show
  1. ml_peg-0.2.1/PKG-INFO +198 -0
  2. ml_peg-0.2.1/README.md +151 -0
  3. ml_peg-0.2.1/ml_peg/__init__.py +7 -0
  4. ml_peg-0.2.1/ml_peg/analysis/__init__.py +7 -0
  5. ml_peg-0.2.1/ml_peg/analysis/bulk_crystal/elasticity/analyse_elasticity.py +235 -0
  6. ml_peg-0.2.1/ml_peg/analysis/bulk_crystal/elasticity/metrics.yml +13 -0
  7. ml_peg-0.2.1/ml_peg/analysis/bulk_crystal/lattice_constants/analyse_lattice_constants.py +283 -0
  8. ml_peg-0.2.1/ml_peg/analysis/bulk_crystal/lattice_constants/metrics.yml +13 -0
  9. ml_peg-0.2.1/ml_peg/analysis/molecular/GMTKN55/analyse_GMTKN55.py +341 -0
  10. ml_peg-0.2.1/ml_peg/analysis/molecular/GMTKN55/metrics.yml +43 -0
  11. ml_peg-0.2.1/ml_peg/analysis/molecular/Wiggle150/analyse_Wiggle150.py +194 -0
  12. ml_peg-0.2.1/ml_peg/analysis/molecular/Wiggle150/metrics.yml +7 -0
  13. ml_peg-0.2.1/ml_peg/analysis/molecular_crystal/DMC_ICE13/analyse_DMC_ICE13.py +169 -0
  14. ml_peg-0.2.1/ml_peg/analysis/molecular_crystal/DMC_ICE13/metrics.yml +7 -0
  15. ml_peg-0.2.1/ml_peg/analysis/molecular_crystal/X23/analyse_X23.py +172 -0
  16. ml_peg-0.2.1/ml_peg/analysis/molecular_crystal/X23/metrics.yml +7 -0
  17. ml_peg-0.2.1/ml_peg/analysis/nebs/li_diffusion/analyse_li_diffusion.py +161 -0
  18. ml_peg-0.2.1/ml_peg/analysis/nebs/li_diffusion/metrics.yml +13 -0
  19. ml_peg-0.2.1/ml_peg/analysis/physicality/diatomics/analyse_diatomics.py +394 -0
  20. ml_peg-0.2.1/ml_peg/analysis/physicality/diatomics/metrics.yml +26 -0
  21. ml_peg-0.2.1/ml_peg/analysis/physicality/extensivity/analyse_extensivity.py +90 -0
  22. ml_peg-0.2.1/ml_peg/analysis/physicality/extensivity/metrics.yml +7 -0
  23. ml_peg-0.2.1/ml_peg/analysis/physicality/locality/analyse_locality.py +143 -0
  24. ml_peg-0.2.1/ml_peg/analysis/physicality/locality/metrics.yml +19 -0
  25. ml_peg-0.2.1/ml_peg/analysis/supramolecular/LNCI16/analyse_LNCI16.py +252 -0
  26. ml_peg-0.2.1/ml_peg/analysis/supramolecular/LNCI16/metrics.yml +7 -0
  27. ml_peg-0.2.1/ml_peg/analysis/supramolecular/PLF547/analyse_PLF547.py +236 -0
  28. ml_peg-0.2.1/ml_peg/analysis/supramolecular/PLF547/metrics.yml +22 -0
  29. ml_peg-0.2.1/ml_peg/analysis/supramolecular/S30L/analyse_S30L.py +264 -0
  30. ml_peg-0.2.1/ml_peg/analysis/supramolecular/S30L/metrics.yml +22 -0
  31. ml_peg-0.2.1/ml_peg/analysis/surfaces/OC157/analyse_OC157.py +224 -0
  32. ml_peg-0.2.1/ml_peg/analysis/surfaces/OC157/metrics.yml +13 -0
  33. ml_peg-0.2.1/ml_peg/analysis/surfaces/S24/analyse_S24.py +198 -0
  34. ml_peg-0.2.1/ml_peg/analysis/surfaces/S24/metrics.yml +7 -0
  35. ml_peg-0.2.1/ml_peg/analysis/surfaces/elemental_slab_oxygen_adsorption/analyse_elemental_slab_oxygen_adsorption.py +180 -0
  36. ml_peg-0.2.1/ml_peg/analysis/surfaces/elemental_slab_oxygen_adsorption/metrics.yml +7 -0
  37. ml_peg-0.2.1/ml_peg/analysis/utils/decorators.py +1505 -0
  38. ml_peg-0.2.1/ml_peg/analysis/utils/utils.py +560 -0
  39. ml_peg-0.2.1/ml_peg/app/__init__.py +7 -0
  40. ml_peg-0.2.1/ml_peg/app/base_app.py +92 -0
  41. ml_peg-0.2.1/ml_peg/app/build_app.py +414 -0
  42. ml_peg-0.2.1/ml_peg/app/bulk_crystal/bulk_crystal.yml +2 -0
  43. ml_peg-0.2.1/ml_peg/app/bulk_crystal/elasticity/app_elasticity.py +85 -0
  44. ml_peg-0.2.1/ml_peg/app/bulk_crystal/lattice_constants/app_lattice_constants.py +95 -0
  45. ml_peg-0.2.1/ml_peg/app/data/onboarding/interactive-tables-plots.mp4 +0 -0
  46. ml_peg-0.2.1/ml_peg/app/data/onboarding/tooltips.mp4 +0 -0
  47. ml_peg-0.2.1/ml_peg/app/data/onboarding/weights-thresholds.mp4 +0 -0
  48. ml_peg-0.2.1/ml_peg/app/molecular/GMTKN55/app_GMTKN55.py +98 -0
  49. ml_peg-0.2.1/ml_peg/app/molecular/Wiggle150/app_Wiggle150.py +95 -0
  50. ml_peg-0.2.1/ml_peg/app/molecular/molecular.yml +2 -0
  51. ml_peg-0.2.1/ml_peg/app/molecular_crystal/DMC_ICE13/app_DMC_ICE13.py +87 -0
  52. ml_peg-0.2.1/ml_peg/app/molecular_crystal/X23/app_X23.py +89 -0
  53. ml_peg-0.2.1/ml_peg/app/molecular_crystal/molecular_crystal.yml +2 -0
  54. ml_peg-0.2.1/ml_peg/app/nebs/li_diffusion/app_li_diffusion.py +101 -0
  55. ml_peg-0.2.1/ml_peg/app/nebs/nebs.yml +2 -0
  56. ml_peg-0.2.1/ml_peg/app/physicality/diatomics/app_diatomics.py +101 -0
  57. ml_peg-0.2.1/ml_peg/app/physicality/extensivity/app_extensivity.py +73 -0
  58. ml_peg-0.2.1/ml_peg/app/physicality/locality/app_locality.py +74 -0
  59. ml_peg-0.2.1/ml_peg/app/physicality/physicality.yml +2 -0
  60. ml_peg-0.2.1/ml_peg/app/run_app.py +64 -0
  61. ml_peg-0.2.1/ml_peg/app/supramolecular/LNCI16/app_LNCI16.py +92 -0
  62. ml_peg-0.2.1/ml_peg/app/supramolecular/PLF547/app_PLF547.py +111 -0
  63. ml_peg-0.2.1/ml_peg/app/supramolecular/S30L/app_S30L.py +96 -0
  64. ml_peg-0.2.1/ml_peg/app/supramolecular/supramolecular.yml +2 -0
  65. ml_peg-0.2.1/ml_peg/app/surfaces/OC157/app_OC157.py +96 -0
  66. ml_peg-0.2.1/ml_peg/app/surfaces/S24/app_S24.py +91 -0
  67. ml_peg-0.2.1/ml_peg/app/surfaces/elemental_slab_oxygen_adsorption/app_elemental_slab_oxygen_adsorption.py +91 -0
  68. ml_peg-0.2.1/ml_peg/app/surfaces/surfaces.yml +2 -0
  69. ml_peg-0.2.1/ml_peg/app/utils/build_callbacks.py +604 -0
  70. ml_peg-0.2.1/ml_peg/app/utils/build_components.py +864 -0
  71. ml_peg-0.2.1/ml_peg/app/utils/load.py +319 -0
  72. ml_peg-0.2.1/ml_peg/app/utils/onboarding.py +418 -0
  73. ml_peg-0.2.1/ml_peg/app/utils/register_callbacks.py +646 -0
  74. ml_peg-0.2.1/ml_peg/app/utils/utils.py +822 -0
  75. ml_peg-0.2.1/ml_peg/app/utils/weas.py +99 -0
  76. ml_peg-0.2.1/ml_peg/calcs/__init__.py +7 -0
  77. ml_peg-0.2.1/ml_peg/calcs/bulk_crystal/elasticity/calc_elasticity.py +107 -0
  78. ml_peg-0.2.1/ml_peg/calcs/bulk_crystal/lattice_constants/calc_lattice_constants.py +144 -0
  79. ml_peg-0.2.1/ml_peg/calcs/molecular/GMTKN55/calc_GMTKN55.py +107 -0
  80. ml_peg-0.2.1/ml_peg/calcs/molecular/Wiggle150/.dvc/.gitignore +3 -0
  81. ml_peg-0.2.1/ml_peg/calcs/molecular/Wiggle150/calc_Wiggle150.py +205 -0
  82. ml_peg-0.2.1/ml_peg/calcs/molecular_crystal/DMC_ICE13/calc_DMC_ICE13.py +75 -0
  83. ml_peg-0.2.1/ml_peg/calcs/molecular_crystal/X23/calc_X23.py +82 -0
  84. ml_peg-0.2.1/ml_peg/calcs/nebs/li_diffusion/calc_li_diffusion.py +98 -0
  85. ml_peg-0.2.1/ml_peg/calcs/nebs/li_diffusion/data/LiFePO4_end_b.cif +136 -0
  86. ml_peg-0.2.1/ml_peg/calcs/nebs/li_diffusion/data/LiFePO4_end_c.cif +136 -0
  87. ml_peg-0.2.1/ml_peg/calcs/nebs/li_diffusion/data/LiFePO4_start_bc.cif +136 -0
  88. ml_peg-0.2.1/ml_peg/calcs/physicality/diatomics/calc_diatomics.py +248 -0
  89. ml_peg-0.2.1/ml_peg/calcs/physicality/extensivity/calc_extensivity.py +102 -0
  90. ml_peg-0.2.1/ml_peg/calcs/physicality/locality/calc_locality.py +218 -0
  91. ml_peg-0.2.1/ml_peg/calcs/supramolecular/LNCI16/.dvc/.gitignore +3 -0
  92. ml_peg-0.2.1/ml_peg/calcs/supramolecular/LNCI16/.dvc/config +0 -0
  93. ml_peg-0.2.1/ml_peg/calcs/supramolecular/LNCI16/calc_LNCI16.py +320 -0
  94. ml_peg-0.2.1/ml_peg/calcs/supramolecular/PLF547/.dvc/.gitignore +3 -0
  95. ml_peg-0.2.1/ml_peg/calcs/supramolecular/PLF547/.dvc/config +0 -0
  96. ml_peg-0.2.1/ml_peg/calcs/supramolecular/PLF547/calc_PLF547.py +341 -0
  97. ml_peg-0.2.1/ml_peg/calcs/supramolecular/S30L/.dvc/.gitignore +3 -0
  98. ml_peg-0.2.1/ml_peg/calcs/supramolecular/S30L/.dvc/config +0 -0
  99. ml_peg-0.2.1/ml_peg/calcs/supramolecular/S30L/calc_S30L.py +287 -0
  100. ml_peg-0.2.1/ml_peg/calcs/surfaces/.dvcignore +3 -0
  101. ml_peg-0.2.1/ml_peg/calcs/surfaces/OC157/.dvc/.gitignore +3 -0
  102. ml_peg-0.2.1/ml_peg/calcs/surfaces/OC157/.dvc/config +0 -0
  103. ml_peg-0.2.1/ml_peg/calcs/surfaces/OC157/.dvcignore +3 -0
  104. ml_peg-0.2.1/ml_peg/calcs/surfaces/OC157/calc_OC157.py +201 -0
  105. ml_peg-0.2.1/ml_peg/calcs/surfaces/S24/.dvc/.gitignore +3 -0
  106. ml_peg-0.2.1/ml_peg/calcs/surfaces/S24/.dvc/config +0 -0
  107. ml_peg-0.2.1/ml_peg/calcs/surfaces/S24/.dvcignore +3 -0
  108. ml_peg-0.2.1/ml_peg/calcs/surfaces/S24/calc_S24.py +221 -0
  109. ml_peg-0.2.1/ml_peg/calcs/surfaces/elemental_slab_oxygen_adsorption/.dvc/.gitignore +3 -0
  110. ml_peg-0.2.1/ml_peg/calcs/surfaces/elemental_slab_oxygen_adsorption/.dvc/config +0 -0
  111. ml_peg-0.2.1/ml_peg/calcs/surfaces/elemental_slab_oxygen_adsorption/.dvcignore +3 -0
  112. ml_peg-0.2.1/ml_peg/calcs/surfaces/elemental_slab_oxygen_adsorption/calc_elemental_slab_oxygen_adsorption.py +162 -0
  113. ml_peg-0.2.1/ml_peg/calcs/utils/utils.py +141 -0
  114. ml_peg-0.2.1/ml_peg/cli/cli.py +281 -0
  115. ml_peg-0.2.1/ml_peg/data/data.py +98 -0
  116. ml_peg-0.2.1/ml_peg/models/__init__.py +7 -0
  117. ml_peg-0.2.1/ml_peg/models/get_models.py +187 -0
  118. ml_peg-0.2.1/ml_peg/models/models.py +237 -0
  119. ml_peg-0.2.1/ml_peg/models/models.yml +172 -0
  120. ml_peg-0.2.1/pyproject.toml +210 -0
ml_peg-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.3
2
+ Name: ml-peg
3
+ Version: 0.2.1
4
+ Summary: ML potential usability and performance guide
5
+ Author: Elliott Kasoar, Joseph Hart, Ilyes Batatia, Alin M. Elena, Gábor Csányi
6
+ Classifier: Programming Language :: Python
7
+ Classifier: Programming Language :: Python :: 3.10
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
+ Classifier: Natural Language :: English
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Requires-Dist: boto3>=1.40.49,<2
16
+ Requires-Dist: dash>=3.1.1
17
+ Requires-Dist: janus-core>=0.8.2,<1.0.0
18
+ Requires-Dist: kaleido>=1.0.0
19
+ Requires-Dist: mlipx>=0.1.5,<0.2
20
+ Requires-Dist: scikit-learn>=1.7.1
21
+ Requires-Dist: typer>=0.19.1,<1.0.0
22
+ Requires-Dist: matcalc
23
+ Requires-Dist: matminer
24
+ Requires-Dist: mdanalysis
25
+ Requires-Dist: chgnet==0.4.0 ; extra == 'chgnet'
26
+ Requires-Dist: torch-dftd==0.5.1 ; extra == 'd3'
27
+ Requires-Dist: deepmd-kit==3.1.0 ; extra == 'dpa3'
28
+ Requires-Dist: tensorpotential==0.5.1 ; python_full_version < '3.13' and extra == 'grace'
29
+ Requires-Dist: mace-torch==0.3.14 ; extra == 'mace'
30
+ Requires-Dist: mattersim==1.2.0 ; extra == 'mattersim'
31
+ Requires-Dist: orb-models==0.5.5 ; python_full_version < '3.13' and sys_platform != 'win32' and extra == 'orb'
32
+ Requires-Dist: pet-mad==1.4.4 ; sys_platform != 'win32' and extra == 'pet-mad'
33
+ Requires-Dist: fairchem-core==2.10.0 ; extra == 'uma'
34
+ Requires-Python: >=3.10
35
+ Project-URL: Repository, https://github.com/ddmms/ml-peg/
36
+ Project-URL: Documentation, https://ddmms.github.io/ml-peg/
37
+ Provides-Extra: chgnet
38
+ Provides-Extra: d3
39
+ Provides-Extra: dpa3
40
+ Provides-Extra: grace
41
+ Provides-Extra: mace
42
+ Provides-Extra: mattersim
43
+ Provides-Extra: orb
44
+ Provides-Extra: pet-mad
45
+ Provides-Extra: uma
46
+ Description-Content-Type: text/markdown
47
+
48
+ # ML-PEG: ML potential usability and performance guide
49
+
50
+ [![PyPI version][pypi-badge]][pypi-link]
51
+ [![Python versions][python-badge]][python-link]
52
+ [![Build Status][ci-badge]][ci-link]
53
+ [![Docs status][docs-badge]][docs-link]
54
+ [![License][license-badge]][license-link]
55
+ [![DOI][doi-badge]][doi-link]
56
+
57
+ 🔗 See our live guide: https://ml-peg.stfc.ac.uk
58
+
59
+ > [!NOTE]
60
+ > Migration in progress! The live benchmarks are currently run and analysed using
61
+ > [mlipx](https://github.com/basf/mlipx) nodes defined in this repository:
62
+ > https://github.com/joehart2001/mlipx.
63
+ >
64
+ > New benchmarks are expected to be added following the format defined in this
65
+ > repository, and work is ongoing to migrate all existing benchmarks to this format.
66
+ > Our original interactive analysis suite is currently hosted at: http://mlip-testing.stfc.ac.uk:8050
67
+
68
+ ## Contents
69
+ - [Getting started](#getting-started)
70
+ - [Features](#features)
71
+ - [Docker/Podman images](#dockerpodman-images)
72
+ - [Development](#development)
73
+ - [License](#license)
74
+
75
+ ## Getting started
76
+
77
+ ### Dependencies
78
+
79
+ All required and optional dependencies can be found in [pyproject.toml](pyproject.toml).
80
+
81
+
82
+ ### Installation
83
+
84
+ The latest stable release of ML-PEG, including its dependencies, will be installable from PyPI by running:
85
+
86
+ ```
87
+ python3 -m pip install ml-peg
88
+ ```
89
+
90
+ To get all the latest changes, ML-PEG can be installed from GitHub:
91
+
92
+ ```
93
+ python3 -m pip install git+https://github.com/ddmms/ml-peg.git
94
+ ```
95
+
96
+
97
+ ## Features
98
+
99
+ Coming soon!
100
+
101
+
102
+ ## Docker/Podman images
103
+
104
+ You can use [Docker](https://www.docker.com) or [Podman](https://podman.io/) to build
105
+ and/or run the ML-PEG app yourself.
106
+
107
+ > [!TIP]
108
+ > The commands below will assume you are using Docker. To use Podman, replace `docker`
109
+ > with `podman`, e.g. `podman pull`, `podman build`, and `podman run`.
110
+
111
+ A Docker image with the latest changes can be pulled from the
112
+ GitHub container registry, following the command that can be found under this
113
+ repository's [packages](https://github.com/ddmms/ml-peg/pkgs/container/ml-peg-app).
114
+
115
+
116
+ > [!NOTE]
117
+ > Currently, this repository only contains images for the linux/amd64 platform.
118
+ > On MacOS with ARM silicon, this can often still be run by setting
119
+ > `--platform linux/amd64` when using `docker run`.
120
+
121
+
122
+ Alternatively, to build the container yourself, you can use the
123
+ [Dockerfile](containers/Dockerfile) provided. From the `ml-peg` directory, run:
124
+
125
+ ```
126
+ docker build -t ml-peg-app -f containers/Dockerfile .
127
+ ```
128
+
129
+ Once built, you can mount your current application data and start the app by running:
130
+
131
+ ```
132
+ docker run --volume ./ml_peg/app/data:/app/ml_peg/app/data --publish 8050:8050 ml-peg-app
133
+ ```
134
+
135
+ > [!TIP]
136
+ > Ensure `ml_peg/app/data` is populated with results before running the container.
137
+ >
138
+ > A compressed zip file containing the current live data can be found at
139
+ > http://s3.echo.stfc.ac.uk/ml-peg-data/app/data/data.tar.gz.
140
+ >
141
+ > This may also be downloaded through the command line using
142
+ > ```
143
+ > ml_peg download --key app/data/data.tar.gz --filename data.tar.gz
144
+ > ```
145
+
146
+
147
+ Alternatively, you can use the [compose.yml](containers/compose.yml) file provided, via
148
+ Docker Compose:
149
+
150
+ ```
151
+ docker compose -f containers/compose.yml up -d
152
+ ```
153
+
154
+ The app should now be accessible at http://localhost:8050.
155
+
156
+ ## Development
157
+
158
+ Please ensure you have consulted our
159
+ [contribution guidelines](contributing.md)
160
+ and
161
+ [coding style](coding_style.md)
162
+ before proceeding.
163
+
164
+ We recommend installing `uv` for dependency management when developing for ML-PEG:
165
+
166
+ 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation)
167
+ 2. Install ML-PEG with dependencies in a virtual environment:
168
+
169
+ ```shell
170
+ git clone https://github.com/ddmms/ml-peg
171
+ cd ml-peg
172
+ uv sync # Create a virtual environment and install dependencies
173
+ source .venv/bin/activate
174
+ pre-commit install # Install pre-commit hooks
175
+ pytest -v # Discover and run all tests
176
+ ```
177
+
178
+ Please refer to the [online documentation](https://ddmms.github.io/ml-peg/developer_guide/index.html)
179
+ for information about contributing new benchmarks and models.
180
+
181
+ ## License
182
+
183
+ [GNU General Public License version 3](LICENSE)
184
+
185
+ [pypi-badge]: https://badge.fury.io/py/ml-peg.svg
186
+ [pypi-link]: https://pypi.org/project/ml-peg/
187
+ [python-badge]: https://img.shields.io/pypi/pyversions/ml-peg.svg
188
+ [python-link]: https://pypi.org/project/ml-peg/
189
+ [ci-badge]: https://github.com/ddmms/ml-peg/actions/workflows/ci.yml/badge.svg?branch=main
190
+ [ci-link]: https://github.com/ddmms/ml-peg/actions
191
+ [cov-badge]: https://coveralls.io/repos/github/ddmms/ml-peg/badge.svg?branch=main
192
+ [cov-link]: https://coveralls.io/github/ddmms/ml-peg?branch=main
193
+ [docs-badge]: https://github.com/ddmms/ml-peg/actions/workflows/docs.yml/badge.svg
194
+ [docs-link]: https://ddmms.github.io/ml-peg/
195
+ [license-badge]: https://img.shields.io/badge/License-GPLv3-blue.svg
196
+ [license-link]: https://opensource.org/license/gpl-3-0
197
+ [doi-link]: https://doi.org/10.5281/zenodo.16904444
198
+ [doi-badge]: https://zenodo.org/badge/DOI/10.5281/zenodo.16904444.svg
ml_peg-0.2.1/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # ML-PEG: ML potential usability and performance guide
2
+
3
+ [![PyPI version][pypi-badge]][pypi-link]
4
+ [![Python versions][python-badge]][python-link]
5
+ [![Build Status][ci-badge]][ci-link]
6
+ [![Docs status][docs-badge]][docs-link]
7
+ [![License][license-badge]][license-link]
8
+ [![DOI][doi-badge]][doi-link]
9
+
10
+ 🔗 See our live guide: https://ml-peg.stfc.ac.uk
11
+
12
+ > [!NOTE]
13
+ > Migration in progress! The live benchmarks are currently run and analysed using
14
+ > [mlipx](https://github.com/basf/mlipx) nodes defined in this repository:
15
+ > https://github.com/joehart2001/mlipx.
16
+ >
17
+ > New benchmarks are expected to be added following the format defined in this
18
+ > repository, and work is ongoing to migrate all existing benchmarks to this format.
19
+ > Our original interactive analysis suite is currently hosted at: http://mlip-testing.stfc.ac.uk:8050
20
+
21
+ ## Contents
22
+ - [Getting started](#getting-started)
23
+ - [Features](#features)
24
+ - [Docker/Podman images](#dockerpodman-images)
25
+ - [Development](#development)
26
+ - [License](#license)
27
+
28
+ ## Getting started
29
+
30
+ ### Dependencies
31
+
32
+ All required and optional dependencies can be found in [pyproject.toml](pyproject.toml).
33
+
34
+
35
+ ### Installation
36
+
37
+ The latest stable release of ML-PEG, including its dependencies, will be installable from PyPI by running:
38
+
39
+ ```
40
+ python3 -m pip install ml-peg
41
+ ```
42
+
43
+ To get all the latest changes, ML-PEG can be installed from GitHub:
44
+
45
+ ```
46
+ python3 -m pip install git+https://github.com/ddmms/ml-peg.git
47
+ ```
48
+
49
+
50
+ ## Features
51
+
52
+ Coming soon!
53
+
54
+
55
+ ## Docker/Podman images
56
+
57
+ You can use [Docker](https://www.docker.com) or [Podman](https://podman.io/) to build
58
+ and/or run the ML-PEG app yourself.
59
+
60
+ > [!TIP]
61
+ > The commands below will assume you are using Docker. To use Podman, replace `docker`
62
+ > with `podman`, e.g. `podman pull`, `podman build`, and `podman run`.
63
+
64
+ A Docker image with the latest changes can be pulled from the
65
+ GitHub container registry, following the command that can be found under this
66
+ repository's [packages](https://github.com/ddmms/ml-peg/pkgs/container/ml-peg-app).
67
+
68
+
69
+ > [!NOTE]
70
+ > Currently, this repository only contains images for the linux/amd64 platform.
71
+ > On MacOS with ARM silicon, this can often still be run by setting
72
+ > `--platform linux/amd64` when using `docker run`.
73
+
74
+
75
+ Alternatively, to build the container yourself, you can use the
76
+ [Dockerfile](containers/Dockerfile) provided. From the `ml-peg` directory, run:
77
+
78
+ ```
79
+ docker build -t ml-peg-app -f containers/Dockerfile .
80
+ ```
81
+
82
+ Once built, you can mount your current application data and start the app by running:
83
+
84
+ ```
85
+ docker run --volume ./ml_peg/app/data:/app/ml_peg/app/data --publish 8050:8050 ml-peg-app
86
+ ```
87
+
88
+ > [!TIP]
89
+ > Ensure `ml_peg/app/data` is populated with results before running the container.
90
+ >
91
+ > A compressed zip file containing the current live data can be found at
92
+ > http://s3.echo.stfc.ac.uk/ml-peg-data/app/data/data.tar.gz.
93
+ >
94
+ > This may also be downloaded through the command line using
95
+ > ```
96
+ > ml_peg download --key app/data/data.tar.gz --filename data.tar.gz
97
+ > ```
98
+
99
+
100
+ Alternatively, you can use the [compose.yml](containers/compose.yml) file provided, via
101
+ Docker Compose:
102
+
103
+ ```
104
+ docker compose -f containers/compose.yml up -d
105
+ ```
106
+
107
+ The app should now be accessible at http://localhost:8050.
108
+
109
+ ## Development
110
+
111
+ Please ensure you have consulted our
112
+ [contribution guidelines](contributing.md)
113
+ and
114
+ [coding style](coding_style.md)
115
+ before proceeding.
116
+
117
+ We recommend installing `uv` for dependency management when developing for ML-PEG:
118
+
119
+ 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation)
120
+ 2. Install ML-PEG with dependencies in a virtual environment:
121
+
122
+ ```shell
123
+ git clone https://github.com/ddmms/ml-peg
124
+ cd ml-peg
125
+ uv sync # Create a virtual environment and install dependencies
126
+ source .venv/bin/activate
127
+ pre-commit install # Install pre-commit hooks
128
+ pytest -v # Discover and run all tests
129
+ ```
130
+
131
+ Please refer to the [online documentation](https://ddmms.github.io/ml-peg/developer_guide/index.html)
132
+ for information about contributing new benchmarks and models.
133
+
134
+ ## License
135
+
136
+ [GNU General Public License version 3](LICENSE)
137
+
138
+ [pypi-badge]: https://badge.fury.io/py/ml-peg.svg
139
+ [pypi-link]: https://pypi.org/project/ml-peg/
140
+ [python-badge]: https://img.shields.io/pypi/pyversions/ml-peg.svg
141
+ [python-link]: https://pypi.org/project/ml-peg/
142
+ [ci-badge]: https://github.com/ddmms/ml-peg/actions/workflows/ci.yml/badge.svg?branch=main
143
+ [ci-link]: https://github.com/ddmms/ml-peg/actions
144
+ [cov-badge]: https://coveralls.io/repos/github/ddmms/ml-peg/badge.svg?branch=main
145
+ [cov-link]: https://coveralls.io/github/ddmms/ml-peg?branch=main
146
+ [docs-badge]: https://github.com/ddmms/ml-peg/actions/workflows/docs.yml/badge.svg
147
+ [docs-link]: https://ddmms.github.io/ml-peg/
148
+ [license-badge]: https://img.shields.io/badge/License-GPLv3-blue.svg
149
+ [license-link]: https://opensource.org/license/gpl-3-0
150
+ [doi-link]: https://doi.org/10.5281/zenodo.16904444
151
+ [doi-badge]: https://zenodo.org/badge/DOI/10.5281/zenodo.16904444.svg
@@ -0,0 +1,7 @@
1
+ """Testing framework for machine learnt interatomic potentials."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import version
6
+
7
+ __version__ = version("ml-peg")
@@ -0,0 +1,7 @@
1
+ """Run analysis for testing framework."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ ANALYSIS_ROOT = Path(__file__).parent
@@ -0,0 +1,235 @@
1
+ """Analyse elasticity benchmark."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+ import pandas as pd
9
+ import pytest
10
+
11
+ from ml_peg.analysis.utils.decorators import (
12
+ build_table,
13
+ plot_density_scatter,
14
+ )
15
+ from ml_peg.analysis.utils.utils import (
16
+ build_density_inputs,
17
+ load_metrics_config,
18
+ mae,
19
+ )
20
+ from ml_peg.app import APP_ROOT
21
+ from ml_peg.calcs import CALCS_ROOT
22
+ from ml_peg.models.get_models import get_model_names
23
+ from ml_peg.models.models import current_models
24
+
25
+ MODELS = get_model_names(current_models)
26
+ CALC_PATH = CALCS_ROOT / "bulk_crystal" / "elasticity" / "outputs"
27
+ OUT_PATH = APP_ROOT / "data" / "bulk_crystal" / "elasticity"
28
+
29
+ METRICS_CONFIG_PATH = Path(__file__).with_name("metrics.yml")
30
+ DEFAULT_THRESHOLDS, DEFAULT_TOOLTIPS, DEFAULT_WEIGHTS = load_metrics_config(
31
+ METRICS_CONFIG_PATH
32
+ )
33
+
34
+ K_COLUMN = "K_vrh"
35
+ G_COLUMN = "G_vrh"
36
+
37
+
38
+ def _filter_results(df: pd.DataFrame, model_name: str) -> tuple[pd.DataFrame, int]:
39
+ """
40
+ Filter outlier predictions and return remaining data with exclusion count.
41
+
42
+ Parameters
43
+ ----------
44
+ df
45
+ Dataframe containing raw benchmark results.
46
+ model_name
47
+ Model whose columns should be filtered.
48
+
49
+ Returns
50
+ -------
51
+ tuple[pd.DataFrame, int]
52
+ Filtered dataframe and number of excluded systems.
53
+ """
54
+ mask_bulk = df[f"{K_COLUMN}_{model_name}"].between(-50, 600)
55
+ mask_shear = df[f"{G_COLUMN}_{model_name}"].between(-50, 600)
56
+ valid = df[mask_bulk & mask_shear].copy()
57
+ excluded = len(df) - len(valid)
58
+ return valid, excluded
59
+
60
+
61
+ @pytest.fixture
62
+ def elasticity_stats() -> dict[str, dict[str, Any]]:
63
+ """
64
+ Load and cache processed benchmark statistics per model.
65
+
66
+ Returns
67
+ -------
68
+ dict[str, dict[str, Any]]
69
+ Processed information per model (bulk, shear, exclusion counts).
70
+ """
71
+ OUT_PATH.mkdir(parents=True, exist_ok=True)
72
+ stats: dict[str, dict[str, Any]] = {}
73
+ for model_name in MODELS:
74
+ results_path = CALC_PATH / model_name / "moduli_results.csv"
75
+ df = pd.read_csv(results_path)
76
+
77
+ filtered, excluded = _filter_results(df, model_name)
78
+
79
+ stats[model_name] = {
80
+ "bulk": {
81
+ "ref": filtered[f"{K_COLUMN}_DFT"].tolist(),
82
+ "pred": filtered[f"{K_COLUMN}_{model_name}"].tolist(),
83
+ },
84
+ "shear": {
85
+ "ref": filtered[f"{G_COLUMN}_DFT"].tolist(),
86
+ "pred": filtered[f"{G_COLUMN}_{model_name}"].tolist(),
87
+ },
88
+ "excluded": excluded,
89
+ }
90
+
91
+ return stats
92
+
93
+
94
+ @pytest.fixture
95
+ def bulk_mae(elasticity_stats: dict[str, dict[str, Any]]) -> dict[str, float | None]:
96
+ """
97
+ Mean absolute error for bulk modulus predictions.
98
+
99
+ Parameters
100
+ ----------
101
+ elasticity_stats
102
+ Aggregated bulk/shear data per model.
103
+
104
+ Returns
105
+ -------
106
+ dict[str, float | None]
107
+ MAE values for each model (``None`` if no data).
108
+ """
109
+ results: dict[str, float | None] = {}
110
+ for model_name in MODELS:
111
+ prop = elasticity_stats.get(model_name, {}).get("bulk")
112
+ results[model_name] = mae(prop["ref"], prop["pred"])
113
+ return results
114
+
115
+
116
+ @pytest.fixture
117
+ def shear_mae(elasticity_stats: dict[str, dict[str, Any]]) -> dict[str, float | None]:
118
+ """
119
+ Mean absolute error for shear modulus predictions.
120
+
121
+ Parameters
122
+ ----------
123
+ elasticity_stats
124
+ Aggregated bulk/shear data per model.
125
+
126
+ Returns
127
+ -------
128
+ dict[str, float | None]
129
+ MAE values for each model (``None`` if no data).
130
+ """
131
+ results: dict[str, float | None] = {}
132
+ for model_name in MODELS:
133
+ prop = elasticity_stats.get(model_name, {}).get("shear")
134
+ results[model_name] = mae(prop["ref"], prop["pred"])
135
+ return results
136
+
137
+
138
+ @pytest.fixture
139
+ @plot_density_scatter(
140
+ filename=OUT_PATH / "figure_bulk_density.json",
141
+ title="Bulk modulus density plot",
142
+ x_label="Reference bulk modulus / GPa",
143
+ y_label="Predicted bulk modulus / GPa",
144
+ )
145
+ def bulk_density(elasticity_stats: dict[str, dict[str, Any]]) -> dict[str, dict]:
146
+ """
147
+ Density scatter inputs for bulk modulus.
148
+
149
+ Parameters
150
+ ----------
151
+ elasticity_stats
152
+ Aggregated bulk/shear data per model.
153
+
154
+ Returns
155
+ -------
156
+ dict[str, dict]
157
+ Mapping of model name to density-scatter data.
158
+ """
159
+ return build_density_inputs(MODELS, elasticity_stats, "bulk", metric_fn=mae)
160
+
161
+
162
+ @pytest.fixture
163
+ @plot_density_scatter(
164
+ filename=OUT_PATH / "figure_shear_density.json",
165
+ title="Shear modulus density plot",
166
+ x_label="Reference shear modulus / GPa",
167
+ y_label="Predicted shear modulus / GPa",
168
+ )
169
+ def shear_density(elasticity_stats: dict[str, dict[str, Any]]) -> dict[str, dict]:
170
+ """
171
+ Density scatter inputs for shear modulus.
172
+
173
+ Parameters
174
+ ----------
175
+ elasticity_stats
176
+ Aggregated bulk/shear data per model.
177
+
178
+ Returns
179
+ -------
180
+ dict[str, dict]
181
+ Mapping of model name to density-scatter data.
182
+ """
183
+ return build_density_inputs(MODELS, elasticity_stats, "shear", metric_fn=mae)
184
+
185
+
186
+ @pytest.fixture
187
+ @build_table(
188
+ filename=OUT_PATH / "elasticity_metrics_table.json",
189
+ metric_tooltips=DEFAULT_TOOLTIPS,
190
+ thresholds=DEFAULT_THRESHOLDS,
191
+ weights=DEFAULT_WEIGHTS,
192
+ )
193
+ def metrics(
194
+ bulk_mae: dict[str, float | None],
195
+ shear_mae: dict[str, float | None],
196
+ ) -> dict[str, dict]:
197
+ """
198
+ All elasticity metrics.
199
+
200
+ Parameters
201
+ ----------
202
+ bulk_mae
203
+ Bulk modulus MAE per model.
204
+ shear_mae
205
+ Shear modulus MAE per model.
206
+
207
+ Returns
208
+ -------
209
+ dict[str, dict]
210
+ Mapping of metric name to model-value dictionaries.
211
+ """
212
+ return {
213
+ "Bulk modulus MAE": bulk_mae,
214
+ "Shear modulus MAE": shear_mae,
215
+ }
216
+
217
+
218
+ def test_elasticity(
219
+ metrics: dict[str, dict],
220
+ bulk_density: dict[str, dict],
221
+ shear_density: dict[str, dict],
222
+ ) -> None:
223
+ """
224
+ Run elasticity analysis.
225
+
226
+ Parameters
227
+ ----------
228
+ metrics
229
+ Benchmark metric values.
230
+ bulk_density
231
+ Density scatter inputs for bulk modulus.
232
+ shear_density
233
+ Density scatter inputs for shear modulus.
234
+ """
235
+ return
@@ -0,0 +1,13 @@
1
+ metrics:
2
+ Bulk modulus MAE:
3
+ good: 2.0
4
+ bad: 30.0
5
+ unit: GPa
6
+ tooltip: Mean absolute error of VRH bulk modulus (lower is better). Excludes systems with bulk moduli < -50 GPa and > 500 GPa.
7
+ level_of_theory: PBE
8
+ Shear modulus MAE:
9
+ good: 2.0
10
+ bad: 30.0
11
+ unit: GPa
12
+ tooltip: Mean absolute error of VRH shear modulus (lower is better). Excludes systems with shear moduli < -50 GPa and > 500 GPa.
13
+ level_of_theory: PBE