Skip to content

Instantly share code, notes, and snippets.

@kparrish
Last active October 12, 2016 19:04
Show Gist options
  • Save kparrish/5731874 to your computer and use it in GitHub Desktop.
Save kparrish/5731874 to your computer and use it in GitHub Desktop.
Install a parallel version of lammps on ubuntu based systems.
#!/bin/bash
### Lammps parallel install
# Assign user name
read -p "Enter your user name: " UserName
# Install required packages
apt-get update
apt-get -y upgrade
apt-get -y install build-essential openmpi-bin openmpi-doc libopenmpi-dev fftw2 fftw-dev
# Check/remove lammps.tar.gz
if [ -f ~/Downloads/lammps.tar.gz ]
then
rm ~/Downloads/lammps.tar.gz
fi
# Downloads lammps.tar.gz
sudo -u $UserName wget -P ~/Downloads http://lammps.sandia.gov/tars/lammps.tar.gz
cd ~/Downloads
sudo -u $UserName tar xzf ~/Downloads/lammps.tar.gz
cd lammps-*
cd src
cd MAKE
sudo -u $UserName cp Makefile.mpi Makefile.mint
sudo -u $UserName sed -i -e 's/# openmpi/ # mint = Linux Mint, mpic++, OpenMPI-1.1, FFTW2/g' Makefile.mint
sudo -u $UserName sed -i -e 's/-DFFT_FFTW3/-DFFT_FFTW2/g' Makefile.mint
cd ..
sudo -u $UserName make yes-kspace
sudo -u $UserName make yes-user-phonon
sudo -u $UserName make mode=lib mint
sudo -u $UserName make mode=shlib mint
sudo -u $UserName make mint
# Make python library
make install-python
cd ~
@ViktorZhelt
Copy link

Dear Sir,

I try installing LAMMPS by your instructions. Everything was Ok until 'make mint' command. During executing this command many messages is appeared such as

"fft3d.o: In function fft_3d': /home/viktor/Downloads/lammps-20Aug16/src/Obj_mint/../fft3d.cpp:145: undefined reference tofftw'"
fft3d.o: In function fft_3d_create_plan': /home/viktor/Downloads/lammps-20Aug16/src/Obj_mint/../fft3d.cpp:811: undefined reference tofftw_create_plan'
fft3d.o: In function fft_3d_destroy_plan': /home/viktor/Downloads/lammps-20Aug16/src/Obj_mint/../fft3d.cpp:977: undefined reference tofftw_destroy_plan'
fft3d.o: In function `fft_1d_only':

/home/viktor/Downloads/lammps-20Aug16/src/Obj_mint/../fft3d.cpp:1208: undefined reference to `fftw'

and then there are messages

collect2: error: ld returned 1 exit status
Makefile:89: recipe for target '../lmp_mint' failed
make[1]: *** [../lmp_mint] Error 1
make[1]: Leaving directory '/home/viktor/Downloads/lammps-20Aug16/src/Obj_mint'
Makefile:132: recipe for target 'mint' failed

make: *** [mint] Error 2

What is wrong? Why I can't build LAMMPS?

My computer is ASUS N56J with Intel Core i7-4700HQ CPU @ 2.40 GHz x 4,
operating system Linux Mint 18 Cinnamon 64-bit.

@kparrish
Copy link
Author

It appears lammps is trying to link to fftw3 and not fftw2, the line:
sudo -u $UserName sed -i -e 's/-DFFT_FFTW3/-DFFT_FFTW2/g' Makefile.mint
should text replace any instances of the compilation flag for fftw3 with fftw2. I would check the makefile and see if it is trying to link to fftw3 at
FFT_INC =

The ubuntu repo does have fftw3 but I haven't been able to successfully link lammps to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment