Eastsheng's Wiki

Lammps安装

2019-01-22 18:11:28

[toc]

- Windows下Lammps安装

  1. 官网下载Windows版Lammps,和并行包mpich2
    2.下载完成后,直接双击LAMMPS-64bit-stable-MPI.exe安装,可以自定义安装位置;
  2. Similarly,接着安装MPICH2mpich2-1.4.1p1-win-x86-64.msi
  3. 完了之后,进入到Administrator用户下操作,win+R输入cmd,调出cmd窗口;
  4. cd到MPICH2安装目录的bin下,也即是D:\Program Files\MPICH2\bin
  5. 然后,输入命令:smpd.exe -install -phrase behappy
  6. 别忘记设置环境变量,即是将对应的Lammps@MPICH2路径加入到path中:D:\Program Files\LAMMPS 64-bit 7Aug2019-MPI\binD:\Program Files\MPICH2\bin
  7. 怎么设置环境变量:
    • 鼠标右键此电脑;点开高级系统设置;找到高级;点开右下角环境变量(N)
    • 在系统变量下path中找找看,是否已经设置;若没有,点击新建,将路径复制过来,确定即可
  8. 至此,完成,可以进入lammps目录下Examples中测试一下并行;例如:mpiexec -np 8 lmp_mpi -i inputfile.in;具体看官网

- Linux下Lammps并行安装

1. 安装必要的编译器

  • 安装/更新必要的C/C++编译器等:
    1
    2
    3
    4
    5
    6
    sudo apt-get upgrade
    sudo apt-get update
    sudo apt-get install gcc
    sudo apt-get install g++
    sudo apt-get install gfortran
    sudo apt-get install make

2. 并行计算程序MIPCH安装

本地安装
  • 官网MPICH安装包 ,或者https://src.fedoraproject.org/repo/pkgs/mpich/下载并解压:
    1
    2
    3
    4
    5
    6
    wget https://www.mpich.org/static/downloads/4.1.1/mpich-4.1.1.tar.gz
    tar -zxvf mpich-4.1.1.tar.gz
    cd mpich-4.1.1
    ./configure --prefix=/opt/mpich 2>&1|tee c.txt
    make 2>&1|tee m.txt
    make install 2>&1|tee mi.txt
  • 完成MPICH安装,接着把mpich的安装路径添加到环境变量中,参考这里
apt 安装
1
sudo apt-get install mpich
  • 测试:
1
which mpirun # 检查mpi是否添加路径到环境变量
  • 注:若已有mpich,请略过。

3. FFTW3安装

  • Downloading FFTW
  • Installation on Unix
    1
    2
    3
    4
    5
    6
    wget http://www.fftw.org/fftw-3.3.10.tar.gz
    tar -zxvf fftw-3.3.10.tar.gz
    cd fftw-3.3.10
    ./configure # --prefix=/home/xxx/fftw/fftw3310/include (默认/usr/local/include)不能使用相对路径/
    make
    sudo make install

4. LAMMPS安装

  • 下载安装包, 解压:
    1
    2
    wget https://download.lammps.org/tars/lammps-3Mar2020.tar.gz
    tar -zxvf lammps-3Mar2020.tar.gz
  • 进入解压文件夹内:
    1
    cd lammps-3Mar20/src
  • 修改src/MAKE/Makefile.mpi中FFTW路径(可选,若默认安装FFTW路径则无需修改)
1
2
3
FFT_INC =  -DFFT_FFTW3 -I/home/xxx/fftw/fftw3310/include
FFT_PATH = -L/home/xxx/fftw/fftw3310/lib
FFT_LIB = -lfftw3
  • 输入:
1
2
make ps # 或者
make package-status #查看扩展包安装状态
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
Installed  NO: package ASPHERE
Installed NO: package BODY
Installed NO: package CLASS2
Installed NO: package COLLOID
Installed NO: package COMPRESS
Installed NO: package CORESHELL
Installed NO: package DIPOLE
Installed NO: package GPU
Installed NO: package GRANULAR
Installed NO: package KIM
Installed NO: package KOKKOS
Installed NO: package KSPACE
Installed NO: package LATTE
Installed NO: package MANYBODY
Installed NO: package MC
Installed NO: package MESSAGE
Installed NO: package MISC
Installed NO: package MOLECULE
Installed NO: package MPIIO
Installed NO: package MSCG
Installed NO: package OPT
Installed NO: package PERI
Installed NO: package POEMS
Installed NO: package PYTHON
Installed NO: package QEQ
Installed NO: package REPLICA
Installed NO: package RIGID
Installed NO: package SHOCK
Installed NO: package SNAP
Installed NO: package SPIN
Installed NO: package SRD
Installed NO: package VORONOI
  • 输入:
1
2
3
# make yes-xxx #安装所需扩展包
# 常用包一次性安装
make yes-BODY yes-MANYBODY yes-CLASS2 yes-KSPACE yes-MISC yes-MOLECULE yes-RIGID
  • 完成后,输入:
1
2
make mpi 
make mpi -j8 # 8核并行
  • 待编译完成后,LAMMPS就安装成功了。
    • 注意如果提示mpicxx:command not found的错误,是由于mpich的环境变量没有添加成功;
    • 进入lammps-stable/examples中任意测试一个例子;
    • 运行lammps,例如:
    1
    2
    3
    mpirun -np 4 lmp_mpi -i in.atm
    #或
    mpiexec -np 4 lmp_mpi -i in.atm
    • 注意:记得在~/.bashrc中设置/home/.../lammps-stable/src环境变量

[1] https://cloud.tencent.com/developer/article/1484595