Files
lammps/examples/mliap
2020-12-04 14:48:02 -07:00
..
2020-12-04 14:04:35 -07:00
2020-12-04 14:48:02 -07:00
2020-12-04 14:48:02 -07:00

README for the PyTorch energy model example

These two examples run the Ta06 example from the MLIAP package, but using the python coupling.
The differ only in how the coupling is constructed.

1: Running models using LAMMPS executable: in.mliap.pytorch.Ta06A

To run this, first run convert_mliap_Ta06A.py, which will convert the Ta06 potential into a pytorch model.
It will be saved as "Ta06A.mliap.pytorch.model.pkl".

It will also copy the "mliappy_pytorch.py" file into the current working directory. mliappy_pytorch.py contains
class definitions suitable for wrapping an arbitrary PyTorch energy model. It must be available to python when
creating or unpicking a PyTorch energy model.

From that point you can run the example lmp -in in.mliap.pytorch.Ta06A -echo both

2: Running models from python with LAMMPS in library mode: mliap_pytorch_Ta06A.py

Before testing this, ensure that the first example (using LAMMPS executable) works.
Also, not all python installations support this mode of operation. 
It requires that the Python interpreter be initialized. 
To check this for your Python library,
run the Py_IsInitialized() method.
If the return value is True, you should be able to run the example,
as follows:

`python mliap_pytorch_Ta06A.py`

or

`mpirun -np 4 python mliap_pytorch_Ta06A.py`

The resultant log.lammps output should be identical to that generated
by in.mliap.snap.Ta06A and in.mliap.pytorch.Ta06A