LAMMPS 安装
LAMMPS 安装
LAMMPS 所有版本:LAMMPS Source Download Repository
GitHub - njzjz/lammps-wheel: LAMMPS unofficial Python wheels on PyPi, `pip install lammps`
Lammps installation - Jia-Xin Zhu
用 Intel® 加速 LAMMPS - Jinzhe Zeng’s Blog
[Linux 软件安装⑥ | LAMMPS - Jinzhe Zeng’s Blog](https://njzjz.win/2018/06/16/installlammps/) |
cmake 编译
适用于较新版本的 LAMMPS
most.cmake 安装的 package 数目:64 all_on.cmake 安装的 package 数目:92 oneapi.cmake 和 intel.cmake 不会安装 package
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
wget https://download.lammps.org/tars/lammps-2Aug2023.tar.gz
tar -xzvf lammps-2Aug2023.tar.gz
cd lammps-2Aug2023
# 导入 oneAPI 套件
module purge
module load intel-oneapi-compilers/2021.4.0
module load intel-oneapi-mkl/2021.4.0
module load intel-oneapi-mpi/2021.4.0
# 建议再导入该 oneAPI 模块
module load intel-oneapi-tbb/2021.4.0
# Pi 上建议再 load 以下模块
module load gcc/11.2.0
module load cmake/3.26.3-gcc-11.2.0
# 创建 build 路径并配置编译选项
# 只含 一些基础的 packages
mkdir build-basic && cd build-basic
cmake -C ../cmake/presets/basic.cmake ../cmake
# 含 大部分的 packages
mkdir build-most && cd build-most
cmake -C ../cmake/presets/most.cmake ../cmake
make
cmake 配置好 Makefile 文件之后,查看输出到屏幕的
-- Enabled packages
参数进行检验
示例
1
2
3
4
5
-- Enabled packages: <None>
-- Enabled packages: KSPACE;MANYBODY;MOLECULE;RIGID
-- Enabled packages: AMOEBA;ASPHERE;BOCS;BODY;BPM;BROWNIAN;CG-DNA;CG-SPICA;CLASS2;COLLOID;COLVARS;CORESHELL;DIELECTRIC;DIFFRACTION;DIPOLE;DPD-BASIC;DPD-MESO;DPD-REACT;DPD-SMOOTH;DRUDE;EFF;EXTRA-COMPUTE;EXTRA-DUMP;EXTRA-FIX;EXTRA-MOLECULE;EXTRA-PAIR;FEP;GRANULAR;INTEL;INTERLAYER;KSPACE;MANIFOLD;MANYBODY;MC;MEAM;MESONT;MGPT;MISC;ML-IAP;ML-POD;ML-RANN;ML-SNAP;MOFFF;MOLECULE;OPENMP;OPT;ORIENT;PERI;PHONON;PLUGIN;POEMS;PTM;QEQ;QTB;REACTION;REAXFF;REPLICA;RIGID;SHOCK;SMTBQ;SPH;SPIN;SRD;TALLY;UEF;YAFF
查看已编译安装的 packages
1
2
# 显示已编译的 LAMMPS 版本的所有信息
lmp -h
取消使用 JPEG 选项:-D WITH_JPEG=off
(cmake 配置编译选项时会自动检查)
- 思源一号用 oneapi.cmake 编译选项,其中的 MPI 是 MPI STUBS,而非 intel 的 MPI(2024.03.16)
make 编译
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
cd src
# 查看 make 所有选项
make
make clean-all
make yes-<package>
make yes-all # install all packages
make no-lib # uninstall packages that require extra libraries
make package-update
# 编译串行版本
make serial
# 编译并行版本
make mpi
MC2 LAMMPS 版本编译
- LAMMPS 版本:22Aug2018
- gibbs_multireplica.ccp 和 gibbs_multireplica.h 需要用到 LAPACK,使用
make intel_cpu
命令,由于 master、超算无 libjpeg 库,因此需修改/注释 Makefile.intel_cpu(文件路径:MAKE/OPTION
) 中的 jpeg 相关选项(共 4 处)
1
2
3
4
5
6
7
8
9
wget https://download.lammps.org/tars/lammps-22Aug2018.tar.gz
# 修改/注释 jpeg 相关选项
LMP_INC = -DLAMMPS_GZIP
# LMP_INC = -DLAMMPS_GZIP -DLAMMPS_JPEG
# JPG_INC =
# JPG_PATH =
# JPG_LIB = -ljpeg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 检查是否已安装 libjpeg
dpkg -l | grep -i 'libjpeg' # Ubuntu
rpm -qa | grep -i 'libjpeg' # Centos
yum list installed | grep -i 'libjpeg' # Centos
# 安装 libjpeg
sudo apt install libjpeg-dev
# 导入 oneAPI 套件
module purge
module load intel-oneapi-compilers/2021.4.0
module load intel-oneapi-mpi/2021.4.0
module load intel-oneapi-mkl/2021.4.0
# 未导入该模块会报错
module load intel-oneapi-tbb/2021.4.0
cd src/
# 第一次编译
make clean-all
make yes-misc
make yes-user-misc
make yes-user-meamc
make yes-mc
make yes-replica
make yes-manybody
make package-update
make intel_cpu
# 复制 gibbs_multireplica.ccp 及头文件到 USER-MISC 目录
# 第二次编译
make package-update
make intel_cpu
相关报错
make mpi
编译报错:对dgelsd_
(LAPACK 里的东西 ) 未定义的引用;改用make intel_cpu
1
2
3
4
/usr/bin/ld: gibbs_multireplica.o: in function `LAMMPS_NS::GibbsMultiReplica::inverse(double*, double*, double*, double)':
/home/yangsl/src/lammps-22Aug18-MC2/src/Obj_mpi/../gibbs_multireplica.cpp:2871: undefined reference to `dgelsd_'
/usr/bin/ld: /home/yangsl/src/lammps-22Aug18-MC2/src/Obj_mpi/../gibbs_multireplica.cpp:2876: undefined reference to `dgelsd_'
collect2: error: ld returned 1 exit status
- 没有 libjpeg 库:修改/注释 Makefile.intel_cpu 中的 JPEG 相关选项(共 4 处)
1
2
3
4
5
../image.cpp(32): catastrophic error: cannot open source file "jpeglib.h"
#include "jpeglib.h"
^
compilation aborted for ../image.cpp (code 4)
1
ld: cannot find -ljpeg: No such file or directory
macOS 安装 LAMMPS GUI
限制较多(without MPI support),不推荐
This post is licensed under
CC BY 4.0
by the author.