Files
lammps/examples/mliap
Aidan Thompson 56feb03b38 Edits to README
2020-12-09 16:51:36 -07:00
..
2020-12-09 16:51:36 -07:00
2020-12-04 14:04:35 -07:00
2020-12-09 16:51:36 -07:00
2020-12-04 14:48:02 -07:00
2020-12-09 16:51:36 -07:00

This directory contains multipler examples of 
machine-learning potentials defined using the 
MLIAP package in LAMMPS. The input files
are descirbed below.

in.mliap.snap.Ta06A
-------------------
Run linear SNAP, equivalent to examples/snap/in.snap.Ta06A

in.mliap.snap.WBe.PRB2019
-------------------------
Run linear SNAP, equivalent to examples/snap/in.snap.WBe.PRB2019

in.mliap.snap.quadratic
-----------------------
Run quadratic SNAP

in.mliap.snap.chem
------------------
Run EME-SNAP, equivalent to examples/snap/in.snap.InP.JCPA2020

in.mliap.snap.compute
---------------------
Generate gradients w.r.t. coefficients for linear SNAP,
equivalent to in.snap.compute

in.mliap.quadratic.compute
--------------------------
Generate gradients w.r.t. coefficients for quadratic SNAP,
equivalent to in.snap.compute.quadratic

in.mliap.pytorch.Ta06A
-----------------------
This reproduces the output of in.mliap.snap.Ta06A above,
but using the Python coupling to PyTorch.
It can be run in two different ways:

1: Running a LAMMPS executable: in.mliap.pytorch.Ta06A

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

It will also copy "../../src/MLIAP/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 unpickling a PyTorch energy model.

From that point you can run the example as follows

`lmp -in in.mliap.pytorch.Ta06A -echo both`

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

2: Running a Python script: 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,
try running 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.