環境構築 | バンド構造の描画(ログ)| Si | 240823

参照先(環境構築(インストール))

quantumespresso [雑多な記録]
quantumespresso:インストール方法_7.3 [雑多な記録]

登録

ダウンロード

インストールログ(公式ページ経由)

$ pwd
~
$ wget https://www.quantum-espresso.org/rdm-download/488/v7-3-1/2ba102956804a437874015548b57fbc6/qe-7.3.1-ReleasePack.tar.gz

--2024-08-23 16:57:10--  https://www.quantum-espresso.org/rdm-download/488/v7-3-1/2ba102956804a437874015548b57fbc6/qe-7.3.1-ReleasePack.tar.gz
Resolving www.quantum-espresso.org (www.quantum-espresso.org)... 51.77.118.191
Connecting to www.quantum-espresso.org (www.quantum-espresso.org)|51.77.118.191|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 86715189 (83M) [application/gzip]
Saving to: 'qe-7.3.1-ReleasePack.tar.gz'

qe-7.3.1-ReleasePack.tar.gz         100%[===================================================================>]  82.70M   997KB/s    in 3m 12s

2024-08-23 17:00:24 (441 KB/s) - 'qe-7.3.1-ReleasePack.tar.gz' saved [86715189/86715189]

解凍する。

$ tar -xzvf qe-7.3.1-ReleasePack.tar.gz
$ cd qe-7.3.1

$ ls -CF
CMakeLists.txt   EPW/      KCW/         Makefile  PW/            TDDFPT/    atomic/     dft-d3/                logo.jpg
CONTRIBUTING.md  FFTXlib/  KS_Solvers/  Modules/  PWCOND/        UtilXlib/  bin/        environment_variables  pseudo/
COUPLE/          GUI/      LAXlib/      NEB/      QEHeat/        XClib/     cmake/      external/              test-suite/
CPV/             GWW/      LR_Modules/  PHonon/   README.md      XSpectra/  configure*  include/               upflib/
Doc/             HP/       License      PP/       README_GPU.md  archive/   dev-tools/  install/

インストールに必要な設定を確認。

GNUコンパイラを使う場合

gfortran、gcc、mpif90のインストールを済ませておく。

$ ./configure F90=gfortran F77=gfortran CC=gcc MPIF90=mpif90 --enable-openmp --enable-parallel

(略)
--------------------------------------------------------------------
configure: success

Intel OneAPIを使う場合

mpiifort、ifort、iccのインストールを済ませておく。

$ ./configure MPIF90=mpiifort F90=ifort F77=ifort CC=icc --enable-openmp --enable-parallel --with-scalapack=intel

(略)
--------------------------------------------------------------------
configure: success



$ make all
test -d bin || mkdir bin
( cd UtilXlib ; make TLDEPS= all || exit 1 )
make[1]: Entering directory '/home/morii-k/qe-7.3.1/UtilXlib'
mpiifort -O3 -g -fopenmp -cpp -fopenmp -D__FFTW  -I/home/morii-k/qe-7.3.1//external/devxlib/src -I. -I/home/morii-k/qe-7.3.1//include -I. -c parallel_include.f90
make[1]: mpiifort: No such file or directory
make[1]: *** [../make.inc:16: parallel_include.o] Error 127
make[1]: Leaving directory '/home/morii-k/qe-7.3.1/UtilXlib'
make: *** [Makefile:209: libutil] Error 1

原因を調査すると、、、

$ which mpif90
/usr/bin/mpif90
$ which mpifort
/usr/bin/mpifort
$ which mpiifort

mpiifortが見つからない。→インストールする。

1.1 Intel oneAPI HPC Toolkitのインストール:

Access Denied

