|
140 | 140 |
|
141 | 141 | calculator = PETMADCalculator(version="latest", device="cpu")
|
142 | 142 |
|
| 143 | +# %% |
| 144 | +# |
| 145 | +# The model can also be exported in a format that can be used with |
| 146 | +# external MD engines. This is done by saving the model to a file, |
| 147 | +# which includes the model architecture and weights. |
| 148 | + |
| 149 | +calculator.model.save("pet-mad-latest.pt") |
143 | 150 |
|
144 | 151 | # %%
|
145 | 152 | #
|
|
380 | 387 | # without having to introduce vacancies or wait for the
|
381 | 388 | # very long time scale needed for diffusion.
|
382 | 389 |
|
383 |
| -# %% |
384 |
| -# |
385 |
| -# Before starting the simulations with MD engines, it is important |
386 |
| -# to export the model to a format that can be used by the engine. |
387 |
| -# This is done by saving the model to a file, which includes the |
388 |
| -# model weights and the compiled extensions. We use the ``collect_extensions`` |
389 |
| -# argument to save the compiled extensions to disk. These extensions ensure that |
390 |
| -# the model remains self-contained and can be executed without requiring the |
391 |
| -# original Python or C++ source code. In particular, this is necessary for |
392 |
| -# the LAMMPS interface to work because it has no access to the Python code. |
393 |
| - |
394 |
| -calculator.model.save("pet-mad-latest.pt", collect_extensions="extensions") |
395 |
| - |
396 | 390 |
|
397 | 391 | # %%
|
398 | 392 | #
|
|
513 | 507 |
|
514 | 508 | ase.io.write("al6xxx-o2.data", al_surface, format="lammps-data", masses=True)
|
515 | 509 |
|
516 |
| -subprocess.check_call(["lmp_serial", "-in", "data/al6xxx-o2.in"]) |
| 510 | +subprocess.check_call(["lmp", "-in", "data/al6xxx-o2.in"]) |
517 | 511 |
|
518 | 512 | # %%
|
519 | 513 | #
|
|
0 commit comments