flashmd 0.2.6__tar.gz → 0.2.8__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 (25) hide show
  1. {flashmd-0.2.6 → flashmd-0.2.8}/PKG-INFO +20 -12
  2. {flashmd-0.2.6 → flashmd-0.2.8}/README.md +17 -9
  3. {flashmd-0.2.6 → flashmd-0.2.8}/pyproject.toml +5 -6
  4. flashmd-0.2.8/src/flashmd/__init__.py +21 -0
  5. flashmd-0.2.8/src/flashmd/ase/__init__.py +13 -0
  6. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/constraints.py +19 -8
  7. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/stepper.py +2 -4
  8. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd.egg-info/PKG-INFO +20 -12
  9. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd.egg-info/SOURCES.txt +2 -0
  10. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd.egg-info/requires.txt +1 -1
  11. flashmd-0.2.8/tests/test_edge_cases.py +55 -0
  12. flashmd-0.2.8/tests/test_energy.py +29 -0
  13. flashmd-0.2.6/src/flashmd/__init__.py +0 -7
  14. flashmd-0.2.6/src/flashmd/ase/__init__.py +0 -0
  15. {flashmd-0.2.6 → flashmd-0.2.8}/LICENSE +0 -0
  16. {flashmd-0.2.6 → flashmd-0.2.8}/setup.cfg +0 -0
  17. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/ase/bussi.py +0 -0
  18. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/ase/langevin.py +0 -0
  19. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/ase/velocity_verlet.py +0 -0
  20. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/ipi.py +0 -0
  21. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd/models.py +0 -0
  22. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd.egg-info/dependency_links.txt +0 -0
  23. {flashmd-0.2.6 → flashmd-0.2.8}/src/flashmd.egg-info/top_level.txt +0 -0
  24. {flashmd-0.2.6 → flashmd-0.2.8}/tests/test_models.py +0 -0
  25. {flashmd-0.2.6 → flashmd-0.2.8}/tests/test_readme.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashmd
3
- Version: 0.2.6
3
+ Version: 0.2.8
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,10 @@ 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.9
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
- Requires-Dist: metatrain==2026.1
25
+ Requires-Dist: metatrain==2026.2
26
26
  Requires-Dist: ase
27
27
  Requires-Dist: huggingface_hub
28
28
  Provides-Extra: dev
@@ -55,11 +55,11 @@ After installation, you can run accelerated molecular dynamics as follows:
55
55
  ```py
56
56
  import ase.build
57
57
  import ase.units
58
- from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
59
58
  import torch
60
- from metatomic.torch.ase_calculator import MetatomicCalculator
59
+ from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
61
60
 
62
61
  from flashmd import get_pretrained
62
+ from flashmd.ase import EnergyCalculator
63
63
  from flashmd.ase.langevin import Langevin
64
64
 
65
65
 
@@ -74,11 +74,11 @@ atoms.set_velocities( # it is generally a good idea to remove any net velocity
74
74
  )
75
75
 
76
76
  # Load models
77
- device="cuda" if torch.cuda.is_available() else "cpu"
78
- energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
77
+ device = "cuda" if torch.cuda.is_available() else "cpu"
78
+ energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
79
79
 
80
- # Set the energy model (see below for more precise usage)
81
- calculator = MetatomicCalculator(energy_model, device=device)
80
+ # Set the energy model (optional, see below for more precise usage)
81
+ calculator = EnergyCalculator(energy_model, device=device)
82
82
  atoms.calc = calculator
83
83
 
84
84
  # Run MD
@@ -88,9 +88,9 @@ dyn = Langevin(
88
88
  temperature_K=300,
89
89
  time_constant=100*ase.units.fs,
90
90
  model=flashmd_model,
91
- device=device
91
+ device=device,
92
92
  )
93
- dyn.run(1000)
93
+ dyn.run(1000) # this is 64 ps!
94
94
  ```
95
95
 
