diff --git a/examples/mliap/README b/examples/mliap/README index 68b6f2e200..2641bdc975 100644 --- a/examples/mliap/README +++ b/examples/mliap/README @@ -72,3 +72,11 @@ or The resultant log.lammps output should be identical to that generated by in.mliap.snap.Ta06A and in.mliap.pytorch.Ta06A. + +in.mliap.pytorch.relu1hidden +---------------------------- +This example demonstrates a simple neural network potential +using PyTorch and SNAP descriptors. It uses a ReLU activation +function with just 1 hidden layer. + +`lmp -in in.mliap.pytorch.relu1hidden -echo both` diff --git a/examples/mliap/in.mliap.pytorch.relu1hidden b/examples/mliap/in.mliap.pytorch.relu1hidden new file mode 100644 index 0000000000..f19ffb608d --- /dev/null +++ b/examples/mliap/in.mliap.pytorch.relu1hidden @@ -0,0 +1,53 @@ +# Demonstrate MLIAP interface to linear SNAP potential + +# Initialize simulation + +variable nsteps index 100 +variable nrep equal 4 +variable a equal 3.316 +units metal + +# generate the box and atom positions using a BCC lattice + +variable nx equal ${nrep} +variable ny equal ${nrep} +variable nz equal ${nrep} + +boundary p p p + +lattice bcc $a +region box block 0 ${nx} 0 ${ny} 0 ${nz} +create_box 1 box +create_atoms 1 box + +mass 1 180.88 + +# choose potential + +include relu1hidden.mliap.pytorch + +# Setup output + +compute eatom all pe/atom +compute energy all reduce sum c_eatom + +compute satom all stress/atom NULL +compute str all reduce sum c_satom[1] c_satom[2] c_satom[3] +variable press equal (c_str[1]+c_str[2]+c_str[3])/(3*vol) + +thermo_style custom step temp epair c_energy etotal press v_press +thermo 10 +thermo_modify norm yes + +# Set up NVE run + +timestep 0.5e-3 +neighbor 1.0 bin +neigh_modify once no every 1 delay 0 check yes + +# Run MD + +velocity all create 300.0 4928459 loop geom +fix 1 all nve +run ${nsteps} + diff --git a/examples/mliap/relu1hidden.mliap.pytorch b/examples/mliap/relu1hidden.mliap.pytorch new file mode 100644 index 0000000000..a2271cee39 --- /dev/null +++ b/examples/mliap/relu1hidden.mliap.pytorch @@ -0,0 +1,18 @@ +# DATE: 2014-09-05 UNITS: metal CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014) + +# Definition of SNAP potential Ta_Cand06A +# Assumes 1 LAMMPS atom type + +variable zblcutinner equal 4 +variable zblcutouter equal 4.8 +variable zblz equal 73 + +# Specify hybrid with SNAP, ZBL + +pair_style hybrid/overlay & +zbl ${zblcutinner} ${zblcutouter} & +mliap model mliappy relu1hidden.mliap.pytorch.model.pkl & +descriptor sna Ta06A.mliap.descriptor +pair_coeff 1 1 zbl ${zblz} ${zblz} +pair_coeff * * mliap Ta + diff --git a/examples/mliap/relu1hidden.mliap.pytorch.model.pkl b/examples/mliap/relu1hidden.mliap.pytorch.model.pkl new file mode 100644 index 0000000000..49e70ca1a4 Binary files /dev/null and b/examples/mliap/relu1hidden.mliap.pytorch.model.pkl differ