软件使用, 生活

Quantum Espresso的安装

Quantum Espresso可以通过命令一键安装:sudo apt install quantum-espresso。

这里提供源文件的安装方法,文件结构会更清晰一些。使用的是gfotran编译,本篇内容参考:https://www.youtube.com/channel/UCgQPek4ZSo_yL7wEjIhxvfA/playlists

具体步骤:

1. 下载.tar.gz源文件:http://www.quantum-espresso.org/

2. 解压:tar -zxvf q-e-qe-6.7MaX-Release.tar.gz

3. 编译:

(1)仅串行编译(建议直接采用后面MPICH并行编译):

  • 安装gfortran:sudo apt install gfortran
  • 配置:./configure,提示配置成功
    编译所有:make all (仅仅编译pw:make pw。如果没有make,则安装:sudo apt install make)
  • 进入文件夹:cd test-suite/
    串行测试:make run-tests-pw-serial(中途可Ctrl+C中断)

(2)使用MPICH并行编译:

  • 安装gfortran:sudo apt install gfortran
  • 提前安装好MPICH:sudo apt install mpich
    测试:mpif90 -v
    之前如果有串行编译过,则需要清除编译文件,仅保留源文件,命令为:make clean
  • 配置:./configure或./configure -enable-parallel,提示配置成功
    编译所有:make all (仅仅编译pw:make pw。如果没有make,则安装:sudo apt install make)
  • 进入文件夹:cd test-suite/
    串行测试:make run-tests-pw-serial(中途可Ctrl+C中断)
    并行测试:make run-tests-pw-parallel(中途可Ctrl+C中断)
  • 串行运行:~/qe-7.0/bin/pw.x < test.in > test.out
    并行运行:mpirun -np 4 ~/qe-7.0/bin/pw.x < test.in > test.out

另外说明:如果安装了gfortran,但mpif90 -v和./configure时仍然找不到gfortran,这可能是由于安装了anaconda的原因,conda环境中的gfortran抢占了sudo apt安装的gfortran,但版本好像不对,导致报错。目前个人的解决方案是:将~/.bashrc中的conda环境变量注释后(类似于卸载anaconda),再继续安装Quantum Espresso。安装完后再把conda的环境变量恢复。

Quantum Espresso添加环境变量:sudo vim /etc/environment,在最后的引号前添加对应的路径,系统重启。

4. 一个例子:

这里的例子也来源于以上的参考资料。

si.scf.in输入文件(需要修改赝势文件位置):

&control
    calculation = 'scf'
    prefix = 'si'
    pseudo_dir = '/home/guanjihuan/qe-7.0/pseudo'
/
&system
    ibrav=2, celldm(1) =10.20, 
    nat=2, ntyp=1,
    ecutwfc=20.0
/
&electrons
/
ATOMIC_SPECIES
 Si  28.086  Si.pz-vbc.UPF
ATOMIC_POSITIONS (alat)
 Si 0.00 0.00 0.00
 Si 0.25 0.25 0.25
K_POINTS (automatic)
  6 6 6 0 0 0

运行命令:

  • 串行运行:~/qe-7.0/bin/pw.x < si.scf.in > si.scf.serial.out
  • 并行运行:mpirun -np 4 ~/qe-7.0/bin/pw.x < si.scf.in > si.scf.parallel.out

使用脚本a.sh(并行):

#!/bin/sh
#PBS -N task
#PBS -l nodes=1:ppn=4
export OMP_NUM_THREADS=4
mpirun -np 4 ~/qe-7.0/bin/pw.x < si.scf.in > si.scf.out

如果是pw.x已经添加到环境变量中,则pw.x可以直接执行:

  • 串行运行:pw.x < si.scf.in > si.scf.serial.out
  • 并行运行:mpirun -np 4 pw.x < si.scf.in > si.scf.parallel.out

使用脚本a.sh(并行):

#!/bin/sh
#PBS -N task
#PBS -l nodes=1:ppn=4
export OMP_NUM_THREADS=4
mpirun -np 4 pw.x < si.scf.in > si.scf.out

5. 更多赝势下载:https://www.quantum-espresso.org/pseudopotentials/

4,480 次浏览

【说明:本站主要是个人的一些笔记和代码分享,内容可能会不定期修改。为了使全网显示的始终是最新版本,这里的文章未经同意请勿转载。引用请注明出处:https://www.guanjihuan.com

4 thoughts on “Quantum Espresso的安装”

  1. 大佬,想问一下安装过程中make all之后出现这种情况怎么解决啊

    --2022-02-25 17:14:41-- https://gitlab.com/max-centre/components/devicexlib/-/a
    rchive/0.1.0/devicexlib-0.1.0.tar.gz
    Resolving gitlab.com (gitlab.com)... 172.65.251.78, 2606:4700:90:0:f22e:fbec:5bed:a9b9
    Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... failed: Connection timed out.
    Connecting to gitlab.com (gitlab.com)|2606:4700:90:0:f22e:fbec:5bed:a9b9|:443... failed: Network is unreachable.
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- 0:02:07 --:--:-- 0curl: (7) Failed to connect to 2606:4700:90:0:f22e:fbec:5bed:a9b9: Network is unreachable

    gzip: stdin: unexpected end of file
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    make[2]: Entering directory `/home/bysj/tzwei/QE/qe-7.0/external/devxlib'
    make[2]: *** No rule to make target `clean'. Stop.
    make[2]: Leaving directory `/home/bysj/tzwei/QE/qe-7.0/external/devxlib'
    /bin/sh: line 9: ./configure: No such file or directory
    make[2]: Entering directory `/home/bysj/tzwei/QE/qe-7.0/external/devxlib'
    make[2]: *** No rule to make target `all'. Stop.
    make[2]: Leaving directory `/home/bysj/tzwei/QE/qe-7.0/external/devxlib'
    make[1]: *** [libcuda_devxlib] Error 2
    make[1]: Leaving directory `/home/bysj/tzwei/QE/qe-7.0/install'
    make: *** [libcuda] Error 2

    1. 我也不清楚,忘了当时有没有遇到这个问题了。可以查下configure这个文件,或者清理后从头操作一遍,或者别处看看有没有解决方法。

    1. 这个目前还没怎么去研究,之后如果有了解可能会写。我这边贴出的都是偏简要的内容,建议还是阅读下相关的文章或者综述文献,收获会更多些。

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Captcha Code