flashmd 0.2.7__tar.gz → 0.2.9__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.
- {flashmd-0.2.7 → flashmd-0.2.9}/PKG-INFO +21 -5
- {flashmd-0.2.7 → flashmd-0.2.9}/README.md +15 -2
- {flashmd-0.2.7 → flashmd-0.2.9}/pyproject.toml +17 -6
- flashmd-0.2.9/src/flashmd/__init__.py +21 -0
- flashmd-0.2.9/src/flashmd/ase/__init__.py +13 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/constraints.py +19 -8
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/stepper.py +12 -4
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd.egg-info/PKG-INFO +21 -5
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd.egg-info/SOURCES.txt +1 -0
- flashmd-0.2.9/src/flashmd.egg-info/requires.txt +11 -0
- flashmd-0.2.9/tests/test_edge_cases.py +55 -0
- flashmd-0.2.7/src/flashmd/__init__.py +0 -7
- flashmd-0.2.7/src/flashmd/ase/__init__.py +0 -26
- flashmd-0.2.7/src/flashmd.egg-info/requires.txt +0 -8
- {flashmd-0.2.7 → flashmd-0.2.9}/LICENSE +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/setup.cfg +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/ase/bussi.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/ase/langevin.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/ase/velocity_verlet.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/ipi.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd/models.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd.egg-info/dependency_links.txt +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/src/flashmd.egg-info/top_level.txt +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/tests/test_energy.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/tests/test_models.py +0 -0
- {flashmd-0.2.7 → flashmd-0.2.9}/tests/test_readme.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flashmd
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Accelerated molecular dynamics with large-time-step predictions
|
|
5
5
|
Author: flashmd developers
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,10 +19,13 @@ Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
20
|
Classifier: Topic :: Software Development :: Libraries
|
|
21
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: metatrain==2026.
|
|
25
|
+
Requires-Dist: metatrain==2026.2
|
|
26
|
+
Requires-Dist: metatomic-ase
|
|
27
|
+
Requires-Dist: vesin>=0.5.4
|
|
28
|
+
Requires-Dist: nvalchemi-toolkit-ops==0.3.0
|
|
26
29
|
Requires-Dist: ase
|
|
27
30
|
Requires-Dist: huggingface_hub
|
|
28
31
|
Provides-Extra: dev
|
|
@@ -128,7 +131,7 @@ Using FlashMD in i-PI
|
|
|
128
131
|
---------------------
|
|
129
132
|
|
|
130
133
|
You can see
|
|
131
|
-
[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html)
|
|
134
|
+
[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html)
|
|
132
135
|
for usage examples. i-PI is our most mature interface, and the one that was used to
|
|
133
136
|
generate all our published results.
|
|
134
137
|
|
|
@@ -141,10 +144,13 @@ new to FlashMD, we recommend starting with the ``pet-omatpes-v2`` models.
|
|
|
141
144
|
Training/fine-tuning your own FlashMD models
|
|
142
145
|
--------------------------------------------
|
|
143
146
|
|
|
144
|
-
FlashMD models can be trained from the metatrain library
|
|
147
|
+
FlashMD models can be trained from the **metatrain library**. This
|
|
145
148
|
[tutorial](https://docs.metatensor.org/metatrain/latest/generated_examples/1-advanced/04-flashmd.html)
|
|
146
149
|
shows how to train your own FlashMD model, either from scratch or by fine-tuning of one of our universal models.
|
|
147
150
|
|
|
151
|
+
The trajectory datasets generated with the PET-MAD baseline MLIPs used in the paper can be found in [this
|
|
152
|
+
repository](https://zenodo.org/records/17904449).
|
|
153
|
+
|
|
148
154
|
Disclaimer
|
|
149
155
|
----------
|
|
150
156
|
|
|
@@ -156,6 +162,11 @@ parts of the simulated system. For the time being, we also recommend checking al
|
|
|
156
162
|
FlashMD-powered findings with traditional MD. The energy models that were used to train
|
|
157
163
|
FlashMD, and that we make available in this repository, can be used for this purpose.
|
|
158
164
|
|
|
165
|
+
#### More energy models
|
|
166
|
+
|
|
167
|
+
Do you want to try out different energy models (MLIPs),
|
|
168
|
+
trained on different levels of theory and/or with different accuracy-speed tradeoffs? Check
|
|
169
|
+
out the **[UPET](https://github.com/lab-cosmo/upet) repository.**
|
|
159
170
|
|
|
160
171
|
Publication
|
|
161
172
|
-----------
|
|
@@ -183,3 +194,8 @@ Note that the results were obtained through the i-PI interface.
|
|
|
183
194
|
|
|
184
195
|
Instructions and material to reproduce the results in the paper are available on
|
|
185
196
|
Materials Cloud at https://doi.org/10.24435/materialscloud:b7-xq.
|
|
197
|
+
|
|
198
|
+
Maintainers
|
|
199
|
+
-----------
|
|
200
|
+
|
|
201
|
+
This project is [maintained](https://github.com/lab-cosmo/.github/blob/main/Maintainers.md) by [@frostedoyster](https://github.com/frostedoyster) and [@johannes-spies](https://github.com/johannes-spies), who will reply to issues and pull requests opened on this repository as soon as possible. You can mention them directly if you haven't received an answer after a couple of days.
|
|
@@ -95,7 +95,7 @@ Using FlashMD in i-PI
|
|
|
95
95
|
---------------------
|
|
96
96
|
|
|
97
97
|
You can see
|
|
98
|
-
[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html)
|
|
98
|
+
[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html)
|
|
99
99
|
for usage examples. i-PI is our most mature interface, and the one that was used to
|
|
100
100
|
generate all our published results.
|
|
101
101
|
|
|
@@ -108,10 +108,13 @@ new to FlashMD, we recommend starting with the ``pet-omatpes-v2`` models.
|
|
|
108
108
|
Training/fine-tuning your own FlashMD models
|
|
109
109
|
--------------------------------------------
|
|
110
110
|
|
|
111
|
-
FlashMD models can be trained from the metatrain library
|
|
111
|
+
FlashMD models can be trained from the **metatrain library**. This
|
|
112
112
|
[tutorial](https://docs.metatensor.org/metatrain/latest/generated_examples/1-advanced/04-flashmd.html)
|
|
113
113
|
shows how to train your own FlashMD model, either from scratch or by fine-tuning of one of our universal models.
|
|
114
114
|
|
|
115
|
+
The trajectory datasets generated with the PET-MAD baseline MLIPs used in the paper can be found in [this
|
|
116
|
+
repository](https://zenodo.org/records/17904449).
|
|
117
|
+
|
|
115
118
|
Disclaimer
|
|
116
119
|
----------
|
|
117
120
|
|
|
@@ -123,6 +126,11 @@ parts of the simulated system. For the time being, we also recommend checking al
|
|
|
123
126
|
FlashMD-powered findings with traditional MD. The energy models that were used to train
|
|
124
127
|
FlashMD, and that we make available in this repository, can be used for this purpose.
|
|
125
128
|
|
|
129
|
+
#### More energy models
|
|
130
|
+
|
|
131
|
+
Do you want to try out different energy models (MLIPs),
|
|
132
|
+
trained on different levels of theory and/or with different accuracy-speed tradeoffs? Check
|
|
133
|
+
out the **[UPET](https://github.com/lab-cosmo/upet) repository.**
|
|
126
134
|
|
|
127
135
|
Publication
|
|
128
136
|
-----------
|
|
@@ -150,3 +158,8 @@ Note that the results were obtained through the i-PI interface.
|
|
|
150
158
|
|
|
151
159
|
Instructions and material to reproduce the results in the paper are available on
|
|
152
160
|
Materials Cloud at https://doi.org/10.24435/materialscloud:b7-xq.
|
|
161
|
+
|
|
162
|
+
Maintainers
|
|
163
|
+
-----------
|
|
164
|
+
|
|
165
|
+
This project is [maintained](https://github.com/lab-cosmo/.github/blob/main/Maintainers.md) by [@frostedoyster](https://github.com/frostedoyster) and [@johannes-spies](https://github.com/johannes-spies), who will reply to issues and pull requests opened on this repository as soon as possible. You can mention them directly if you haven't received an answer after a couple of days.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "flashmd"
|
|
3
|
-
version = "0.2.
|
|
4
|
-
requires-python = ">=3.
|
|
3
|
+
version = "0.2.9"
|
|
4
|
+
requires-python = ">=3.11"
|
|
5
5
|
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
license = {text = "Apache-2.0"}
|
|
@@ -9,7 +9,10 @@ description = "Accelerated molecular dynamics with large-time-step predictions"
|
|
|
9
9
|
authors = [{name = "flashmd developers"}]
|
|
10
10
|
|
|
11
11
|
dependencies = [
|
|
12
|
-
"metatrain==2026.
|
|
12
|
+
"metatrain==2026.2",
|
|
13
|
+
"metatomic-ase",
|
|
14
|
+
"vesin>=0.5.4",
|
|
15
|
+
"nvalchemi-toolkit-ops==0.3.0", # tricks metatomic-ase into avoiding buggy vesin
|
|
13
16
|
"ase",
|
|
14
17
|
"huggingface_hub",
|
|
15
18
|
]
|
|
@@ -74,10 +77,18 @@ ignore_missing_imports = true
|
|
|
74
77
|
disable_error_code = ["union-attr"]
|
|
75
78
|
|
|
76
79
|
[tool.pytest.ini_options]
|
|
77
|
-
markers = [
|
|
78
|
-
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
79
|
-
]
|
|
80
80
|
filterwarnings = [
|
|
81
81
|
"error",
|
|
82
82
|
"ignore:custom data:UserWarning",
|
|
83
|
+
"ignore:`torch.jit.script` is deprecated:DeprecationWarning",
|
|
84
|
+
"ignore:`torch.jit.load` is deprecated:DeprecationWarning",
|
|
85
|
+
"ignore:`compute_requested_neighbors_from_options` is deprecated and will be removed in a future version:UserWarning",
|
|
86
|
+
"ignore:hf_xet\\.download_files\\(\\) is deprecated:DeprecationWarning",
|
|
87
|
+
"ignore:Due to '_pack_', the 'APICLaunchParamRecord' Structure will use memory layout compatible with MSVC:DeprecationWarning",
|
|
88
|
+
"ignore:`torch.jit.script` is not supported:DeprecationWarning",
|
|
89
|
+
"ignore:`torch.jit.script_method` is not supported:DeprecationWarning",
|
|
90
|
+
"ignore:`torch.jit.script_method` is deprecated:DeprecationWarning",
|
|
91
|
+
"ignore:`torch.jit.load` is not supported:DeprecationWarning",
|
|
92
|
+
"ignore:The 'nvalchemiops.neighborlist' module has been renamed to 'nvalchemiops.neighbors':DeprecationWarning",
|
|
93
|
+
"ignore:From version 0.3.0 onwards, PyTorch is now an optional dependency:DeprecationWarning",
|
|
83
94
|
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
3
|
+
import torch
|
|
4
|
+
|
|
5
|
+
from .models import get_pretrained as get_pretrained
|
|
6
|
+
from .models import save_checkpoint as save_checkpoint
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
warnings.filterwarnings("ignore", category=UserWarning, message="custom data")
|
|
10
|
+
warnings.filterwarnings(
|
|
11
|
+
"ignore", category=DeprecationWarning, message="`torch.jit.script`"
|
|
12
|
+
)
|
|
13
|
+
warnings.filterwarnings(
|
|
14
|
+
"ignore", category=DeprecationWarning, message="`torch.jit.load`"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Disable static fusion. Besides the fact that atomistic batches have variable
|
|
19
|
+
# sizes, statically fused CUDA kernels cannot allocate new tensors at runtime,
|
|
20
|
+
# causing "Global alloc not supported yet" errors (cuda 13+) at the time of writing
|
|
21
|
+
torch.jit.set_fusion_strategy([("DYNAMIC", 10)])
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from metatomic_ase import MetatomicCalculator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class EnergyCalculator(MetatomicCalculator):
|
|
5
|
+
"""
|
|
6
|
+
ASE calculator for energy predictions using a metatomic AtomisticModel.
|
|
7
|
+
|
|
8
|
+
Slightly modified to ensure compatibility with ase.io.Trajectory, otherwise
|
|
9
|
+
completely equivalent to `metatomic.torch.ase_calculator.MetatomicCalculator`.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def todict(self):
|
|
13
|
+
return {"name": "flashmd.ase.EnergyCalculator"}
|
|
@@ -27,20 +27,29 @@ def enforce_physical_constraints(
|
|
|
27
27
|
total_masses = [m.sum() for m in masses]
|
|
28
28
|
momenta_before = [s.get_data("momenta").block().values for s in systems]
|
|
29
29
|
momenta_now = torch.split(prediction_tmap.block().values, system_sizes)
|
|
30
|
-
velocities_now = [
|
|
30
|
+
velocities_now = [
|
|
31
|
+
p / m[:, None] for p, m in zip(momenta_now, masses, strict=True)
|
|
32
|
+
]
|
|
31
33
|
velocities_com_before = [
|
|
32
|
-
torch.sum(p, dim=0) / M
|
|
34
|
+
torch.sum(p, dim=0) / M
|
|
35
|
+
for p, M in zip(momenta_before, total_masses, strict=True)
|
|
33
36
|
]
|
|
34
37
|
velocities_com_now = [
|
|
35
|
-
torch.sum(p, dim=0) / M
|
|
38
|
+
torch.sum(p, dim=0) / M
|
|
39
|
+
for p, M in zip(momenta_now, total_masses, strict=True)
|
|
36
40
|
]
|
|
37
41
|
velocities_now = [
|
|
38
42
|
v - v_com_now_i + v_com_before_i
|
|
39
43
|
for v, v_com_before_i, v_com_now_i in zip(
|
|
40
|
-
velocities_now,
|
|
44
|
+
velocities_now,
|
|
45
|
+
velocities_com_before,
|
|
46
|
+
velocities_com_now,
|
|
47
|
+
strict=True,
|
|
41
48
|
)
|
|
42
49
|
]
|
|
43
|
-
momenta_now = [
|
|
50
|
+
momenta_now = [
|
|
51
|
+
v * m[:, None] for v, m in zip(velocities_now, masses, strict=True)
|
|
52
|
+
]
|
|
44
53
|
new_predictions[key] = TensorMap(
|
|
45
54
|
prediction_tmap.keys,
|
|
46
55
|
[
|
|
@@ -61,15 +70,16 @@ def enforce_physical_constraints(
|
|
|
61
70
|
momenta = [s.get_data("momenta").block().values for s in systems]
|
|
62
71
|
positions_now = torch.split(prediction_tmap.block().values, system_sizes)
|
|
63
72
|
velocities_com = [
|
|
64
|
-
torch.sum(p, dim=0) / M
|
|
73
|
+
torch.sum(p, dim=0) / M
|
|
74
|
+
for p, M in zip(momenta, total_masses, strict=True)
|
|
65
75
|
]
|
|
66
76
|
positions_com_before = [
|
|
67
77
|
torch.sum(q * m[:, None], dim=0) / M
|
|
68
|
-
for q, m, M in zip(positions_before, masses, total_masses)
|
|
78
|
+
for q, m, M in zip(positions_before, masses, total_masses, strict=True)
|
|
69
79
|
]
|
|
70
80
|
positions_com_now = [
|
|
71
81
|
torch.sum(q * m[:, None], dim=0) / M
|
|
72
|
-
for q, m, M in zip(positions_now, masses, total_masses)
|
|
82
|
+
for q, m, M in zip(positions_now, masses, total_masses, strict=True)
|
|
73
83
|
]
|
|
74
84
|
positions_now = [
|
|
75
85
|
q - q_com_now_i + q_com_before_i + v_com_i * timestep
|
|
@@ -78,6 +88,7 @@ def enforce_physical_constraints(
|
|
|
78
88
|
positions_com_now,
|
|
79
89
|
positions_com_before,
|
|
80
90
|
velocities_com,
|
|
91
|
+
strict=True,
|
|
81
92
|
)
|
|
82
93
|
]
|
|
83
94
|
new_predictions[key] = TensorMap(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# from ..utils.pretrained import load_pretrained_models
|
|
2
2
|
import ase.units
|
|
3
3
|
import torch
|
|
4
|
+
import vesin.metatomic
|
|
4
5
|
from metatensor.torch import Labels, TensorBlock, TensorMap
|
|
5
6
|
from metatomic.torch import AtomisticModel, ModelEvaluationOptions, ModelOutput, System
|
|
6
|
-
from metatrain.utils.neighbor_lists import get_system_with_neighbor_lists
|
|
7
7
|
|
|
8
8
|
from .constraints import enforce_physical_constraints
|
|
9
9
|
|
|
@@ -28,6 +28,15 @@ class FlashMDStepper:
|
|
|
28
28
|
|
|
29
29
|
self.dtype = getattr(torch, self.model.capabilities().dtype)
|
|
30
30
|
self.device = device
|
|
31
|
+
self.neighbor_list_calculators = vesin.metatomic.neighbor_lists_for_model(
|
|
32
|
+
"angstrom", self.model
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# vesin's CUDA brute_force algorithm is broken for triclinic cells,
|
|
36
|
+
# so we use cell_list for all CUDA calculations to avoid potential issues. See
|
|
37
|
+
# https://github.com/Luthaf/vesin/issues/157
|
|
38
|
+
for neighbor_list in self.neighbor_list_calculators:
|
|
39
|
+
neighbor_list._nl.algorithm = "cell_list"
|
|
31
40
|
|
|
32
41
|
def step(self, system: System):
|
|
33
42
|
if system.device.type != self.device.type:
|
|
@@ -35,9 +44,8 @@ class FlashMDStepper:
|
|
|
35
44
|
if system.positions.dtype != self.dtype:
|
|
36
45
|
raise ValueError("System dtype does not match stepper dtype.")
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
)
|
|
47
|
+
for calculator in self.neighbor_list_calculators:
|
|
48
|
+
calculator.add_neighbor_list(system)
|
|
41
49
|
|
|
42
50
|
masses = system.get_data("masses").block().values
|
|
43
51
|
model_outputs = self.model(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flashmd
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Accelerated molecular dynamics with large-time-step predictions
|
|
5
5
|
Author: flashmd developers
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,10 +19,13 @@ Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
20
|
Classifier: Topic :: Software Development :: Libraries
|
|
21
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: metatrain==2026.
|
|
25
|
+
Requires-Dist: metatrain==2026.2
|
|
26
|
+
Requires-Dist: metatomic-ase
|
|
27
|
+
Requires-Dist: vesin>=0.5.4
|
|
28
|
+
Requires-Dist: nvalchemi-toolkit-ops==0.3.0
|
|
26
29
|
Requires-Dist: ase
|
|
27
30
|
Requires-Dist: huggingface_hub
|
|
28
31
|
Provides-Extra: dev
|
|
@@ -128,7 +131,7 @@ Using FlashMD in i-PI
|
|
|
128
131
|
---------------------
|
|
129
132
|
|
|
130
133
|
You can see
|
|
131
|
-
[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html)
|
|
134
|
+
[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html)
|
|
132
135
|
for usage examples. i-PI is our most mature interface, and the one that was used to
|
|
133
136
|
generate all our published results.
|
|
134
137
|
|
|
@@ -141,10 +144,13 @@ new to FlashMD, we recommend starting with the ``pet-omatpes-v2`` models.
|
|
|
141
144
|
Training/fine-tuning your own FlashMD models
|
|
142
145
|
--------------------------------------------
|
|
143
146
|
|
|
144
|
-
FlashMD models can be trained from the metatrain library
|
|
147
|
+
FlashMD models can be trained from the **metatrain library**. This
|
|
145
148
|
[tutorial](https://docs.metatensor.org/metatrain/latest/generated_examples/1-advanced/04-flashmd.html)
|
|
146
149
|
shows how to train your own FlashMD model, either from scratch or by fine-tuning of one of our universal models.
|
|
147
150
|
|
|
151
|
+
The trajectory datasets generated with the PET-MAD baseline MLIPs used in the paper can be found in [this
|
|
152
|
+
repository](https://zenodo.org/records/17904449).
|
|
153
|
+
|
|
148
154
|
Disclaimer
|
|
149
155
|
----------
|
|
150
156
|
|
|
@@ -156,6 +162,11 @@ parts of the simulated system. For the time being, we also recommend checking al
|
|
|
156
162
|
FlashMD-powered findings with traditional MD. The energy models that were used to train
|
|
157
163
|
FlashMD, and that we make available in this repository, can be used for this purpose.
|
|
158
164
|
|
|
165
|
+
#### More energy models
|
|
166
|
+
|
|
167
|
+
Do you want to try out different energy models (MLIPs),
|
|
168
|
+
trained on different levels of theory and/or with different accuracy-speed tradeoffs? Check
|
|
169
|
+
out the **[UPET](https://github.com/lab-cosmo/upet) repository.**
|
|
159
170
|
|
|
160
171
|
Publication
|
|
161
172
|
-----------
|
|
@@ -183,3 +194,8 @@ Note that the results were obtained through the i-PI interface.
|
|
|
183
194
|
|
|
184
195
|
Instructions and material to reproduce the results in the paper are available on
|
|
185
196
|
Materials Cloud at https://doi.org/10.24435/materialscloud:b7-xq.
|
|
197
|
+
|
|
198
|
+
Maintainers
|
|
199
|
+
-----------
|
|
200
|
+
|
|
201
|
+
This project is [maintained](https://github.com/lab-cosmo/.github/blob/main/Maintainers.md) by [@frostedoyster](https://github.com/frostedoyster) and [@johannes-spies](https://github.com/johannes-spies), who will reply to issues and pull requests opened on this repository as soon as possible. You can mention them directly if you haven't received an answer after a couple of days.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import ase.build
|
|
2
|
+
import ase.units
|
|
3
|
+
import torch
|
|
4
|
+
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
|
|
5
|
+
|
|
6
|
+
from flashmd import get_pretrained
|
|
7
|
+
from flashmd.ase import EnergyCalculator
|
|
8
|
+
from flashmd.ase.velocity_verlet import VelocityVerlet
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_isolated_atom(monkeypatch, tmp_path):
|
|
12
|
+
"""Test that a short MD run completes without errors on an isolated atom."""
|
|
13
|
+
monkeypatch.chdir(tmp_path)
|
|
14
|
+
|
|
15
|
+
atoms = ase.Atoms("O", positions=[[0, 0, 0]])
|
|
16
|
+
MaxwellBoltzmannDistribution(atoms, temperature_K=300)
|
|
17
|
+
|
|
18
|
+
time_step = 8
|
|
19
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
20
|
+
energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
|
|
21
|
+
calculator = EnergyCalculator(energy_model, device=device)
|
|
22
|
+
atoms.calc = calculator
|
|
23
|
+
|
|
24
|
+
dyn = VelocityVerlet(
|
|
25
|
+
atoms=atoms,
|
|
26
|
+
timestep=time_step * ase.units.fs,
|
|
27
|
+
model=flashmd_model,
|
|
28
|
+
device=device,
|
|
29
|
+
)
|
|
30
|
+
dyn.run(10)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_slab_plus_isolated_atom(monkeypatch, tmp_path):
|
|
34
|
+
"""Test that a short MD run completes without errors on a slab plus an isolated atom."""
|
|
35
|
+
monkeypatch.chdir(tmp_path)
|
|
36
|
+
|
|
37
|
+
# Create a slab and an isolated atom
|
|
38
|
+
slab = ase.build.fcc111("Al", size=(2, 2, 3), vacuum=10)
|
|
39
|
+
isolated_atom = ase.Atoms("O", positions=[[0, 0, 24]])
|
|
40
|
+
atoms = slab + isolated_atom
|
|
41
|
+
MaxwellBoltzmannDistribution(atoms, temperature_K=300)
|
|
42
|
+
|
|
43
|
+
time_step = 8
|
|
44
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
45
|
+
energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
|
|
46
|
+
calculator = EnergyCalculator(energy_model, device=device)
|
|
47
|
+
atoms.calc = calculator
|
|
48
|
+
|
|
49
|
+
dyn = VelocityVerlet(
|
|
50
|
+
atoms=atoms,
|
|
51
|
+
timestep=time_step * ase.units.fs,
|
|
52
|
+
model=flashmd_model,
|
|
53
|
+
device=device,
|
|
54
|
+
)
|
|
55
|
+
dyn.run(10)
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import tempfile
|
|
2
|
-
|
|
3
|
-
from metatomic.torch import AtomisticModel
|
|
4
|
-
from metatomic.torch.ase_calculator import MetatomicCalculator
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class EnergyCalculator(MetatomicCalculator):
|
|
8
|
-
"""
|
|
9
|
-
ASE calculator for energy predictions using a metatomic AtomisticModel.
|
|
10
|
-
|
|
11
|
-
Slightly modified to save the model to a temporary file to ensure compatibility
|
|
12
|
-
with ase.io.Trajectory.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def __init__(self, model, *args, **kwargs):
|
|
16
|
-
# save the model to a path otherwise it won't work with ase.io.Trajectory
|
|
17
|
-
# which calls todict on the calculator
|
|
18
|
-
|
|
19
|
-
if isinstance(model, AtomisticModel):
|
|
20
|
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".pt") as f:
|
|
21
|
-
path = f.name
|
|
22
|
-
model.save(path)
|
|
23
|
-
else:
|
|
24
|
-
path = model
|
|
25
|
-
|
|
26
|
-
super().__init__(path, *args, **kwargs)
|
|
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
|