Quang Nguyen

Personal website

Install LAMMPS on OS X Mavericks

LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) is a molecular dynamics program from Sandia National Laboratories. Below you can find the step-by-step instructions on how to install LAMMPS on OS X Mavericks.

- System Version: OS X 10.9.3
- LAMMPS Version: 1-Feb-2014
- FORTRAN Compiler: Intel FORTRAN Composer XE (version 14.0.2)
- C++ Compiler: Intel C++ Composer XE (version 14.0.2)
- BLAS, LAPACK, FFTW: Intel MKL (version 11.1)
- MPI Library: OpenMPI (version 1.8.1)

A. Preparation
1. External libraries (directory: {LAMMPS_DIR}/lib/)

- Create AWPMD library (in “awpmd” folder):
Change "Makefile.lammps.installed" as follows:
user-awpmd_SYSINC =
user-awpmd_SYSLIB =
user-awpmd_SYSPATH =

Compile: make -f Makefile.openmpi

- Create COLVARS library (in “colvars” folder):
Create "Makefile.icc" from "Makefile.g++"
Change "Makefile.icc" as follows:
CXX = icc
CXXFLAGS = -O2 -g -fPIC -unroll0

Compile: make -f Makefile.icc

- Create MEAM library (in “meam” library):
Change "Makefile.lammps.ifort" as follows:
meam_SYSINC =
meam_SYSLIB = -lifcore -lsvml -limf
meam_SYSPATH =

Compile: make -f Makefile.ifort

- Create POEMS library (in “poems” folder):
Compile: make -f Makefile.icc

- Create REAX library (in “reax” folder):
Change "Makefile.lammps.ifort" as follows:
reax_SYSINC =
reax_SYSLIB = -lifcore -lsvml -limf
reax_SYSPATH =

Compile: make -f Makefile.ifort

2. Dummy MPI library (directory: {LAMMPS_DIR}/src/STUBS/)

Change "Makefile" as follows:
CC = icc
Compile: make

3. Makefiles for compilation (directory: {LAMMPS_DIR}/src/MAKE/)

- For serial version, change "Makefile.mac" as follows:
MKLROOT = /opt/intel/mkl
CC = icc
CCFLAGS = -O3 -fno-alias -ip -unroll0
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = icc
LINKFLAGS = -O3 -static-intel
LIB = -lstdc++
SIZE = size
ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared
LMP_INC = -DLAMMPS_GZIP
MPI_INC = -I../STUBS
MPI_PATH = -L../STUBS
MPI_LIB = -lmpi_stubs
FFT_INC = -DFFT_MKL -I$(MKLROOT)/include
FFT_PATH =
FFT_LIB = -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm


- For MPI version, change "Makefile.mac_mpi" as follows:
MKLROOT = /opt/intel/mkl
CC = mpic++
CCFLAGS = -O3 -fno-alias -ip -unroll0
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpic++
LINKFLAGS = -O3 -static-intel
LIB = -lstdc++
SIZE = size
ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared
LMP_INC = -DLAMMPS_GZIP
MPI_INC = -DOMPI_SKIP_MPICXX
MPI_PATH =
MPI_LIB =
FFT_INC = -DFFT_MKL -I$(MKLROOT)/include
FFT_PATH =
FFT_LIB = -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm


B. Installation
1. Choose packages (directory: {LAMMPS_DIR}/src/)

- Select all packages at first:
make yes-all

- Remove unnecessary packages:
make no-gpu
make no-kim
make no-voronoi
make no-user-atc
make no-user-cuda
make no-user-molfile
make no-user-omp


- For serial version also remove:
make no-mpiio
make no-user-lb


2. Compile LAMMPS (directory: {LAMMPS_DIR}/src/)

- For serial version: make -j 4 mac

- For MPI version: make -j 4 mac_mpi

3. If USER-OMP is used

- Remove lines 203 and 221 in file “pair_adp_omp.cpp” (located at {LAMMPS_DIR}/src/USER-OMP/) to prevent any error during compilation
- Add “-openmp” to CCFLAGS and LINKFLAGS in Makefiles
- Change “-lmkl_sequential” to “-lmkl_intel_thread” for FFT_LIB in Makefiles
- Install USER-OMP package after all others are installed (make yes-user-omp)