Quantum ESPRESSO

Description

According to the page of Quantum ESPRESSO, it is an integrated suite of open-source computational codes for electronic structure calculations and nanoscale materials modeling, based on density functional theory (DFT), plane waves, and pseudopotentials.

Available Versions

  • quantum-espresso/6.1 (default)

  • quantum-espresso/6.6

  • quantum-espresso/7.2

  • quantum-espresso/7.5/mpi

  • quantum-espresso/7.5/serial

Loading the Module

# Serial version
module load quantum-espresso/7.5/serial

# MPI version
module load quantum-espresso/7.5/mpi

# Environment variables
echo $PW_EXE   # Path to pw.x

Serial Job Submission

submit_qe_serial.sh
#!/bin/bash
#SBATCH -J qe_serial
#SBATCH -N 1
#SBATCH -n 1
#SBATCH -t 24:00:00
#SBATCH --mem=8G

export INPUT="si.scf.in"
export OUTPUT="si.scf.out"

module load quantum-espresso/7.5/serial

job-nanny pw.x -inp si.scf.in > si.scf.out

MPI Job Submission

submit_qe_mpi.sh
#!/bin/bash
#SBATCH -J qe_mpi
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 48:00:00
#SBATCH --mem-per-cpu=2G

export INPUT="si.bands.in"
export OUTPUT="si.bands.out"

module load quantum-espresso/7.5/mpi

job-nanny mpirun -np $SLURM_NTASKS pw.x -inp si.bands.in > si.bands.out

Example Input File (SCF)

si.scf.in
&CONTROL
  calculation = 'scf'
  restart_mode = 'from_scratch'
  prefix = 'silicon'
  pseudo_dir = './pseudos'
  outdir = './tmp'
  tprnfor = .true.
  tstress = .true.
/

&SYSTEM
  ibrav = 2
  celldm(1) = 10.20
  nat = 2
  ntyp = 1
  ecutwfc = 30.0
  occupations = 'smearing'
  smearing = 'gaussian'
  degauss = 0.01
/

&ELECTRONS
  conv_thr = 1.0e-8
  mixing_beta = 0.7
/

ATOMIC_SPECIES
  Si  28.086  Si.pbe-n-rrkjus_psl.0.1.UPF

ATOMIC_POSITIONS (alat)
  Si  0.00  0.00  0.00
  Si  0.25  0.25  0.25

K_POINTS (automatic)
  8 8 8 0 0 0

Band Structure Calculation

submit_qe_bands.sh
#!/bin/bash
#SBATCH -J qe_bands
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 36:00:00
#SBATCH --mem-per-cpu=2G

export INPUT="si.bands.in"
export OUTPUT="si.bands.out"

module load quantum-espresso/7.5/mpi

# Step 1: SCF calculation
job-nanny mpirun -np $SLURM_NTASKS pw.x -inp si.scf.in > si.scf.out

# Step 2: Band calculation
job-nanny mpirun -np $SLURM_NTASKS pw.x -inp si.bands.in > si.bands.out

# Step 3: Post-processing
job-nanny bands.x -inp si.bands.in > si.bands.dat
si.bands.in
&CONTROL
  calculation = 'bands'
  restart_mode = 'restart'
  prefix = 'silicon'
  pseudo_dir = './pseudos'
  outdir = './tmp'
/

&SYSTEM
  ibrav = 2
  celldm(1) = 10.20
  nat = 2
  ntyp = 1
  ecutwfc = 30.0
/

&ELECTRONS
  conv_thr = 1.0e-8
/

ATOMIC_SPECIES
  Si  28.086  Si.pbe-n-rrkjus_psl.0.1.UPF

ATOMIC_POSITIONS (alat)
  Si  0.00  0.00  0.00
  Si  0.25  0.25  0.25

K_POINTS (tpiba_b)
  8
  gamma 20
  L 20
  gamma 30
  X 20
  W 20
  L 20
  K 20
  gamma 20

Vibrational Properties Calculation

submit_qe_ph.sh
#!/bin/bash
#SBATCH -J qe_ph
#SBATCH -N 4
#SBATCH --ntasks-per-node=28
#SBATCH -t 72:00:00
#SBATCH --mem-per-cpu=2G

export INPUT="si.ph.in"
export OUTPUT="si.ph.out"

module load quantum-espresso/7.5/mpi

# Step 1: SCF calculation (if not done)
# mpirun -np $SLURM_NTASKS pw.x -inp si.scf.in > si.scf.out

# Step 2: Phonon calculation
job-nanny mpirun -np $SLURM_NTASKS ph.x -inp si.ph.in > si.ph.out

# Step 3: Post-processing (dynamat)
job-nanny dynmat.x -inp si.dynmat.in > si.dynmat.out
si.ph.in
&INPUTPH
  tr2_ph = 1.0e-14
  prefix = 'silicon'
  outdir = './tmp'
  fildyn = 'si.dyn'
  ldisp = .true.
  nq1 = 4, nq2 = 4, nq3 = 4
/

Geometry Optimization

submit_qe_vc-relax.sh
#!/bin/bash
#SBATCH -J qe_vcrelax
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 48:00:00
#SBATCH --mem-per-cpu=2G

export INPUT="si.vcrelax.in"
export OUTPUT="si.vcrelax.out"

module load quantum-espresso/7.5/mpi

job-nanny mpirun -np $SLURM_NTASKS pw.x -inp si.vcrelax.in > si.vcrelax.out
si.vcrelax.in
&CONTROL
  calculation = 'vc-relax'
  restart_mode = 'from_scratch'
  prefix = 'silicon'
  pseudo_dir = './pseudos'
  outdir = './tmp'
  tprnfor = .true.
  tstress = .true.
/

&SYSTEM
  ibrav = 2
  celldm(1) = 10.20
  nat = 2
  ntyp = 1
  ecutwfc = 30.0
  occupations = 'smearing'
  smearing = 'gaussian'
  degauss = 0.01
/

&ELECTRONS
  conv_thr = 1.0e-8
  mixing_beta = 0.7
/

&IONS
  ion_dynamics = 'bfgs'
/

&CELL
  cell_dynamics = 'bfgs'
  press = 0.0
/

ATOMIC_SPECIES
  Si  28.086  Si.pbe-n-rrkjus_psl.0.1.UPF

ATOMIC_POSITIONS (alat)
  Si  0.00  0.00  0.00
  Si  0.25  0.25  0.25

K_POINTS (automatic)
  8 8 8 0 0 0

Job Array for Parameter Scan

submit_qe_array.sh
#!/bin/bash
#SBATCH -J qe_array
#SBATCH --array=1-5
#SBATCH -N 2
#SBATCH --ntasks-per-node=28
#SBATCH -t 24:00:00
#SBATCH --mem-per-cpu=2G

ECUT_VALUES=(20 25 30 35 40)
ECUT=${ECUT_VALUES[$SLURM_ARRAY_TASK_ID-1]}

export INPUT="template.scf.in"
export OUTPUT="ecut_${ECUT}/"

module load quantum-espresso/7.5/mpi

mkdir -p ecut_${ECUT}
cd ecut_${ECUT}

# Modify ecutwfc in input file
sed "s/ecutwfc = .*/ecutwfc = $ECUT/" ../template.scf.in > si.scf.in

job-nanny mpirun -np $SLURM_NTASKS pw.x -inp si.scf.in > si.scf.out

# Extract total energy
grep "!" si.scf.out | awk '{print $5}' > energy.txt

References

See also