1. To add APT repository access, install the prerequisites:

    $ sudo apt update
    $ sudo apt install -y gpg-agent wget

    2. Set up the repository. To do this, download the key to the system keyring:

    $ wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | $ gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null

    3. Add the signed entry to APT sources and configure the APT client to use the Intel repository:

    $ echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
    
    deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main

    4.   Update the packages list and repository index.

    $ sudo apt update

    5.  Download the following from APT

    $ sudo apt install intel-hpckit

    現環境では、10分弱程度かかった。

    1.2 環境変数の設定:

    $ source /opt/intel/oneapi/setvars.sh
    
    :: initializing oneAPI environment ...
       -bash: BASH_VERSION = 5.1.16(1)-release
       args: Using "$@" for setvars.sh arguments:
    :: advisor -- latest
    :: ccl -- latest
    :: compiler -- latest
    :: dal -- latest
    :: debugger -- latest
    :: dev-utilities -- latest
    :: dnnl -- latest
    :: dpcpp-ct -- latest
    :: dpl -- latest
    :: ipp -- latest
    :: ippcp -- latest
    :: mkl -- latest
    :: mpi -- latest
    :: tbb -- latest
    :: vtune -- latest
    :: oneAPI environment initialized ::

    1.3 インストールの確認:

    $ which mpiifort
    /opt/intel/oneapi/mpi/2021.13/bin/mpiifort
    
    $ mpiifort --version
    ifort: remark #10448: Intel(R) Fortran Compiler Classic (ifort) is now deprecated and will be discontinued late 2024. Intel recommends that customers transition now to using the LLVM-based Intel(R) Fortran Compiler (ifx) for continued Windows* and Linux* support, new language support, new language features, and optimizations. Use '-diag-disable=10448' to disable this message.
    ifort (IFORT) 2021.13.0 20240602
    Copyright (C) 1985-2024 Intel Corporation.  All rights reserved.

    1.4 .bashrcへの追加(オプション):

    毎回環境変数を設定する手間を省くため、.bashrcファイルに以下の行を追加することができます:

    $ echo 'source /opt/intel/oneapi/setvars.sh' >> ~/.bashrc

    1.5 システム再起動または新しいシェルセッションの開始:

    変更を反映させるため、システムを再起動するか新しいターミナルセッションを開始します。

    再度、インストール

    $ make all
    test -d bin || mkdir bin
    ( cd UtilXlib ; make TLDEPS= all || exit 1 )
    make[1]: Entering directory '/home/morii-k/qe-7.3.1/UtilXlib'
    icc -O3 -D__FFTW -I. -I/home/morii-k/qe-7.3.1//include   -c cptimer.c
    make[1]: icc: No such file or directory
    make[1]: *** [../make.inc:19: cptimer.o] Error 127
    make[1]: Leaving directory '/home/morii-k/qe-7.3.1/UtilXlib'
    make: *** [Makefile:209: libutil] Error 1

    iccがインストールされていないごとが原因らしい。

    インストール(成功版)

    GNUコンパイラを使ってインストール

    $ ./configure F90=gfortran F77=gfortran CC=gcc MPIF90=mpif90 --enable-openmp --enable-parallel
    
    (略)
    --------------------------------------------------------------------configure: success
    
    
    $ make all

    現環境では、10分弱でインストールができた模様。

    コンパイルが終了したら、ホーム・ディレクトリにある.bashrc を編集

    $ gedit ~/.bashrc

    でファイルを開き、ファイルの一番最後の行に次の一文を追記。

    export PATH=$PATH:$HOME/qe-7.3.1/bin

    ファイルを保存、終了して端末に戻り、 .bashrc を読み込んでインストールが完了。

    $ source ~/.bashrc
    
    
    :: WARNING: setvars.sh has already been run. Skipping re-execution.
       To force a re-execution of setvars.sh, use the '--force' option.
       Using '--force' can result in excessive use of your environment variables.
    
    usage: source setvars.sh [--force] [--config=file] [--help] [...]
      --force        Force setvars.sh to re-run, doing so may overload environment.
      --config=file  Customize env vars using a setvars.sh configuration file.
      --help         Display this help message and exit.
      ...            Additional args are passed to individual env/vars.sh scripts
                     and should follow this script's arguments.
    
      Some POSIX shells do not accept command-line options. In that case, you can pass
      command-line options via the SETVARS_ARGS environment variable. For example:
    
      $ SETVARS_ARGS="ia32 --config=config.txt" ; export SETVARS_ARGS
      $ . path/to/setvars.sh
    
      The SETVARS_ARGS environment variable is cleared on exiting setvars.sh.

    インストールログ(途中で中断ver)

    $ git clone https://github.com/QEF/q-e.git
    Cloning into 'q-e'...
    remote: Enumerating objects: 196459, done.
    remote: Counting objects: 100% (18469/18469), done.
    remote: Compressing objects: 100% (5348/5348), done.
    remote: Total 196459 (delta 13361), reused 18085 (delta 13102), pack-reused 177990 (from 1)
    Receiving objects: 100% (196459/196459), 781.47 MiB | 1.65 MiB/s, done.
    Resolving deltas: 100% (157690/157690), done.
    Updating files: 100% (6619/6619), done.
    $ cd q-e
    $ ls -CF
    CMakeLists.txt   EPW/      KCW/         Makefile  PW/            TDDFPT/    atomic/     environment_variables  pseudo/
    CONTRIBUTING.md  FFTXlib/  KS_Solvers/  Modules/  PWCOND/        UtilXlib/  cmake/      external/              test-suite/
    COUPLE/          GUI/      LAXlib/      NEB/      QEHeat/        XClib/     configure*  include/               upflib/
    CPV/             GWW/      LR_Modules/  PHonon/   README.md      XSpectra/  dev-tools/  install/
    Doc/             HP/       License      PP/       README_GPU.md  archive/   dft-d3/     logo.jpg

    Quantum ESPRESSOのインストールに必要な設定。

    $ ./configure F90=gfortran F77=gfortran CC=gcc MPIF90=mpif90 --enable-openmp --enable-parallel  $ GNUコンパイラ
    $ ./configure MPIF90=mpiifort F90=ifort F77=ifort CC=icc --enable-openmp --enable-parallel --with-scalapack=intel   # Intel OneAPI
    $ make all

    参照先

    quantumespresso:半導体 [雑多な記録]

    quantumespresso:半導体 [雑多な記録]

    過去ログ

    トレース計算(ログ)

    バンド計算

    入力ファイルの作成

    作業場所の確認。

    $ pwd
    ~/qe-7.3.1
    
    $ mkdir Si
    $ cd Si

    ディレクトリSiの中に次のファイルを作成。

    $ touch Si.scf.in

    以下のように、内容を書き込んで保存。

    ただし、 pseudo_dirを現環境に合わせて書き換える。

    $ cat Si.scf.in
    &control
      prefix      = 'Si',
      calculation = 'scf',
      pseudo_dir  = '../pseudo/',
      outdir      = './tmp/',
    /
    &system
      ibrav = 2, celldm(1) = 10.26, nat = 2, ntyp = 1,
      ecutwfc = 12.0,
    /
    &electrons
      conv_thr = 1.0d-8
    /
    ATOMIC_SPECIES
     Si 28.086 Si.pz-vbc.UPF
    ATOMIC_POSITIONS
     Si 0.00 0.00 0.00
     Si 0.25 0.25 0.25
    K_POINTS automatic
     6 6 6 1 1 1

    擬ポテンシャルのダウンロード

    PSlibrary - QUANTUMESPRESSO
    Grav is an easy to use, yet powerful, open source flat-file CMS
    Pseudo search results - QUANTUMESPRESSO
    Grav is an easy to use, yet powerful, open source flat-file CMS

    $ wget -P ../pseudo/ https://pseudopotentials.quantum-espresso.org/upf_files/Si.pz-vbc.UPF
    
    $ ls ../pseudo/ | grep Si
    Si.bhs
    Si.pz-vbc.UPF
    Si_r.upf

    scf計算の実行

    $ pw.x < Si.scf.in > Si.scf.out
    $ ls -CF
    Si.scf.in  Si.scf.out  tmp/
    $ grep -e 'estimated scf' Si.scf.out
         estimated scf accuracy    <       0.05703855 Ry
         estimated scf accuracy    <       0.00213906 Ry
         estimated scf accuracy    <       0.00006042 Ry
         estimated scf accuracy    <       0.00000095 Ry
         estimated scf accuracy    <       0.00000010 Ry
         estimated scf accuracy    <          2.2E-09 Ry
    $ grep -e 'highest' Si.scf.out
         highest occupied level (ev):     5.9659

    特定のk点におけるエネルギー

    $ wget -P ../pseudo/ https://pseudopotentials.quantum-espresso.org/upf_files/Si.pbe-rrkj.UPF
    
    # 確認
    $ ls ../pseudo/ | grep Si
    Si.bhs
    Si.pbe-rrkj.UPF
    Si.pz-vbc.UPF
    Si_r.upf
    $ cat Si.bands.in
    &control
      prefix = 'Si',
      calculation = 'bands',
      pseudo_dir = '../pseudo/',
      outdir = './tmp/',
    /
    &system
      ibrav = 2, celldm(1) = 10.26, nat = 2, ntyp = 1,
      ecutwfc = 12.0, nbnd = 8
    /
    &electrons
      conv_thr = 1.0d-8
    /
    ATOMIC_SPECIES
     Si 28.086 Si.pbe-rrkj.UPF
    ATOMIC_POSITIONS
     Si 0.00 0.00 0.00
     Si 0.25 0.25 0.25
    K_POINTS
     3
     0.0 0.0 0.0 1
     1.0 0.0 0.0 2
     0.5 0.5 0.5 3
    $ pw.x < Si.bands.in > Si.bands.out

    バンド構造のプロット

    $ cat Si.bands.in
    &control
      prefix = 'Si',
      calculation = 'bands',
      pseudo_dir = './pseudo/',
      outdir = './tmp/',
    /
    &system
      ibrav = 2, celldm(1) = 10.26, nat = 2, ntyp = 1,
      ecutwfc = 12.0, nbnd = 8
    /
    &electrons
      conv_thr = 1.0d-8
    /
    ATOMIC_SPECIES
     Si 28.086 Si.pbe-rrkj.UPF
    ATOMIC_POSITIONS
     Si 0.00 0.00 0.00
     Si 0.25 0.25 0.25
    K_POINTS tpiba_b
     5
     0.5  0.5  0.5   5
     0.0  0.0  0.0  10
     0.0  0.0  1.0  10
     0.0  1.0  1.0  10
     0.0  0.0  0.0   0

    PWscfを使ってエネルギー分散を計算

    $ pw.x < Si.bands.in > Si.bands.out

    バンド構造をプロットするために必要なファイルを作成

    $ cat bands.in
    &bands
      prefix = 'Si',
      outdir = './tmp/',
      filband = 'bands.dat',
    /
    $ bands.x < bands.in > bands.out

    $ plotband.x
         Input file > bands.dat
    Reading    8 bands at     36 k-points
    Range:   -5.6510   16.3840eV  Emin, Emax, [firstk, lastk] > -7.0 14.0
    high-symmetry point:  0.5000 0.5000 0.5000   x coordinate   0.0000
    high-symmetry point:  0.0000 0.0000 0.0000   x coordinate   0.8660
    high-symmetry point:  0.0000 0.0000 1.0000   x coordinate   1.8660
    high-symmetry point:  0.0000 0.5000 1.0000   x coordinate   2.3660
    high-symmetry point:  0.0000 1.0000 1.0000   x coordinate   2.8660
    high-symmetry point:  0.0000 0.0000 0.0000   x coordinate   4.2802
    output file (gnuplot/xmgr) > Si.bands.xmgr
    bands in gnuplot/xmgr format written to file Si.bands.xmgr
    
    
    output file (ps) > Si.bands.ps
    Efermi > 4.4741
    deltaE, reference E (for tics) 1.0 4.4741
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
       SPLINT WARNING: xfit(i) > xspline(nspline)   1.86602569       1.86602557
    bands in PostScript format written to file Si.bands.ps

    Si.bands.psをJPG形式のSi.bands.ps.jpgに、ImageMagickを用いて変換。

    $ convert Si.bands.ps Si.bands.ps.jpg
    $ explorer.exe Si.bands.ps.jpg

    コメント

    タイトルとURLをコピーしました