96
96
  [The first time you use this code and call the `get_pretrained` function, the
@@ -141,10 +141,13 @@ new to FlashMD, we recommend starting with the ``pet-omatpes-v2`` models.
141
141
  Training/fine-tuning your own FlashMD models
142
142
  --------------------------------------------
143
143
 
144
- FlashMD models can be trained from the metatrain library. This
144
+ FlashMD models can be trained from the **metatrain library**. This
145
145
  [tutorial](https://docs.metatensor.org/metatrain/latest/generated_examples/1-advanced/04-flashmd.html)
146
146
  shows how to train your own FlashMD model, either from scratch or by fine-tuning of one of our universal models.
147
147
 
148
+ The trajectory datasets generated with the PET-MAD baseline MLIPs used in the paper can be found in [this
149
+ repository](https://zenodo.org/records/17904449).
150
+
148
151
  Disclaimer
149
152
  ----------
150
153
 
@@ -156,6 +159,11 @@ parts of the simulated system. For the time being, we also recommend checking al
156
159
  FlashMD-powered findings with traditional MD. The energy models that were used to train
157
160
  FlashMD, and that we make available in this repository, can be used for this purpose.
158
161
 
162
+ #### More energy models
163
+
164
+ Do you want to try out different energy models (MLIPs),
165
+ trained on different levels of theory and/or with different accuracy-speed tradeoffs? Check
166
+ out the **[UPET](https://github.com/lab-cosmo/upet) repository.**
159
167
 
160
168
  Publication
161
169
  -----------
@@ -22,11 +22,11 @@ After installation, you can run accelerated molecular dynamics as follows:
22
22
  ```py
23
23
  import ase.build
24
24
  import ase.units
25
- from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
26
25
  import torch
27
- from metatomic.torch.ase_calculator import MetatomicCalculator
26
+ from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
28
27
 
29
28
  from flashmd import get_pretrained
29
+ from flashmd.ase import EnergyCalculator
30
30
  from flashmd.ase.langevin import Langevin
31
31
 
32
32
 
@@ -41,11 +41,11 @@ atoms.set_velocities( # it is generally a good idea to remove any net velocity
41
41
  )
42
42
 
43
43
  # Load models
44
- device="cuda" if torch.cuda.is_available() else "cpu"
45
- energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
44
+ device = "cuda" if torch.cuda.is_available() else "cpu"
45
+ energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
46
46
 
47
- # Set the energy model (see below for more precise usage)
48
- calculator = MetatomicCalculator(energy_model, device=device)
47
+ # Set the energy model (optional, see below for more precise usage)
48
+ calculator = EnergyCalculator(energy_model, device=device)
49
49
  atoms.calc = calculator
50
50
 
51
51
  # Run MD
@@ -55,9 +55,9 @@ dyn = Langevin(
55
55
  temperature_K=300,
56
56
  time_constant=100*ase.units.fs,
57
57
  model=flashmd_model,
58
- device=device
58
+ device=device,
59
59
  )
60
- dyn.run(1000)
60
+ dyn.run(1000) # this is 64 ps!
61
61
  ```
62
62
 
63
63
  [The first time you use this code and call the `get_pretrained` function, the
@@ -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. This
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
  -----------
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "flashmd"
3
- version = "0.2.6"
4
- requires-python = ">=3.9"
3
+ version = "0.2.8"
4
+ requires-python = ">=3.10"
5
5
 
6
6
  readme = "README.md"
7
7
  license = {text = "Apache-2.0"}
@@ -9,7 +9,7 @@ description = "Accelerated molecular dynamics with large-time-step predictions"
9
9
  authors = [{name = "flashmd developers"}]
10
10
 
11
11
  dependencies = [
12
- "metatrain==2026.1",
12
+ "metatrain==2026.2",
13
13
  "ase",
14
14
  "huggingface_hub",
15
15
  ]
@@ -74,10 +74,9 @@ ignore_missing_imports = true
74
74
  disable_error_code = ["union-attr"]
75
75
 
76
76
  [tool.pytest.ini_options]
77
- markers = [
78
- "slow: marks tests as slow (deselect with '-m \"not slow\"')",
79
- ]
80
77
  filterwarnings = [
81
78
  "error",
82
79
  "ignore:custom data:UserWarning",
80
+ "ignore:`torch.jit.script` is deprecated:DeprecationWarning",
81
+ "ignore:`torch.jit.load` is deprecated:DeprecationWarning",
83
82
  ]
@@ -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.torch.ase_calculator 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 = [p / m[:, None] for p, m in zip(momenta_now, masses)]
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 for p, M in zip(momenta_before, total_masses)
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 for p, M in zip(momenta_now, total_masses)
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, velocities_com_before, velocities_com_now
44
+ velocities_now,
45
+ velocities_com_before,
46
+ velocities_com_now,
47
+ strict=True,
41
48
  )
42
49
  ]
43
- momenta_now = [v * m[:, None] for v, m in zip(velocities_now, masses)]
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 for p, M in zip(momenta, total_masses)
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
 
@@ -35,9 +35,7 @@ class FlashMDStepper:
35
35
  if system.positions.dtype != self.dtype:
36
36
  raise ValueError("System dtype does not match stepper dtype.")
37
37
 
38
- system = get_system_with_neighbor_lists(
39
- system, self.model.requested_neighbor_lists()
40
- )
38
+ vesin.metatomic.compute_requested_neighbors([system], "angstrom", self.model)
41
39
 
42
40
  masses = system.get_data("masses").block().values
43
41
  model_outputs = self.model(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashmd
3
- Version: 0.2.6
3
+ Version: 0.2.8
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,10 @@ 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.9
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
- Requires-Dist: metatrain==2026.1
25
+ Requires-Dist: metatrain==2026.2
26
26
  Requires-Dist: ase
27
27
  Requires-Dist: huggingface_hub
28
28
  Provides-Extra: dev
@@ -55,11 +55,11 @@ After installation, you can run accelerated molecular dynamics as follows:
55
55
  ```py
56
56
  import ase.build
57
57
  import ase.units
58
- from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
59
58
  import torch
60
- from metatomic.torch.ase_calculator import MetatomicCalculator
59
+ from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
61
60
 
62
61
  from flashmd import get_pretrained
62
+ from flashmd.ase import EnergyCalculator
63
63
  from flashmd.ase.langevin import Langevin
64
64
 
65
65
 
@@ -74,11 +74,11 @@ atoms.set_velocities( # it is generally a good idea to remove any net velocity
74
74
  )
75
75
 
76
76
  # Load models
77
- device="cuda" if torch.cuda.is_available() else "cpu"
78
- energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
77
+ device = "cuda" if torch.cuda.is_available() else "cpu"
78
+ energy_model, flashmd_model = get_pretrained("pet-omatpes-v2", time_step)
79
79
 
80
- # Set the energy model (see below for more precise usage)
81
- calculator = MetatomicCalculator(energy_model, device=device)
80
+ # Set the energy model (optional, see below for more precise usage)
81
+ calculator = EnergyCalculator(energy_model, device=device)
82
82
  atoms.calc = calculator
83
83
 
84
84
  # Run MD
@@ -88,9 +88,9 @@ dyn = Langevin(
88
88
  temperature_K=300,
89
89
  time_constant=100*ase.units.fs,
90
90
  model=flashmd_model,
91
- device=device
91
+ device=device,
92
92
  )
93
- dyn.run(1000)
93
+ dyn.run(1000) # this is 64 ps!
94
94
  ```
95
95
 
96
96
  [The first time you use this code and call the `get_pretrained` function, the
@@ -141,10 +141,13 @@ new to FlashMD, we recommend starting with the ``pet-omatpes-v2`` models.
141
141
  Training/fine-tuning your own FlashMD models
142
142
  --------------------------------------------
143
143
 
144
- FlashMD models can be trained from the metatrain library. This
144
+ FlashMD models can be trained from the **metatrain library**. This
145
145
  [tutorial](https://docs.metatensor.org/metatrain/latest/generated_examples/1-advanced/04-flashmd.html)
146
146
  shows how to train your own FlashMD model, either from scratch or by fine-tuning of one of our universal models.
147
147
 
148
+ The trajectory datasets generated with the PET-MAD baseline MLIPs used in the paper can be found in [this
149
+ repository](https://zenodo.org/records/17904449).
150
+
148
151
  Disclaimer
149
152
  ----------
150
153
 
@@ -156,6 +159,11 @@ parts of the simulated system. For the time being, we also recommend checking al
156
159
  FlashMD-powered findings with traditional MD. The energy models that were used to train
157
160
  FlashMD, and that we make available in this repository, can be used for this purpose.
158
161
 
162
+ #### More energy models
163
+
164
+ Do you want to try out different energy models (MLIPs),
165
+ trained on different levels of theory and/or with different accuracy-speed tradeoffs? Check
166
+ out the **[UPET](https://github.com/lab-cosmo/upet) repository.**
159
167
 
160
168
  Publication
161
169
  -----------
@@ -15,5 +15,7 @@ src/flashmd/ase/__init__.py
15
15
  src/flashmd/ase/bussi.py
16
16
  src/flashmd/ase/langevin.py
17
17
  src/flashmd/ase/velocity_verlet.py
18
+ tests/test_edge_cases.py
19
+ tests/test_energy.py
18
20
  tests/test_models.py
19
21
  tests/test_readme.py
@@ -1,4 +1,4 @@
1
- metatrain==2026.1
1
+ metatrain==2026.2
2
2
  ase
3
3
  huggingface_hub
4
4
 
@@ -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)
@@ -0,0 +1,29 @@
1
+ import ase.build
2
+ import ase.io
3
+ import ase.units
4
+ import torch
5
+ from ase.md import VelocityVerlet
6
+
7
+ from flashmd import get_pretrained
8
+ from flashmd.ase import EnergyCalculator
9
+
10
+
11
+ def test_md(monkeypatch, tmp_path):
12
+ """Test that a short MD run completes without errors with a Trajectory file."""
13
+ monkeypatch.chdir(tmp_path)
14
+
15
+ atoms = ase.build.bulk("Al", "fcc", cubic=True)
16
+
17
+ time_step = 64
18
+ device = "cuda" if torch.cuda.is_available() else "cpu"
19
+ energy_model, _ = get_pretrained("pet-omatpes-v2", time_step)
20
+ calculator = EnergyCalculator(
21
+ energy_model, device=device, do_gradients_with_energy=False
22
+ )
23
+ atoms.calc = calculator
24
+
25
+ dyn = VelocityVerlet(atoms=atoms, timestep=time_step * ase.units.fs)
26
+ traj = ase.io.Trajectory("test_md.traj", "w", atoms)
27
+ dyn.attach(traj.write)
28
+ dyn.run(10)
29
+ traj.close()
@@ -1,7 +0,0 @@
1
- import warnings
2
-
3
- from .models import get_pretrained as get_pretrained
4
- from .models import save_checkpoint as save_checkpoint
5
-
6
-
7
- warnings.filterwarnings("ignore", category=UserWarning, message="custom data")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes