2.4. Install LAMMPS
There are two ways to install LAMMPS: the built-in mode and the plugin mode. The built-in mode builds LAMMPS along with the DeePMD-kit and DeePMD-kit will be loaded automatically when running LAMMPS. The plugin mode builds LAMMPS and a plugin separately, so one needs to use Before following this section, DeePMD-kit C++ interface should have be installed. DeePMD-kit provides a module for running MD simulations with LAMMPS. Now make the DeePMD-kit module for LAMMPS. DeePMD-kit will generate a module called The source code of LAMMPS is stored in the directory Then, you can build LAMMPS with either make or CMake. Now go into the LAMMPS code and copy the DeePMD-kit module like this You can enable any other package you want. Now build LAMMPS If everything works fine, you will end up with an executable The DeePMD-kit module can be removed from the LAMMPS source code by Now go into the LAMMPS directory and create a directory called Patch the LAMMPS It’s expected to see one extra line in the end of Now build LAMMPS. You can install any other package you want. If everything works fine, you will end up with an executable Starting from Now download the LAMMPS code ( The source code of LAMMPS is stored in the directory Now build LAMMPS. Note that If everything works fine, you will end up with an executable Note If plugin load
command to load the DeePMD-kit’s LAMMPS plugin library.2.4.1. Install LAMMPS’s DeePMD-kit module (built-in mode)
cd $deepmd_source_dir/source/build
make lammps
USER-DEEPMD
in the build
directory, which supports either double or single float precision interface. Now download the LAMMPS code, and uncompress it.cd /some/workspace
wget https://github.com/lammps/lammps/archive/stable_2Aug2023_update3.tar.gz
tar xf stable_2Aug2023_update3.tar.gz
lammps-stable_2Aug2023_update3
.2.4.1.1. With make
cd lammps-stable_2Aug2023_update3/src/
cp -r $deepmd_source_dir/source/build/USER-DEEPMD .
make yes-kspace
make yes-extra-fix
make yes-user-deepmd
make mpi -j4
lmp_mpi
../lmp_mpi -h
make no-user-deepmd
2.4.1.2. With CMake
build
:mkdir -p lammps-stable_2Aug2023_update3/build/
cd lammps-stable_2Aug2023_update3/build/
CMakeLists.txt
file:echo "include(${deepmd_source_dir}/source/lmp/builtin.cmake)" >> ../cmake/CMakeLists.txt
CMakeLists.txt
.cmake -D LAMMPS_INSTALL_RPATH=ON -D BUILD_SHARED_LIBS=yes -D CMAKE_INSTALL_PREFIX=${deepmd_root} -DCMAKE_PREFIX_PATH=${deepmd_root} ../cmake
make -j4
make install
${deepmd_root}/bin/lmp
.${deepmd_root}/bin/lmp -h
2.4.2. Install LAMMPS (plugin mode)
8Apr2021
, LAMMPS also provides a plugin mode, allowing one to build LAMMPS and a plugin separately.8Apr2021
or later), and uncompress it:cd /some/workspace
wget https://github.com/lammps/lammps/archive/stable_2Aug2023_update3.tar.gz
tar xf stable_2Aug2023_update3.tar.gz
lammps-stable_2Aug2023_update3
. The directory of the source code should be specified as the CMAKE argument LAMMPS_SOURCE_ROOT
during installation of the DeePMD-kit C++ interface. Now go into the LAMMPS directory and create a directory called build
mkdir -p lammps-stable_2Aug2023_update3/build/
cd lammps-stable_2Aug2023_update3/build/
PLUGIN
must be enabled, and BUILD_SHARED_LIBS
must be set to yes
. You can install any other package you want.cmake -D PKG_PLUGIN=ON -D LAMMPS_INSTALL_RPATH=ON -D BUILD_SHARED_LIBS=yes -D CMAKE_INSTALL_PREFIX=${deepmd_root} -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_INSTALL_FULL_LIBDIR=${deepmd_root}/lib ../cmake
make -j4
make install
${deepmd_root}/bin/lmp
.${deepmd_root}/bin/lmp -h
${tensorflow_root}
, ${deepmd_root}
, or the path to TensorFlow Python package if applicable is different from the prefix of LAMMPS, you need to append the library path to RUNPATH
of liblammps.so
. For example, use patchelf >= 0.13patchelf --add-rpath "${tensorflow_root}/lib" liblammps.so