在 CentOS 7.x 上安装 LAMMPS

假设你具有 sudo 所赋的权限

安装 MPICH-3.2 cmake3 libfabric-devel


yum -y install mpich-3.2 mpich-3.2-devel cmake3 libfabric-devel

修改动态库


vi /etc/ld.so.conf.d/mpich.conf

将以下写入文件中


/usr/lib64/mpich-3.2/lib

添加 usr/local/lib64 库目录

vi /etc/ld.so.conf.d/lib_local.conf


/usr/local/lib64

然后退出,并重新加载


sudo ldconfig

export MPICH=/usr/lib64/mpich-3.2 # 设置环境变量

安装 ADIOS


git clone https://github.com/ornladios/ADIOS2.git ADIOS2

mkdir adios2-build && cd adios2-build
cmake3 -D ADIOS2_USE_MPI=on -D MPI_CXX_COMPILER=$MPICH/bin/mpicxx \
       -D MPI_Fortran_COMPILER=$MPICH/bin/mpifort \
       -D MPI_C_COMPILER=$MPICH/bin/mpicc ../ADIOS2

make -j8
sudo make install

安装 LAMMPS

下载 lammps

使用 cmake 配置 lammps


export MPICH=/usr/lib64/mpich-3.2 # 设置环境变量
cmake3 -D BUILD_SHARED_LIBS=yes -D BUILD_MPI=yes -D MPI_CXX_COMPILER=$MPICH/bin/mpicxx \
-D MPI_Fortran_COMPILER=$MPICH/bin/mpifort -D  MPI_C_COMPILER=$MPICH/bin/mpicc \
-D LAMMPS_MACHINE=mpi -C ../cmake/presets/all_on.cmake -C ../cmake/presets/nolib.cmake  \
-D CMAKE_INSTALL_PREFIX=/usr/local/lammps -D PKG_ADIOS2=yes \
-D PKG_VORONOI=yes -D PKG_USER-ADIOS=yes ../cmake

编译 lammps


make -j8

安装 lammps


sudo make install

修改路径

设置全局路径

sudo vi /etc/profile.d/lammps.sh


# set LAMMPS enviroment

LAMMPS_DIR=/usr/local/lammps

PATH=$LAMMPS_DIR/bin:$PATH

export LAMMPS_DIR PATH

保存,退出。

然后重开一个新的窗口。就可以执行 lmp_mpi 了。

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.