liu_shaobo

导航

 

LAMMPS 即 Large-scale Atomic/Molecular Massively Parallel Simulator,大规模原子分子并行模拟器,主要用于分子动力学相关的一些计算和模拟工作。
系统: Centos7.6 x86_64

1、安装GCC-7.3

# yum install -y gcc gcc-c++ gcc-gfortran texinfo
# wget http://mirrors.ustc.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
# tar zxvf gcc-7.3.0.tar.gz
# cd gcc-7.3.0
# sh ./contrib/download_prerequisites
# mkdir build && cd build
# ../configure --prefix=/usr/local/gcc-7.3 --disable-bootstrap --enable-languages=c,c++,fortran --disable-multilib
# make -j
# make install
# vim ~/.bashrc
export GCC_HOME=/usr/local/gcc-7.3
export PATH=$GCC_HOME/bin:$PATH
export MANPATH=$GCC_HOME/share/man
export CPATH=$GCC_HOME/include:$CPATH
export LD_LIBRARY_PATH=$GCC_HOME/lib:$GCC_HOME/lib64:LD_LIBRARY_PATH
export LIBRARY_PATH=$GCC_HOME/lib:$GCC_HOME/lib64:LIBRARY_PATH

 

2、安装OpenMPI

# yum install -y gcc gcc-c++ gcc-gfortran
# wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.4.tar.bz2
# tar jxvf openmpi-4.0.4.tar.bz2
# cd openmpi-4.0.4
# mkdir build && cd build
# ../configure --prefix=/usr/local/openmpi-4.0.4 CC=gcc CXX=g++ FC=gfortran F77=gfortran
# make -j
# make install

 

配置OpenMPI环境变量

# vim ~/.bashrc
export PATH=/usr/local/openmpi-4.0.4/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/openmpi-4.0.4/lib:$LD_LIBRARY_PATH
export MANPATH=/usr/local/openmpi-4.0.4/share/man:$MANPATH

 

 

3、安装FFTW

# wget ftp://ftp.fftw.org/pub/fftw/fftw-3.3.8.tar.gz
# tar zxvf fftw-3.3.8.tar.gz
# cd fftw-3.3.8
# mkdir build && cd build
# ../configure --prefix=/usr/local/fftw --enable-mpi --enable-openmp --enable-shared --enable-static
# make -j
# make install
# vim ~/.bashrc
export PATH=/usr/local/fftw/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/fftw/lib:$LD_LIBRARY_PATH

 


4、安装LAMMPS

# yum install libjpeg-devel libpng-devel
# wget https://lammps.sandia.gov/tars/lammps-3Mar20.tar.gz
# tar zxvf lammps-3Mar20.tar.gz
# cd lammps-3Mar20/src
# vim MAKE/Makefile.mpi

配置MPI路径

CC = mpicxx
CCFLAGS = -g -O3 -fopenmp
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpicxx
LINKFLAGS = -g -O3 -fopenmp
MPI_INC = -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1
MPI_PATH =
MPI_LIB = 
LMP_INC = -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64
#LMP_INC = or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL
FFT_INC = -DFFT_FFTW3 -I/usr/local/fftw/include
FFT_PATH = -L/usr/local/fftw/lib
FFT_LIB = -lfftw3

 

安装模块

# make yes-MANYBODY

 

编译LAMMPS

# make -j mpi
# mkdir -p /usr/local/lammps/bin
# cp lmp_mpi /usr/local/lammps/bin/
# vim ~/.bash.rc
export PATH=/usr/local/lammps/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lammps/lib:$LD_LIBRARY_PATH

 

5、并行测试案例

# cd ../examples/shear
# mpirun --allow-run-as-root -np 8 --hostfile hostlist lmp_mpi < in.shear

 

 
posted on 2021-06-19 14:36  liu_shaobo  阅读(401)  评论(0编辑  收藏  举报