1This directory contains multiple examples of
2machine-learning potentials defined using the
3MLIAP package in LAMMPS. The input files
4are described below.
5
6in.mliap.snap.Ta06A
7-------------------
8Run linear SNAP, equivalent to examples/snap/in.snap.Ta06A
9
10in.mliap.snap.WBe.PRB2019
11-------------------------
12Run linear SNAP, equivalent to examples/snap/in.snap.WBe.PRB2019
13
14in.mliap.snap.quadratic
15-----------------------
16Run quadratic SNAP
17
18in.mliap.snap.chem
19------------------
20Run EME-SNAP, equivalent to examples/snap/in.snap.InP.JCPA2020
21
22in.mliap.snap.compute
23---------------------
24Generate the A matrix, the gradients (w.r.t. coefficients)
25of total potential energy, forces, and stress tensor for
26linear SNAP, equivalent to in.snap.compute
27
28in.mliap.quadratic.compute
29--------------------------
30Generate the A matrix, the gradients (w.r.t. coefficients)
31of total potential energy, forces, and stress tensor for
32for quadratic SNAP, equivalent to in.snap.compute.quadratic
33
34in.mliap.pytorch.Ta06A
35-----------------------
36This reproduces the output of in.mliap.snap.Ta06A above,
37but using the Python coupling to PyTorch.
38
39This example can be run in two different ways:
40
411: Running a LAMMPS executable: in.mliap.pytorch.Ta06A
42
43First run ``python convert_mliap_Ta06A.py``. It creates
44a PyTorch energy model that replicates the
45SNAP Ta06A potential and saves it in the file
46"Ta06A.mliap.pytorch.model.pt".
47
48You can then run the example as follows
49
50`lmp -in in.mliap.pytorch.Ta06A -echo both`
51
52The resultant log.lammps output should be identical to that generated
53by in.mliap.snap.Ta06A.
54
55If this fails, see the instructions for building the MLIAP package
56with Python support enabled. Also, confirm that the
57LAMMPS Python embedded Python interpreter is
58working by running ../examples/in.python.
59
602: Running a Python script: mliap_pytorch_Ta06A.py
61
62Before testing this, ensure that the previous method
63(running a LAMMPS executable) works.
64
65You can run the example in serial:
66
67`python mliap_pytorch_Ta06A.py`
68
69or in parallel:
70
71`mpirun -np 4 python mliap_pytorch_Ta06A.py`
72
73The resultant log.lammps output should be identical to that generated
74by in.mliap.snap.Ta06A and in.mliap.pytorch.Ta06A.
75
76Not all Python installations support this mode of operation.
77It requires that the Python interpreter be initialized. If not,
78the script will exit with an error message.
79
80in.mliap.pytorch.relu1hidden
81----------------------------
82This example demonstrates a simple neural network potential
83using PyTorch and SNAP descriptors.
84
85`lmp -in in.mliap.pytorch.relu1hidden -echo both`
86
87It was trained on just the energy component (no forces) of
88the data used in the original SNAP Ta06A potential for
89tantalum (Thompson, Swiler, Trott, Foiles, Tucker,
90J Comp Phys, 285, 316 (2015).). Because of the very small amount
91of energy training data, it uses just 1 hidden layer with
92a ReLU activation function. It is not expected to be
93very accurate for forces.
94
95NOTE: Unlike the previous example, this example uses
96a pre-built PyTorch file `Ta06A.mliap.pytorch.model.pt`.
97It is read using `torch.load`,
98which implicitly uses the Python `pickle` module.
99This is known to be insecure. It is possible to construct malicious
100pickle data that will execute arbitrary code during unpickling. Never
101load data that could have come from an untrusted source, or that
102could have been tampered with. Only load data you trust.
103
104in.mliap.nn.Ta06A
105-------------------
106Run linear SNAP using the "nn" model style, equivalent to examples/snap/in.snap.Ta06A
107
108in.mliap.nn.cu
109-------------------------
110Run a neural network potential for Cu, a combination of SNAP descriptors and the "nn" model style
111
112
113