Installation of LAMMPS for RHEL and CentOS
Large-scale Atomic/Molecular Massively Parallel Simulator (LAMMPS) is a classical molecular dynamics code for solid-state materials (metals, semiconductors), soft matter (biomolecules, polymers), and coarse-grained or mesoscopic systems. It can be used to model cluster of atoms or, more generically, as a parallel particle simulator at the atomic, meso, or continuum scale. If you googling with "compile lammps" you will find that there is a plenty of compilation instruction. Most of website that you found were written for expert ! In this post, I am going to show the simplest way to build LAMMPS executable on your Linux machine. All steps here has been taken place on CentOS 7 64 bit. RHEL is also supported.
Install LAMMPS via RPM package installer.
Step 1. Go to rpm.lammps.org and browse to repository that corresponds your Linux platform.
Follow instruction there for installing yum repository of LAMMPS for your Linux.
For CentOS and RHEL, enabling repository of LAMMPS on your cluster
su -c 'yum localinstall --nogpgcheck http://git.icms.temple.edu/rpm/centos/lammps-centos-rhel-repo-1-2.noarch.rpm'
Step 2. Install LAMMPS by running following command
sudo yum install lammps
Step 3. After installation is completed, LAMMPS executable can by called by
lmp_g++
lmp_g++ is located either at /usr/lib64/openmpi/bin/lmp_g++
(lammps-openmpi-***.rpm) or /usr/bin/lmp_g++
(lammps-***.rpm).
Step 4. Add lmp_g++ into your $PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
or
export PATH=/usr/bin/bin:$PATH
Step 5. Define number of thread for running LAMMPS with MPI.
export OMP_NUM_THREADS=1
Step 6. You can run LAMMPS using command
mpirun -np N /usr/lib/openmpi/bin/lmp_g++ -i inputfile.in >& output &
where N = number of processor cores.
Install LAMMPS using source code
Prerequisite.
Note: you are assumed that FFTW is installed on your cluster before compiling LAMMPS. If not, you can quickly install FFTW in a few steps.
I suggest you to install FFTW version 2.1.5 because LAMMPS cannot work with the latest version (3.3.8).
1. Go to http://www.fftw.org/download.html and download FFTW version 2.1.5.
2. Then uncompress the zip file and install using command. (root is needed)
cd fftw-2.1.5
./configure CC=mpiicc F77=mpiifort --prefix=/usr/local/fftw-2.1.5
make
make check
make install
Step 1. Download LAMMPS source code website.
http://lammps.sandia.gov/download.html#tar
Choose the stable version (the 1st one) ! I downloaded version 13 Mar 2018.
Step 2. Uncompress zip file and change directory to LAMMPS.
tar -xvf lammps-stable.tar.gz
Note: I assume that you are installing LAMMPS in your home directory, in my case, the source code folder is at /home/nutt/LAMMPS.
Step 3. Nevigate to /home/nutt/lammps-16Mar18/src/. Actually, LAMMPS can be compile simply by typing
make mpi
This command will compile LAMMPS with standard packages as an executable lmp_mpi in src sub-folder.
However, You can choose which package you do or do not want to use by making the pakcage Makefile as described in a more detailed
http://lammps.sandia.gov/doc/Section_start.html#making-lammps.
Step 4. Run test calculation using an example file at /home/nutt/lammps-16Mar18/examples
For example,
Run LAMMPS in serial
lmp_mpi -in test.in
Run LAMMPS in parallel with MPI
mpirun -np 4 lmp_mpi -in test.in
If you have any problems, please post your question at LAMMPS forum.
Rangsiman Ketkaew