Lammps Installation For Parallel Run in Linux
- Post by: Abhinav Gupta
- March 18, 2019
- No Comment
LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) is a classical molecular dynamics code.“LAMMPS has potentials for soft materials (biomolecules, polymers) and solid-state materials (metals, semiconductors) and coarse-grained or mesoscopic systems. It can be used to model atoms or, more generically, as a parallel particle simulator at the atomic, mesoscale, or continuum scale.”
Pre Installation Steps:-These installation steps are for Ubuntu/
- Check installed compilers
dpkg --list | grep compiler
- Install all necessary gcc and fortran compilers
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
gcc -v
make -v
sudo apt-get install gfortran
- Install python, zlib.h etc.
Check if python is already installed
python --version
If it is not installed in your system, then go for these commands:-
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
./configure
make
sudo checkinstall
or
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.7 #for python 2.7#
or
sudo apt-get install make build-essential zlib1g-dev libbz2-dev libreadline-dev
sudo apt-get update
sudo apt-get install sqlite3 libsqlite3-dev
sudo apt-get install libssl-dev
- For the installation of zlib and png
for libpng use this command in your terminal:
sudo apt-get install libpng-dev
sudo apt-get install zlib1g-dev
After these installations two important installations are required,
install FFTW libraries:-
sudo apt-get install libfftw3-dev
- Installation of openmpi
Before installation of Openmpi, you have to install some dependencies manually, please go through these steps for installation
Step – 1 : Install the basic dependency packages
sudo apt-get install libibnetdisc-dev
Step – 2 : Download the latest openmpi package from here ;
https://www.open-mpi.org/software/ompi/v4.0/
Step – 3: Extract the openmpi package and open the directory ; if you have problem in extraction, then go through this link;
https://askubuntu.com/questions/191390/how-to-use-sudo-command-to-install-tar-gz
Or use these commands for extraction:-
tar -xzf archive-name.tar.gz
cd archive-name
Step – 4: Configure the installation file, after entering the package folder by using:-
cd openmpi #if your archive-name is openmpi#
./configure --prefix="/home/$sandeep/.openmpi" #sandeep is my username, change it accordingly#
make && sudo make install
Step –5: Setup environment path and test mpirun
export PATH="$PATH:/home/user/.openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/user/.openmpi/lib/"
mpirun
If everything goes fine, then you should see the following message on running the command mpirun in the terminal :
mpirun could not find anything to do
- Addition of path manually for Openmpi (Parallel Run)
To install gedit (Text editor):-
GEDIT is a popular text editor which may be required for editing the text files inside LAMMPS libraries. Install it by using this command in the terminal;
sudo apt-get install gedit
Open home/
sudogedit bash.bashrc
add the two path in the end:-
export PATH="$PATH:/home/user/.openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/user/.openmpi/lib/"
sudo gedit profile
Add these two paths in the end:
export PATH="$PATH:/home/user/.openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/user/.openmpi/lib/"
*for python related errors, you can go through these commands
sudo apt-get install python
sudo apt-get install python-dev
sudo apt-get install python-lxml
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
- Lammps Installation Steps:-
Step 1. Download LAMMPS tarball from the website:-
https://lammps.sandia.gov/doc/Install_tarball.html
or clone it from
git clone -b stable https://github.com/lammps/lammps.gitmylammps
This command will clone stable version of
Step 2. Extract all the files at the same place using same command which is used for extraction in pre-installation process for openmpi and fftw installation.
Step 3. Open terminal over src
make yes-std
make yes-USER-REAXC
make yes-REAX
make yes-MEAM
But sometimes make yes-std creates a problem for installation all the standard package as a bulk. So it is advised that don’t install it initially as a bulk. If it is working properly, then it is ok. Unfortunately, if it is not working properly then go through this command in
make no-std
Step 4. Enter lib in LAMMPS directory by using these commands in the terminal:-
cd mylammps
cd lib
Step 5. Enter
make -f Makefile.gfortran
Step 6. Enter poems folder in the terminal:-
cd ..
cd poems
make -f Makefile.g++Enter
In meam folder,open terminal from there and type:-
make -f Makefile.gfortran
For installation of the software change working directory to src and do the following for finalizing the installation:-
make no-kokkos
make no-kim
make no-voronoi
make no-gpu
make no-mpiio
make mpi
After make mpi command, sit relax and Lammps will install in some time for the parallel run in the system.
Running Lammps Parallel:-
Use following command for running Lammps parallelly in your system:
mpirun -np 45 lmp_mpi -in in.lj
Here in.
mpirun -np 45 ~/softwares/mylammps/src/lmp_mpi -in in.lj
References:-
1. Lammps Installation http:// http://lammps.sandia.gov/
2. Open Mpi Installation https://www.open-mpi.org/