tensorial 0.7.0.dev1__tar.gz → 0.7.0.dev2__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.
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/PKG-INFO +6 -8
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/pyproject.toml +10 -9
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/__init__.py +1 -1
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/base.py +3 -3
- tensorial-0.7.0.dev2/src/tensorial/config.py +131 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/datasets/__init__.py +3 -2
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/datasets/qm9.py +6 -4
- tensorial-0.7.0.dev2/src/tensorial/datasets/rmd17.py +214 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/README.rst +51 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/data/3bpa.yaml +23 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/data/mad.yaml +22 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/data/qm9.yaml +19 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/data/rmd17.yaml +23 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/data/si.yaml +19 -0
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/debug/smoke.yaml +19 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/eval.yaml +5 -1
- tensorial-0.7.0.dev2/src/tensorial/examples/mlip/loss/mlip.yaml +28 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/model/mace.yaml +2 -24
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/model/nequip.yaml +5 -16
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/train.yaml +5 -1
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_message_passing.py +18 -12
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_spatial.py +2 -2
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_tree.py +37 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/atomic/_modules.py +4 -4
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_ase.py +23 -6
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_datamodule.py +82 -12
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/graph_ops.py +22 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/keys.py +10 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/losses.py +150 -26
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/mace.py +47 -5
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/metrics/_base.py +37 -22
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/nequip.py +89 -19
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/geometry/jax_neighbours.py +9 -9
- tensorial-0.7.0.dev2/src/tensorial/mlip/__init__.py +6 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/_stresses.py +12 -1
- tensorial-0.7.0.dev2/src/tensorial/mlip/losses.py +74 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/metrics.py +4 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/stats.py +5 -4
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/_metrics_printer.py +23 -20
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/_module.py +40 -15
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/cli.py +203 -30
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/config.py +3 -2
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/evaluate.py +33 -7
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/from_data.py +3 -2
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/listeners/parity_plotter.py +291 -69
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/train.py +37 -27
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/utils/instantiators.py +4 -3
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/utils/logging_utils.py +1 -1
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/signals/radials.py +5 -5
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/tensors.py +8 -6
- tensorial-0.7.0.dev1/src/tensorial/config.py +0 -33
- tensorial-0.7.0.dev1/src/tensorial/examples/mlip/README.rst +0 -29
- tensorial-0.7.0.dev1/src/tensorial/examples/mlip/data/mad.yaml +0 -15
- tensorial-0.7.0.dev1/src/tensorial/examples/mlip/data/qm9.yaml +0 -12
- tensorial-0.7.0.dev1/src/tensorial/examples/mlip/data/si.yaml +0 -14
- tensorial-0.7.0.dev1/src/tensorial/mlip/__init__.py +0 -5
- tensorial-0.7.0.dev1/src/tensorial/mlip/losses.py +0 -44
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/LICENSE.txt +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/README.rst +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/_provides.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/data.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/data/sitraj.xyz +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/extras/default.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/hydra/default.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/lennard_jones.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/default.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/early_stopping.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/metrics_printer.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/model_checkpoint.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/model_summary.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/none.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/parity_plotter.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/listeners/rich_progress_bar.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/logger/csv.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/logger/many_loggers.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/logger/mlflow.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/logger/tensorboard.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/paths/default.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/profiler/jax.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/trainer/cpu.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/trainer/ddp.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/trainer/ddp_sim.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/trainer/default.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/trainer/gpu.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/examples/mlip/trainer/mps.yaml +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_base.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_common.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_diff.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_edgewise.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_experimental.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_modules.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_nodewise.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_packing.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/_product_basis.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/atomic/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/atomic/_importing.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/atomic/_metrics.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/atomic/keys.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/calc.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_batching.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_common.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_dataloader.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_graph_padding.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/data/_urls.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/derivatives.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/experimental/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/experimental/derivatives.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/experimental/utils.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/metrics/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/metrics/_contributions.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/random.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/typing.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/gcnn/utils.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/geometry/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/geometry/distances.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/geometry/np_neighbours.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/geometry/unit_cells.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/_forces.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/calculators/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/calculators/ase.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/experimental.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/io/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/io/n2p2.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/keys.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/potentials.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/mlip/typing.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/nn.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/nn_utils.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/keys.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/listeners/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/utils/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/utils/pylogger.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/utils/rich_utils.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/reaxkit/utils/utils.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/signals/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/signals/bases.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/signals/expansion.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/signals/functions.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/training/__init__.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/training/_module.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/typing.py +0 -0
- {tensorial-0.7.0.dev1 → tensorial-0.7.0.dev2}/src/tensorial/utils.py +0 -0
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensorial
|
|
3
|
-
Version: 0.7.0.
|
|
3
|
+
Version: 0.7.0.dev2
|
|
4
4
|
Summary: Library for machine learning on physical tensors
|
|
5
5
|
Keywords: machine learning,e3nn-jax,physics
|
|
6
6
|
Author-email: Martin Uhrin <martin@digitalbaker.net>
|
|
7
|
-
Requires-Python: >=3.
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
8
|
Description-Content-Type: text/x-rst
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
11
11
|
Classifier: Programming Language :: Python
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
16
|
License-File: LICENSE.txt
|
|
18
|
-
Requires-Dist: beartype
|
|
17
|
+
Requires-Dist: beartype>=0.23.1
|
|
19
18
|
Requires-Dist: ase
|
|
20
19
|
Requires-Dist: flax>=0.10.7
|
|
21
20
|
Requires-Dist: hydra-core
|
|
22
21
|
Requires-Dist: hydra-colorlog
|
|
23
|
-
Requires-Dist: jax<0.
|
|
24
|
-
Requires-Dist: jaxlib<0.
|
|
22
|
+
Requires-Dist: jax<0.13
|
|
23
|
+
Requires-Dist: jaxlib<0.13
|
|
25
24
|
Requires-Dist: jaxtyping
|
|
26
25
|
Requires-Dist: jraph
|
|
27
26
|
Requires-Dist: pytray
|
|
28
27
|
Requires-Dist: e3nn-jax>=0.21.0
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: reax>=0.7.0.dev3,<0.8
|
|
28
|
+
Requires-Dist: reax>=0.7.0.dev6,<0.8
|
|
31
29
|
Requires-Dist: requests
|
|
32
30
|
Requires-Dist: rich
|
|
33
31
|
Requires-Dist: typing-extensions
|
|
@@ -15,28 +15,26 @@ classifiers = [
|
|
|
15
15
|
'Development Status :: 4 - Beta',
|
|
16
16
|
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
|
|
17
17
|
'Programming Language :: Python',
|
|
18
|
-
'Programming Language :: Python :: 3.10',
|
|
19
18
|
'Programming Language :: Python :: 3.11',
|
|
20
19
|
'Programming Language :: Python :: 3.12',
|
|
21
20
|
'Programming Language :: Python :: 3.13',
|
|
22
21
|
'Programming Language :: Python :: 3.14',
|
|
23
22
|
]
|
|
24
23
|
keywords = ['machine learning', 'e3nn-jax', 'physics']
|
|
25
|
-
requires-python = '>=3.
|
|
24
|
+
requires-python = '>=3.11'
|
|
26
25
|
dependencies = [
|
|
27
|
-
'beartype',
|
|
26
|
+
'beartype>=0.23.1',
|
|
28
27
|
'ase',
|
|
29
28
|
"flax>=0.10.7",
|
|
30
29
|
"hydra-core",
|
|
31
30
|
"hydra-colorlog",
|
|
32
|
-
'jax<0.
|
|
33
|
-
'jaxlib<0.
|
|
31
|
+
'jax<0.13', # Control the JAX version, as previous updates have broken things
|
|
32
|
+
'jaxlib<0.13',
|
|
34
33
|
'jaxtyping',
|
|
35
34
|
'jraph',
|
|
36
35
|
'pytray',
|
|
37
36
|
'e3nn-jax>=0.21.0',
|
|
38
|
-
"
|
|
39
|
-
"reax>=0.7.0.dev3,<0.8",
|
|
37
|
+
"reax>=0.7.0.dev6,<0.8",
|
|
40
38
|
"requests",
|
|
41
39
|
"rich",
|
|
42
40
|
"typing-extensions"
|
|
@@ -106,7 +104,7 @@ fail-on-change = true
|
|
|
106
104
|
|
|
107
105
|
[tool.ruff]
|
|
108
106
|
line-length = 100
|
|
109
|
-
target-version = "
|
|
107
|
+
target-version = "py311"
|
|
110
108
|
extend-exclude = [
|
|
111
109
|
'.git',
|
|
112
110
|
'__pycache__',
|
|
@@ -279,6 +277,9 @@ testpaths = [
|
|
|
279
277
|
]
|
|
280
278
|
filterwarnings = [
|
|
281
279
|
'ignore::DeprecationWarning:frozendict:',
|
|
280
|
+
# Hydra >= 1.4: all instantiation must go through tensorial.config, which passes a whitelist
|
|
281
|
+
'error:hydra\.utils\.instantiate\(\) resolved _target_=:UserWarning',
|
|
282
|
+
'error:Hydra configured Python logging without an execution whitelist:UserWarning',
|
|
282
283
|
]
|
|
283
284
|
#addopts = "--jaxtyping-packages=tensorial,beartype.beartype"
|
|
284
285
|
|
|
@@ -299,7 +300,7 @@ envlist = py313
|
|
|
299
300
|
[testenv]
|
|
300
301
|
usedevelop = true
|
|
301
302
|
|
|
302
|
-
[testenv:py{
|
|
303
|
+
[testenv:py{311,312,313,314}]
|
|
303
304
|
description = Run the unit tests
|
|
304
305
|
extras =
|
|
305
306
|
dev
|
|
@@ -22,12 +22,12 @@ from typing import Any, Generic, TypeVar
|
|
|
22
22
|
|
|
23
23
|
import beartype
|
|
24
24
|
import e3nn_jax as e3j
|
|
25
|
-
import equinox
|
|
26
25
|
from flax import linen
|
|
27
26
|
import jax
|
|
28
27
|
import jax.numpy as jnp
|
|
29
28
|
import jaxtyping as jt
|
|
30
29
|
import numpy as np
|
|
30
|
+
import reax.pytree
|
|
31
31
|
from reax.utils import arrays
|
|
32
32
|
from typing_extensions import TypeIs
|
|
33
33
|
|
|
@@ -98,7 +98,7 @@ def as_array(arr: jt.ArrayLike | e3j.IrrepsArray) -> jax.Array:
|
|
|
98
98
|
return jnp.asarray(arr)
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
class Attr(
|
|
101
|
+
class Attr(reax.pytree.PyTree, Generic[T]):
|
|
102
102
|
"""An attribute that carries a single irrep, plus the transforms that
|
|
103
103
|
move values to and from tensor representation.
|
|
104
104
|
|
|
@@ -113,7 +113,7 @@ class Attr(equinox.Module, Generic[T]):
|
|
|
113
113
|
from this attribute.
|
|
114
114
|
"""
|
|
115
115
|
|
|
116
|
-
irreps: e3j.Irreps
|
|
116
|
+
irreps: e3j.Irreps = reax.pytree.field(static=True)
|
|
117
117
|
|
|
118
118
|
def __init__(self, irreps: IntoIrreps) -> None: # pylint: disable=redefined-outer-name
|
|
119
119
|
self.irreps = e3j.Irreps(irreps)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""Hydra/OmegaConf configuration helpers.
|
|
2
|
+
|
|
3
|
+
A thin wrapper over :mod:`hydra.utils` for building objects from
|
|
4
|
+
:mod:`omegaconf` configuration trees, so that tensorial (and reaxkit) config
|
|
5
|
+
files can be materialised with a single, consistent call.
|
|
6
|
+
|
|
7
|
+
This module is also the single place that decides which ``_target_`` values
|
|
8
|
+
Hydra is allowed to execute. From Hydra 1.4, :func:`hydra.utils.instantiate`
|
|
9
|
+
expects an *execution whitelist* supplied by trusted Python code (see
|
|
10
|
+
https://hydra.cc/docs/advanced/execution_whitelist/). Tensorial trusts its own
|
|
11
|
+
packages (and the libraries its shipped configs use) by default; user code can
|
|
12
|
+
extend the list with :func:`allow`, or by setting the
|
|
13
|
+
``TENSORIAL_HYDRA_WHITELIST`` environment variable to a comma-separated list of
|
|
14
|
+
patterns (e.g. ``"my_package.*,other.Thing"``). Setting it to ``UNSAFE``
|
|
15
|
+
disables Hydra's execution checks altogether.
|
|
16
|
+
|
|
17
|
+
Older Hydra versions (< 1.4) have no whitelist support, in which case the
|
|
18
|
+
whitelist is simply not passed on.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
from typing import Any, Final
|
|
23
|
+
|
|
24
|
+
import hydra
|
|
25
|
+
import omegaconf
|
|
26
|
+
|
|
27
|
+
__all__ = (
|
|
28
|
+
"DEFAULT_WHITELIST",
|
|
29
|
+
"HAS_EXECUTION_WHITELIST",
|
|
30
|
+
"UNSAFE_DISABLE_EXECUTION_CHECKS",
|
|
31
|
+
"WHITELIST_ENV_VAR",
|
|
32
|
+
"allow",
|
|
33
|
+
"get_whitelist",
|
|
34
|
+
"hydra_main_kwargs",
|
|
35
|
+
"instantiate",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
WHITELIST_ENV_VAR: Final[str] = "TENSORIAL_HYDRA_WHITELIST"
|
|
39
|
+
_UNSAFE_ENV_VALUE: Final[str] = "UNSAFE"
|
|
40
|
+
|
|
41
|
+
#: Target patterns that are always trusted. A trailing ``.*`` matches everything under a package.
|
|
42
|
+
DEFAULT_WHITELIST: Final[tuple[str, ...]] = ("tensorial.*", "reax.*", "optax.*")
|
|
43
|
+
|
|
44
|
+
# Looked up dynamically so that static checkers don't flag it when Hydra < 1.4 is installed
|
|
45
|
+
#: Hydra's sentinel that disables execution checks, or ``None`` if Hydra < 1.4
|
|
46
|
+
UNSAFE_DISABLE_EXECUTION_CHECKS: Final[Any] = getattr(
|
|
47
|
+
hydra.utils, "UNSAFE_DISABLE_EXECUTION_CHECKS", None
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
#: Whether the installed Hydra supports execution whitelists (Hydra >= 1.4)
|
|
51
|
+
HAS_EXECUTION_WHITELIST: Final[bool] = UNSAFE_DISABLE_EXECUTION_CHECKS is not None
|
|
52
|
+
|
|
53
|
+
_extra_whitelist: list[str] = []
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def allow(*patterns: str) -> None:
|
|
57
|
+
"""Add target patterns to the execution whitelist used by :func:`instantiate`.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
*patterns: fully qualified target names (e.g. ``"my_package.MyModel"``) or package
|
|
61
|
+
prefixes with a trailing ``.*`` (e.g. ``"my_package.*"``).
|
|
62
|
+
"""
|
|
63
|
+
for pattern in patterns:
|
|
64
|
+
if not isinstance(pattern, str):
|
|
65
|
+
raise TypeError(f"Whitelist patterns must be strings, got {type(pattern).__name__}")
|
|
66
|
+
if pattern not in _extra_whitelist:
|
|
67
|
+
_extra_whitelist.append(pattern)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def get_whitelist() -> Any:
|
|
71
|
+
"""Get the execution whitelist to pass to Hydra.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
a tuple of target patterns made up of :data:`DEFAULT_WHITELIST`, any patterns registered
|
|
75
|
+
via :func:`allow` and any from the ``TENSORIAL_HYDRA_WHITELIST`` environment variable, or
|
|
76
|
+
:data:`UNSAFE_DISABLE_EXECUTION_CHECKS` if that variable is set to ``UNSAFE``.
|
|
77
|
+
"""
|
|
78
|
+
env_patterns = [
|
|
79
|
+
entry.strip() for entry in os.environ.get(WHITELIST_ENV_VAR, "").split(",") if entry.strip()
|
|
80
|
+
]
|
|
81
|
+
if _UNSAFE_ENV_VALUE in env_patterns:
|
|
82
|
+
return UNSAFE_DISABLE_EXECUTION_CHECKS
|
|
83
|
+
|
|
84
|
+
whitelist = list(DEFAULT_WHITELIST)
|
|
85
|
+
for pattern in [*_extra_whitelist, *env_patterns]:
|
|
86
|
+
if pattern not in whitelist:
|
|
87
|
+
whitelist.append(pattern)
|
|
88
|
+
return tuple(whitelist)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def hydra_main_kwargs() -> dict[str, Any]:
|
|
92
|
+
"""Get the keyword arguments to pass to :func:`hydra.main` so that it uses the whitelist.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
``{"execution_whitelist": ...}`` on Hydra >= 1.4, and an empty dictionary otherwise.
|
|
96
|
+
"""
|
|
97
|
+
if not HAS_EXECUTION_WHITELIST:
|
|
98
|
+
return {}
|
|
99
|
+
return {"execution_whitelist": get_whitelist()}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def instantiate(
|
|
103
|
+
cfg: omegaconf.DictConfig | omegaconf.ListConfig | dict | list,
|
|
104
|
+
*args,
|
|
105
|
+
_convert_: str = "object",
|
|
106
|
+
**kwargs,
|
|
107
|
+
) -> Any:
|
|
108
|
+
"""Instantiate an object described by an OmegaConf configuration.
|
|
109
|
+
|
|
110
|
+
Thin wrapper around :func:`hydra.utils.instantiate` that, by default, materialises nested
|
|
111
|
+
configuration into plain objects (``_convert_="object"``) before calling into the target
|
|
112
|
+
class, and only allows targets in the tensorial execution whitelist (see
|
|
113
|
+
:func:`get_whitelist`).
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
cfg: the OmegaConf node (usually a ``DictConfig``) describing the
|
|
117
|
+
object to build. Typically this must carry an
|
|
118
|
+
``_target_`` key naming the class to instantiate.
|
|
119
|
+
*args: positional arguments to forward to the target.
|
|
120
|
+
_convert_: the Hydra conversion strategy (``"none"``, ``"partial"``, ``"object"`` or
|
|
121
|
+
``"all"``).
|
|
122
|
+
**kwargs: any extra arguments to forward to the target's
|
|
123
|
+
constructor; these override any values already present in ``cfg``.
|
|
124
|
+
An explicit ``_execution_whitelist_`` overrides the tensorial whitelist.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
the instantiated object, as produced by ``hydra.utils.instantiate``.
|
|
128
|
+
"""
|
|
129
|
+
if HAS_EXECUTION_WHITELIST:
|
|
130
|
+
kwargs.setdefault("_execution_whitelist_", get_whitelist())
|
|
131
|
+
return hydra.utils.instantiate(cfg, *args, _convert_=_convert_, **kwargs)
|
|
@@ -4,7 +4,8 @@ This package simply re-exports the public API so users can import as
|
|
|
4
4
|
``tensorial.datasets.<name>``.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
from . import qm9
|
|
7
|
+
from . import qm9, rmd17
|
|
8
8
|
from .qm9 import *
|
|
9
|
+
from .rmd17 import *
|
|
9
10
|
|
|
10
|
-
__all__ = qm9.__all__
|
|
11
|
+
__all__ = qm9.__all__ + rmd17.__all__
|
|
@@ -66,7 +66,9 @@ class Qm9(collections.abc.Sequence):
|
|
|
66
66
|
(100, <class 'jraph.GraphsTuple'>)
|
|
67
67
|
"""
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
# The ndownloader host serves the file directly; figshare.com and
|
|
70
|
+
# springernature.figshare.com put downloads behind a browser challenge.
|
|
71
|
+
URL: Final[str] = "https://ndownloader.figshare.com/files/3195389"
|
|
70
72
|
FILENAME: Final[str] = "dsgdb9nsd.xyz.tar.bz2"
|
|
71
73
|
QM9_STRUCTURES: Final[str] = "qm9_structures"
|
|
72
74
|
|
|
@@ -93,7 +95,7 @@ class Qm9(collections.abc.Sequence):
|
|
|
93
95
|
self._rng = np.random.default_rng(seed=rng_seed)
|
|
94
96
|
|
|
95
97
|
if download:
|
|
96
|
-
self._do_download(
|
|
98
|
+
self._do_download(self.URL, self.FILENAME)
|
|
97
99
|
|
|
98
100
|
archive_path = pathlib.Path(self._data_dir) / self.FILENAME
|
|
99
101
|
self._data = self._extract_tarball(archive_path, limit, shuffle)
|
|
@@ -276,7 +278,7 @@ def to_graph(
|
|
|
276
278
|
for key in node_attrs:
|
|
277
279
|
if isinstance(key, str):
|
|
278
280
|
label = key
|
|
279
|
-
elif isinstance(key,
|
|
281
|
+
elif isinstance(key, collections.abc.Sequence):
|
|
280
282
|
key, label = key
|
|
281
283
|
else:
|
|
282
284
|
raise ValueError(f"Not attributes key must be str or tuple, got {type(key)}")
|
|
@@ -292,7 +294,7 @@ def to_graph(
|
|
|
292
294
|
for key in graph_attrs:
|
|
293
295
|
if isinstance(key, str):
|
|
294
296
|
label = key
|
|
295
|
-
elif isinstance(key,
|
|
297
|
+
elif isinstance(key, collections.abc.Sequence):
|
|
296
298
|
key, label = key
|
|
297
299
|
else:
|
|
298
300
|
raise ValueError(f"Not attributes key must be str or tuple, got {type(key)}")
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"""The revised MD17 (rMD17) benchmark dataset."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
import pathlib
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Final
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
from .. import data, utils
|
|
11
|
+
from ..gcnn.data import _ase, _datamodule
|
|
12
|
+
from ..gcnn.data import _urls as urls
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
import ase
|
|
16
|
+
|
|
17
|
+
__all__ = ("Rmd17", "rmd17_graph_module")
|
|
18
|
+
|
|
19
|
+
_LOGGER = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
# 1 kcal/mol in eV (CODATA 2014, the value ``ase.units`` uses)
|
|
22
|
+
KCAL_PER_MOL_TO_EV: Final[float] = 0.0433641043
|
|
23
|
+
|
|
24
|
+
# figshare file ids for the individual files of https://doi.org/10.6084/m9.figshare.12672038
|
|
25
|
+
_FIGSHARE_URL: Final[str] = "https://ndownloader.figshare.com/files/{}"
|
|
26
|
+
_MOLECULE_FILES: Final[dict[str, int]] = {
|
|
27
|
+
"aspirin": 62265757,
|
|
28
|
+
"azobenzene": 62265754,
|
|
29
|
+
"benzene": 62265739,
|
|
30
|
+
"ethanol": 62265733,
|
|
31
|
+
"malonaldehyde": 62265736,
|
|
32
|
+
"naphthalene": 62265751,
|
|
33
|
+
"paracetamol": 62265760,
|
|
34
|
+
"salicylic": 62265748,
|
|
35
|
+
"toluene": 62265742,
|
|
36
|
+
"uracil": 62265745,
|
|
37
|
+
}
|
|
38
|
+
_SPLIT_FILES: Final[dict[str, int]] = {
|
|
39
|
+
"index_train_01.csv": 62265793,
|
|
40
|
+
"index_train_02.csv": 62265772,
|
|
41
|
+
"index_train_03.csv": 62265775,
|
|
42
|
+
"index_train_04.csv": 62265766,
|
|
43
|
+
"index_train_05.csv": 62265778,
|
|
44
|
+
"index_test_01.csv": 62265781,
|
|
45
|
+
"index_test_02.csv": 62265769,
|
|
46
|
+
"index_test_03.csv": 62265787,
|
|
47
|
+
"index_test_04.csv": 62265790,
|
|
48
|
+
"index_test_05.csv": 62265784,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Rmd17(data.DataFetcher[_datamodule.PreSplitDataset]):
|
|
53
|
+
"""The revised MD17 dataset (Christensen & von Lilienfeld, 2020).
|
|
54
|
+
|
|
55
|
+
Ten small organic molecules, each with 100,000 conformations from molecular
|
|
56
|
+
dynamics, recomputed at the PBE/def2-SVP level. The dataset comes with five
|
|
57
|
+
standard splits of 1000 training and 1000 test conformations; the dataset
|
|
58
|
+
authors advise against training on more than 1000 conformations, as the frames
|
|
59
|
+
are correlated.
|
|
60
|
+
|
|
61
|
+
Files are downloaded from figshare to ``data_dir`` on first use. Energies and
|
|
62
|
+
forces are converted from kcal/mol to eV.
|
|
63
|
+
|
|
64
|
+
:meth:`fetch` returns the ``train`` and ``test`` sets of the chosen split (there
|
|
65
|
+
is no standard validation set; use ``val_from_train`` on the data module to hold
|
|
66
|
+
some of the training set out).
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
molecule: one of :attr:`MOLECULES`
|
|
70
|
+
split: which of the five standard splits to use (1 to 5)
|
|
71
|
+
as_graphs: keyword arguments for
|
|
72
|
+
:func:`~tensorial.gcnn.atomic.graph_from_ase`, e.g. ``{"r_max": 5.0}``
|
|
73
|
+
data_dir: directory in which to store the downloaded files
|
|
74
|
+
download: download missing files. Set to ``False`` to use only files
|
|
75
|
+
already in ``data_dir``.
|
|
76
|
+
limit: if set, use only the first ``limit`` conformations of the train and
|
|
77
|
+
test sets (e.g. for quick tests)
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
>>> train_test = Rmd17("aspirin", as_graphs={"r_max": 5.0}).fetch()
|
|
81
|
+
>>> len(train_test["train"]), len(train_test["test"])
|
|
82
|
+
(1000, 1000)
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
MOLECULES: Final[tuple[str, ...]] = tuple(_MOLECULE_FILES)
|
|
86
|
+
N_SPLITS: Final[int] = 5
|
|
87
|
+
|
|
88
|
+
def __init__(
|
|
89
|
+
self,
|
|
90
|
+
molecule: str,
|
|
91
|
+
split: int = 1,
|
|
92
|
+
as_graphs: dict[str, Any] | None = None,
|
|
93
|
+
data_dir: str | os.PathLike = "data/",
|
|
94
|
+
download: bool = True,
|
|
95
|
+
limit: int | None = None,
|
|
96
|
+
):
|
|
97
|
+
if molecule not in _MOLECULE_FILES:
|
|
98
|
+
raise ValueError(
|
|
99
|
+
f"Unknown rMD17 molecule '{molecule}', expected one of {self.MOLECULES}"
|
|
100
|
+
)
|
|
101
|
+
if not 1 <= split <= self.N_SPLITS:
|
|
102
|
+
raise ValueError(f"split must be between 1 and {self.N_SPLITS}, got {split}")
|
|
103
|
+
|
|
104
|
+
# Params
|
|
105
|
+
self._molecule: Final[str] = molecule
|
|
106
|
+
self._split: Final[int] = split
|
|
107
|
+
self._as_graphs: Final[dict[str, Any] | None] = as_graphs
|
|
108
|
+
self._data_dir: Final[pathlib.Path] = pathlib.Path(data_dir) / "rmd17"
|
|
109
|
+
self._download: Final[bool] = download
|
|
110
|
+
self._limit: Final[int | None] = limit
|
|
111
|
+
|
|
112
|
+
def fetch(self) -> _datamodule.PreSplitDataset:
|
|
113
|
+
"""Return the ``train`` and ``test`` sets of the chosen split."""
|
|
114
|
+
npz = np.load(
|
|
115
|
+
self._get_file(f"rmd17_{self._molecule}.npz", _MOLECULE_FILES[self._molecule])
|
|
116
|
+
)
|
|
117
|
+
train_idx = self._read_indices("train")
|
|
118
|
+
test_idx = self._read_indices("test")
|
|
119
|
+
|
|
120
|
+
return _datamodule.PreSplitDataset(
|
|
121
|
+
train=self._make_sequence(npz, train_idx),
|
|
122
|
+
test=self._make_sequence(npz, test_idx),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
def _read_indices(self, which: str) -> np.ndarray:
|
|
126
|
+
filename = f"index_{which}_{self._split:02d}.csv"
|
|
127
|
+
indices = np.loadtxt(self._get_file(filename, _SPLIT_FILES[filename]), dtype=int)
|
|
128
|
+
return indices[: self._limit]
|
|
129
|
+
|
|
130
|
+
def _get_file(self, filename: str, file_id: int) -> pathlib.Path:
|
|
131
|
+
path = self._data_dir / filename
|
|
132
|
+
if not path.exists():
|
|
133
|
+
if not self._download:
|
|
134
|
+
raise FileNotFoundError(f"rMD17 file not found and download=False: {path}")
|
|
135
|
+
self._data_dir.mkdir(parents=True, exist_ok=True)
|
|
136
|
+
url = _FIGSHARE_URL.format(file_id)
|
|
137
|
+
_LOGGER.info("downloading %s from %s", filename, url)
|
|
138
|
+
urls._download(url, path) # pylint: disable=protected-access
|
|
139
|
+
return path
|
|
140
|
+
|
|
141
|
+
def _make_sequence(self, npz, indices: np.ndarray):
|
|
142
|
+
structures = to_ase(npz, indices)
|
|
143
|
+
if self._as_graphs is None:
|
|
144
|
+
return structures
|
|
145
|
+
return _ase.AseGraphs(structures, as_graphs=self._as_graphs)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def to_ase(npz, indices: np.ndarray | None = None) -> "list[ase.Atoms]":
|
|
149
|
+
"""Convert (a subset of) an rMD17 ``.npz`` file to :class:`ase.Atoms` in eV units.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
npz: the loaded ``.npz`` file, or any mapping with the rMD17 keys
|
|
153
|
+
indices: the conformations to convert, or ``None`` for all of them
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
a list of molecules, each with a single-point calculator holding its energy
|
|
157
|
+
and forces
|
|
158
|
+
"""
|
|
159
|
+
ase = utils.optional_import("ase")
|
|
160
|
+
singlepoint = utils.optional_import("ase.calculators.singlepoint")
|
|
161
|
+
|
|
162
|
+
numbers = npz["nuclear_charges"]
|
|
163
|
+
coords = npz["coords"]
|
|
164
|
+
energies = npz["energies"]
|
|
165
|
+
forces = npz["forces"]
|
|
166
|
+
if indices is None:
|
|
167
|
+
indices = np.arange(len(energies))
|
|
168
|
+
|
|
169
|
+
structures = []
|
|
170
|
+
for idx in indices:
|
|
171
|
+
atoms = ase.Atoms(numbers=numbers, positions=coords[idx], pbc=False)
|
|
172
|
+
atoms.calc = singlepoint.SinglePointCalculator(
|
|
173
|
+
atoms,
|
|
174
|
+
energy=float(energies[idx]) * KCAL_PER_MOL_TO_EV,
|
|
175
|
+
forces=forces[idx] * KCAL_PER_MOL_TO_EV,
|
|
176
|
+
)
|
|
177
|
+
structures.append(atoms)
|
|
178
|
+
|
|
179
|
+
return structures
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def rmd17_graph_module(
|
|
183
|
+
molecule: str,
|
|
184
|
+
as_graphs: dict[str, Any],
|
|
185
|
+
*,
|
|
186
|
+
split: int = 1,
|
|
187
|
+
val_from_train: int | float | None = 50,
|
|
188
|
+
data_dir: str | os.PathLike = "data/",
|
|
189
|
+
limit: int | None = None,
|
|
190
|
+
batch_size: int = 32,
|
|
191
|
+
batch_mode: str = "implicit",
|
|
192
|
+
pad_to_multiple=None,
|
|
193
|
+
) -> "_datamodule.GraphDataModule":
|
|
194
|
+
"""Build a :class:`~tensorial.gcnn.data.GraphDataModule` for an rMD17 molecule.
|
|
195
|
+
|
|
196
|
+
By default, uses the standard 950/50 train/validation split of the 1000
|
|
197
|
+
training conformations, and the 1000 conformations of the matching test split.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
molecule: one of :attr:`Rmd17.MOLECULES`
|
|
201
|
+
as_graphs: keyword arguments for
|
|
202
|
+
:func:`~tensorial.gcnn.atomic.graph_from_ase`, e.g. ``{"r_max": 5.0}``
|
|
203
|
+
split: which of the five standard splits to use (1 to 5)
|
|
204
|
+
val_from_train: how many training conformations to hold out for validation
|
|
205
|
+
data_dir: directory in which to store the downloaded files
|
|
206
|
+
limit: if set, use only the first ``limit`` train and test conformations
|
|
207
|
+
"""
|
|
208
|
+
return _datamodule.GraphDataModule.from_datasets(
|
|
209
|
+
Rmd17(molecule, split=split, as_graphs=as_graphs, data_dir=data_dir, limit=limit),
|
|
210
|
+
val_from_train=val_from_train,
|
|
211
|
+
batch_size=batch_size,
|
|
212
|
+
batch_mode=batch_mode,
|
|
213
|
+
pad_to_multiple=pad_to_multiple,
|
|
214
|
+
)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
mlip: E(3)-equivariant interatomic potential example
|
|
2
|
+
=====================================================
|
|
3
|
+
|
|
4
|
+
An E(3)-equivariant machine-learning interatomic potential, using a MACE
|
|
5
|
+
(default) or NequIP model, trained on energies (and, where the dataset has
|
|
6
|
+
them, forces and stresses).
|
|
7
|
+
|
|
8
|
+
Data
|
|
9
|
+
----
|
|
10
|
+
The dataset is chosen by the ``data`` config group, and this example comes in
|
|
11
|
+
one variant per dataset in ``data/``. Run ``tensorial examples mlip`` to list
|
|
12
|
+
them, or ``tensorial examples mlip.<variant>`` for the full description of one:
|
|
13
|
+
|
|
14
|
+
- ``si`` (the default): a short trajectory of bulk silicon, bundled as
|
|
15
|
+
``data/sitraj.xyz`` so it runs offline. Energies, forces and stresses.
|
|
16
|
+
- ``qm9``: QM9 small organic molecules (a 10,000-molecule subset by default),
|
|
17
|
+
trained on the energy U0.
|
|
18
|
+
- ``mad``: the Massive Atomic Diversity dataset (crystals, surfaces, molecules).
|
|
19
|
+
- ``rmd17``: revised MD17 small molecules; pick one with ``data.molecule=``
|
|
20
|
+
and one of the five standard splits with ``data.split=``.
|
|
21
|
+
- ``3bpa``: 3BPA, trained at 300 K; override ``data.test=`` to test at 600 K
|
|
22
|
+
or 1200 K.
|
|
23
|
+
|
|
24
|
+
All but ``si`` are downloaded on first use; ``mad``, ``rmd17`` and ``3bpa``
|
|
25
|
+
use the published train/test splits.
|
|
26
|
+
|
|
27
|
+
``tensorial examples init mlip.<variant>`` sets that variant as the default in
|
|
28
|
+
``train.yaml`` and ``eval.yaml``. To switch dataset afterwards, pass ``data=<variant>``
|
|
29
|
+
on the command line (its ``data/<variant>.yaml`` must be present). To train on
|
|
30
|
+
your own trajectory instead, point the ``si`` configuration at it::
|
|
31
|
+
|
|
32
|
+
data=si data.path=/path/to/trajectory.extxyz
|
|
33
|
+
|
|
34
|
+
Run
|
|
35
|
+
---
|
|
36
|
+
To train::
|
|
37
|
+
|
|
38
|
+
tensorial train -i train.yaml
|
|
39
|
+
|
|
40
|
+
To evaluate a trained model on the test set, point ``predict`` at the training run's
|
|
41
|
+
directory, its checkpoint and its saved config::
|
|
42
|
+
|
|
43
|
+
tensorial predict -i logs/train/<run> ckpt_path=logs/train/<run>/checkpoints/last.ckpt \
|
|
44
|
+
+config_path=logs/train/<run>/config.yaml test=true
|
|
45
|
+
|
|
46
|
+
For a quick check that everything runs (one epoch on a few structures, then testing)::
|
|
47
|
+
|
|
48
|
+
tensorial train -i train.yaml debug=smoke
|
|
49
|
+
|
|
50
|
+
You can select an alternative model or override any option on the
|
|
51
|
+
command line, e.g. ``tensorial train -i train.yaml model=nequip r_max=4.0``.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# summary: 3BPA drug-like molecule, 500 configs at 300 K (50 for validation); energy, forces
|
|
2
|
+
# 3BPA (Kovács et al., 2021): https://github.com/davkovacs/BOTNet-datasets
|
|
3
|
+
# A flexible drug-like molecule, used to test extrapolation to higher temperatures.
|
|
4
|
+
# Train on 500 configurations sampled at 300 K (50 held out for validation) and test
|
|
5
|
+
# at 300 K. To test at higher temperatures, override the test set, e.g.:
|
|
6
|
+
# data.test=https://raw.githubusercontent.com/davkovacs/BOTNet-datasets/main/dataset_3BPA/test_1200K.xyz
|
|
7
|
+
# To train on configurations from all three temperatures, use train_mixedT.xyz instead.
|
|
8
|
+
_target_: tensorial.gcnn.data.ase_graph_module_from_datasets
|
|
9
|
+
|
|
10
|
+
train: https://raw.githubusercontent.com/davkovacs/BOTNet-datasets/main/dataset_3BPA/train_300K.xyz
|
|
11
|
+
test: https://raw.githubusercontent.com/davkovacs/BOTNet-datasets/main/dataset_3BPA/test_300K.xyz
|
|
12
|
+
val_from_train: 50
|
|
13
|
+
# Set `data_limit` (e.g. in debug=smoke) to read only the first few structures of each file
|
|
14
|
+
limit: ${oc.select:data_limit,null}
|
|
15
|
+
as_graphs:
|
|
16
|
+
r_max: ${r_max}
|
|
17
|
+
atom_include_keys:
|
|
18
|
+
- numbers
|
|
19
|
+
- forces
|
|
20
|
+
global_include_keys:
|
|
21
|
+
- energy
|
|
22
|
+
|
|
23
|
+
batch_size: 5
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# summary: MAD, ~100k diverse structures across most of the periodic table; energy, forces, stress
|
|
2
|
+
# Massive Atomic Diversity (Mazitov et al., 2025): https://archive.materialscloud.org/records/c4ene-0mv14
|
|
3
|
+
# A compact but highly diverse dataset of bulk, surface and molecular structures, computed
|
|
4
|
+
# consistently with PBEsol. Uses the published train/validation/test splits, downloaded
|
|
5
|
+
# on first use. This is a large dataset: expect long training times on a GPU.
|
|
6
|
+
_target_: tensorial.gcnn.data.ase_graph_module_from_datasets
|
|
7
|
+
|
|
8
|
+
train: https://archive.materialscloud.org/records/c4ene-0mv14/files/mad-train.xyz?download=1
|
|
9
|
+
val: https://archive.materialscloud.org/records/c4ene-0mv14/files/mad-val.xyz?download=1
|
|
10
|
+
test: https://archive.materialscloud.org/records/c4ene-0mv14/files/mad-test.xyz?download=1
|
|
11
|
+
# Set `data_limit` (e.g. in debug=smoke) to read only the first few structures of each file
|
|
12
|
+
limit: ${oc.select:data_limit,null}
|
|
13
|
+
as_graphs:
|
|
14
|
+
r_max: ${r_max}
|
|
15
|
+
atom_include_keys:
|
|
16
|
+
- numbers
|
|
17
|
+
- forces
|
|
18
|
+
global_include_keys:
|
|
19
|
+
- energy
|
|
20
|
+
- stress
|
|
21
|
+
|
|
22
|
+
batch_size: 32
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# summary: QM9 small organic molecules, 10k-molecule subset by default; energy (U0)
|
|
2
|
+
# QM9 (Ramakrishnan et al., 2014): ~134k small organic molecules (up to 9 heavy atoms of
|
|
3
|
+
# C, N, O, F) with DFT (B3LYP/6-31G(2df,p)) properties. Trains on the internal energy at
|
|
4
|
+
# 0 K (U0); there are no forces. Downloaded on first use into ${paths.data_dir}.
|
|
5
|
+
# Only the first 10,000 molecules are used by default, randomly split 85/5/10. Use all of
|
|
6
|
+
# them with:
|
|
7
|
+
# data_limit=null
|
|
8
|
+
_target_: tensorial.gcnn.data.GraphDataModule.from_random_split
|
|
9
|
+
dataset:
|
|
10
|
+
_target_: tensorial.datasets.Qm9
|
|
11
|
+
data_dir: ${paths.data_dir}
|
|
12
|
+
limit: ${oc.select:data_limit,10000}
|
|
13
|
+
as_graphs:
|
|
14
|
+
r_max: ${r_max}
|
|
15
|
+
graph_attrs:
|
|
16
|
+
- [U0, energy]
|
|
17
|
+
|
|
18
|
+
batch_size: 32
|
|
19
|
+
train_val_test_split: [ 0.85, 0.05, 0.1 ]
|