LAMMPS

Description

LAMMPS is a classical molecular dynamics code and is designed to be easy to use and to extend.

User instructions

LAMMPS is available via the modules system. To add it to your environment run:

$ module load lammps/2017.08.11

Note that versions are marked by their date rather than a more conventional version number. The LAMMPS program is called lmp. The LAMMPS python and quip interfaces are also installed.

License

GNU General Public License.

Admin notes

There are several optional plugins. Following advice from those who’ve used LAMMPS, I selected POEMS, MEAM, ASPHERE, CLASS2, KSPACE, MOLECULE and OPT. Compilation was straightforard–take care to compile libraries for plugins first (if required).

# GCC version
module load gcc fftw python/2.7.13 ase openmpi mkl quip
# set FFT_INC = -DFFT_FFTW3 and FFT_LIB = -lfftw3 in src/MAKE/Makefile.mpi
(cd lib/poems && make -f Makefile.g++)
(cd lib/meam && make -f Makefile.gfortran)
cd src
for x in yes-{asphere,class2,meam,kspace,molecule,poems,manybody,mc,python}; do make $x; done
export QUIP_ROOT=/workspace/builder/build/quip/quip-gcc-python2
export QUIP_ARCH=linux_x86_64_gfortran_openmpi
# Modify ../lib/quip/Makefile.lammps to set
# F95=gfortran
# quip_SYSLIB = -lquip -lmpi_mpifh
make mpi
make mpi mode=shlib

# Intel version
ml purge
ml intel fftw python/2.7.13 ase openmpi mkl quip
# set LIB = -lifcore, FFT_INC = -DFFT_FFTW3 FFT_LIB = -lfftw3 and add -restrict to CCFLAGS in src/MAKE/Makefile.mpi
# remove -lompstub from MEAM_syslib in lib/meam/Makefile.lammps*
(cd lib/poems && make -f Makefile.icc)
(cd lib/meam && make -f Makefile.ifort)
cd src
for x in yes-{asphere,class2,meam,kspace,molecule,poems,manybody,mc,python}; do make $x; done
export QUIP_ROOT=/workspace/builder/build/quip/quip-intel-python2
export QUIP_ARCH=linux_x86_64_ifort_icc_mpi
# Modify ../lib/quip/Makefile.lammps with the following
# F95=ifort
# quip_SYSLIB = -lquip -lmpi_mpifh
make mpi
make mpi mode=shlib

Installation was then a matter of copying src/lmp_mpi to the desired location (i.e. bin/lmp in the relevant subdirectory under /common). The python interface requires the shared library (src/liblammps_mpi.so and src/liblammps.so) and the python module (python/lammps.py) to also be copied to the standard layout for libraries and python modules under /common.

7 Aug 2019

I’ve installed the new version in October 2019. In terms of plugins, I’ve included all those included in the previous version (POEMS, MEAM, ASPHERE, CLASS2, KSPACE, MOLECULE and OPT) and added the following upon request: DIPOLE, MANYBODY and USER-MISC.

For the compilation, I have used cmake. After extracting the archive with the release and creating a “build” directory inside it I saved the following settings.cmake file inside

include(../cmake/presets/all_off.cmake)

set(PKG_ASPHERE ON CACHE BOOL "" FORCE)
set(PKG_CLASS2 ON CACHE BOOL "" FORCE)
set(PKG_DIPOLE ON CACHE BOOL "" FORCE)
set(PKG_KSPACE ON CACHE BOOL "" FORCE)
set(PKG_MANYBODY ON CACHE BOOL "" FORCE)
set(PKG_MEAM ON CACHE BOOL "" FORCE)
set(PKG_MOLECULE ON CACHE BOOL "" FORCE)
set(PKG_OPT ON CACHE BOOL "" FORCE)
set(PKG_POEMS ON CACHE BOOL "" FORCE)
set(PKG_USER-MISC ON CACHE BOOL "" FORCE)

set(BUILD_MPI ON CACHE BOOL "" FORCE)

set(CMAKE_INSTALL_PREFIX /common/debian/9.1/MPI/intel/2017.4/openmpi/2.1/lammps/lammps-2019.08.07/ CACHE PATH "" FORCE)
set(CMAKE_C_COMPILER icc CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER icpc CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER ifort CACHE STRING "" FORCE)
set(FFT FFTW3 CACHE STRING "" FORCE)

set(BUILD_EXE ON CACHE BOOL "" FORCE)
set(BUILD_LIB ON CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)

It’s then just a matter of running cmake and make as follows

cmake -C settings.cmake ../cmake
make
make install

and the library and executable should be installed in the proper directories, assuming all permission are OK.