網頁

2018年9月14日 星期五

ubuntu lammps install easily

1. 安裝前所需套件
$ sudo apt update
$ sudo apt-get install gcc
$ sudo apt-get install g++
$ sudo apt-get install gfortran
$ sudo apt-get install make
$ sudo apt-get install mpi-default-*
$ sudo apt-get install libfftw3-dev
$ sudo apt-get install libjpeg-dev
$ sudo apt-get install libpng16-dev
$ sudo apt-get install libpng-dev

2. 下載Lammps
https://lammps.sandia.gov/download.html
下載到家目錄

3. 安裝meam
$ cd /home/chiustin/lammps-12Dec18/lib/meam
$ sudo make -f Makefile.gfortran clean
$ sudo make -f Makefile.gfortran

參考
https://github.com/lammps/lammps/tree/master/lib/meam

4. 安裝reax
$ cd /home/chiustin/lammps-12Dec18/lib/reax
$ sudo make -f Makefile.gfortran

參考
https://lammps.sandia.gov/threads/msg66213.html
https://lammps.sandia.gov/threads/msg62170.html

5. 安裝voronoi
$ cd /home/chiustin/lammps-12Dec18/lib/voronoi
$ wget http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz
$ tar -xvf voro++-0.4.6.tar.gz
$ cd voro++-0.4.6
$ make clean
$ sudo make
$ sudo make install
$ cd /home/chiustin/lammps-12Dec18/lib/voronoi
$ gedit Makefile.lammps
$ voronoi_SYSINC = -I/usr/local/include/voro++
$ voronoi_SYSLIB = -lvoro++
$ voronoi_SYSPATH = -L/usr/local/lib

參考
https://github.com/lammps/lammps/tree/master/lib/voronoi

6. 安裝fftw
$ cd
http://www.fftw.org/download.html or
$ wget http://www.fftw.org/fftw-3.3.8.tar.gz
$ tar -xvf fftw-3.3.8.tar.gz
$ cd fftw-3.3.8/
$ sudo ./configure --prefix=/usr/local --enable-float
(for Mac ./configure --prefix=/usr/local --enable-float --enable-threads
參考 http://www.fftw.org/install/mac.html)
$ sudo make -j4
$ sudo make install
$ cd /home/chiustin/lammps-12Dec18/src/MAKE/OPTIONS/
$ vi Makefile.fftw
確認
FFT_INC = -DFFT_FFTW3 -I/usr/local/include
FFT_PATH = -L/usr/local/lib
FFT_LIB = -lfftw3

參考
https://zhuanlan.zhihu.com/p/36457551

7. 安裝mpich
$ cd
$ wget http://www.mpich.org/static/downloads/3.3/mpich-3.3.tar.gz
$ tar -xvf mpich-3.3.tar.gz
$ cd mpich-3.3/
$ sudo ./configure --prefix=/usr/local
$ sudo make -j4
$ sudo make install
$ cd /home/chiustin/lammps-12Dec18/src/MAKE/OPTIONS
$ vi Makefile.g++_mpich_link
確認
MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I/usr/local/include
MPI_PATH = -L/usr/local/lib
MPI_LIB = -lmpi -lmpl -lpthread

參考
https://zhuanlan.zhihu.com/p/36457551

8. 選擇套件
$ cd /home/chiustin/lammps-12Dec18/src
$ make yes-meam
$ make yes-voronoi
$ make yes-class2
$ make yes-manybody
$ make yes-molecule
$ make yes-dipole
$ make yes-USER-DRUDE
$ make yes-RIGID
$ make yes-reax
$ make yes-user-reaxc

$ make package-status 可以看哪些package沒安裝

9. 編譯binary
$ cd /home/chiustin/lammps-12Dec18/src/MAKE/MACHINES
$ cp Makefile.ubuntu ../
$ cd /home/chiustin/lammps-12Dec18/src
$ sudo make ubuntu
$ sudo make mpi -j4
$ sudo make serial -j4

for Mac
$ cd /home/chiustin/lammps-12Dec18/src/MAKE/MACHINES
$ cp Makefile.mac ../
$ cp Makefile.mac_mpi ../
$ vi Makefile. mac_mpi

CC =        /usr/local/bin/mpic++
CCFLAGS =   -O3
SHFLAGS =   -fPIC
DEPFLAGS =  -M

LINK =      /usr/local/bin/mpic++
LINKFLAGS = -O3
LIB =
SIZE =      size

$ cd /home/chiustin/lammps-12Dec18/src
$ sudo make mac
$ sudo make mac_mpi

10. 環境變數
$ sudo cp lmp_ubuntu /usr/local/bin
$ sudo cp lmp_mpi /usr/local/bin
$ sudo cp lmp_serial /usr/local/bin
$ sudo vim /etc/profile
$ export PATH=/usr/local/bin:$PATH
$ source /etc/profile
$ which lmp_ubuntu
$ which lmp_mpi
$ which lmp_serial

10. 測試
$ cd /home/chiustin/lammps-12Dec18/examples/shear
$ mpirun -np 3 lmp_ubuntu < in.shear
$ lmp_ubuntu < in.shear
$ mpirun -np 3 lmp_mpi < in.shear
$ lmp_serial < in.shear

參考
http://i.youku.com/simuly#opennewwindow

沒有留言:

張貼留言