Installing LAMMPS on a 64-bit AMD Opteron Cluster running CentOS 5 Linux (again)

LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) is used to model atoms or as a parallel particle simulator at the atomic, meso, or continuum scale. It has potentials for soft materials (biomolecules, polymers) and solid-state materials (metals, semiconductors) and coarse-grained or mesoscopic systems. You may remember a difficult install from the past.

From the LAMMPS download page, select the radio button for the latest source (C++) version. Ignore the claim that this is for 15 Jan 2010. The file will have the useful name lammps.tar.gz, which is just brilliant if you have multiple installs. One downloaded to a sensible place (e.g., /usr/local/src/LAMMPS) extract the tarball (tar xvf lammps.tar.gz), which will generate a directory like lammps-21Jul10. Rename it to a more consistent and functional naming scheme (e.g., mv lammps-21Jul10 lammps-20100721).

Previous installations have used PGI compilers; the most recent use Intel. Previous comments about LAMMPS installation being non-trivial still apply, but it is a lot easier now. Start with the appropriate environment modules:


module load intel/11.1
module load acml/4.3.0-intel
module load fftw/2.1.5-intel

Any packages must be built before LAMMPS is built so it can link with them. Change into the src directory and run make yes-reax. Change into the reax directory (cd ../lib/reax) and build the package (make -f Makefile.ifort). Change to the src/MAKE directory, copy and modify one the same makefiles to suit the particular hardware and software configuration and go through the process of editing until it works. We have one we prepared earlier which can be simply copied into that directory (cp /usr/local/src/LAMMPS/Makefile.xxxx /usr/local/src/LAMMPS/Makefile.xxxx/lammps-20100721/src/MAKE). It looks like this:


# xxxx = Intel compiler, OpenMPI, FFTW, ACML
SHELL = /bin/sh
#.IGNORE:
# System-specific settings
CC = mpic++
CCFLAGS =
DEPFLAGS = -M
LINK = mpic++
LINKFLAGS =
LIB =
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size
# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use
# LAMMPS ifdef options, see doc/Section_start.html
LMP_INC = -DLAMMPS_GZIP
# MPI library, can be src/STUBS dummy lib
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library
MPI_INC = -DMPICH_SKIP_MPICXX
MPI_PATH =
MPI_LIB = -lpthread
# FFT library, can be -DFFT_NONE if not using PPPM from KSPACE package
# INC = -DFFT_FFTW, -DFFT_INTEL, -DFFT_NONE, etc, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library
FFT_INC = -DFFT_FFTW
FFT_PATH =
FFT_LIB = -lfftw
# additional system libraries needed by LAMMPS package libraries
# these settings are IGNORED if the corresponding LAMMPS package
# (e.g. gpu, meam) is NOT included in the LAMMPS build
# SYSLIB = names of libraries
# SYSPATH = paths of libraries
gpu_SYSLIB = -lcudart
meam_SYSLIB = -lifcore -lsvml -lompstub -limf
reax_SYSLIB = -lifcore -lsvml -lompstub -limf
user-atc_SYSLIB = -lblas -llapack
FFT_INC = -DFFT_FFTW
FFT_PATH =
FFT_LIB = -lfftw
# additional system libraries needed by LAMMPS package libraries
# these settings are IGNORED if the corresponding LAMMPS package
# (e.g. gpu, meam) is NOT included in the LAMMPS build
# SYSLIB = names of libraries
# SYSPATH = paths of libraries
gpu_SYSLIB = -lcudart
meam_SYSLIB = -lifcore -lsvml -lompstub -limf
reax_SYSLIB = -lifcore -lsvml -lompstub -limf
user-atc_SYSLIB = -lblas -llapack
gpu_SYSPATH = -L/usr/local/cuda/lib64
meam_SYSPATH = -L/usr/local/intel/fce/10.1.025/lib
reax_SYSPATH = -L/usr/local/intel/fce/10.1.025/lib
user-atc_SYSPATH =
# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section
include Makefile.package
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(PKG_SYSLIB)
# Link target
$(EXE): $(OBJ)
$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
$(SIZE) $(EXE)
# Library target
lib: $(OBJ)
$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
# Compilation rules
%.o:%.cpp
$(CC) $(CCFLAGS) $(EXTRA_INC) -c $<
%.d:%.cpp
$(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@
# Individual dependencies
DEPENDS = $(OBJ:.o=.d)
include $(DEPENDS)

Go into the src directory, build with make xxxx. This will generate a binary, lmp_xxxx. Make a new directory (mkdir /usr/local/lammps/20100721) and copy the binary there. Modify environment module files to note the new entry and change the .version file when tested.