Skip to content

Instantly share code, notes, and snippets.

@Altoidnerd
Created April 29, 2016 02:25
Show Gist options
  • Select an option

  • Save Altoidnerd/c9ceaa723ccdcdfd0ff2dfad2ccc8628 to your computer and use it in GitHub Desktop.

Select an option

Save Altoidnerd/c9ceaa723ccdcdfd0ff2dfad2ccc8628 to your computer and use it in GitHub Desktop.
Script to use Quantum Espresso in a range of cutoff energies.
#!/bin/bash
#
#
# Copyright (c) 2016 altoidnerd
#################################################################################
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
# to deal in the Software without restriction, including without limitation #
# the rights to use, copy, modify, merge, publish, distribute, sublicense, #
# and/or sell copies of the Software, and to permit persons to whom the #
# Software is furnished to do so, subject to the following conditions: #
# #
# The above copyright notice and this permission notice shall be included #
# in all copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #
# THE SOFTWARE. #
#################################################################################
#
#
#
# run from directory where this script is
# cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
#
#
example_dir=`pwd`
# check whether echo has the -e option
e="echo -e"
$e
$e "$example_dir : starting"
$e
$e
$e "...setting the needed environment variables..."
$e
#. ./environment_variables
$e "done."
$e
# required executables and pseudopotentials
bin_list="pw.x"
pseudo_dir="$HOME/.data/PSEUDOPOTENTIALS"
tmp_dir="./scratch"
bin_dir="$HOME/espresso-5.3.0/bin"
$e
$e " executables directory: $bin_dir"
$e " pseudo directory: $pseudo_dir"
$e " temporary directory: $tmp_dir"
$e " checking that needed directories and files exist..."
$e
$e " OK"
$e
for ecut in 10 15 20 25 30; do
cat > scf.pz-n-kjpaw-kp-3x4-3x1.$ecut.in << EOF
&CONTROL
calculation = 'scf'
prefix='pz-n-kjpaw_ecut-$ecut'
restart_mode='from_scratch'
pseudo_dir = "$HOME/.data/PSEUDOPOTENTIALS"
outdir="$tmp_dir"
tstress=.true.
tprnfor = .true.
forc_conv_thr=1.0d-4
!nstep=200
/
&SYSTEM
ibrav=0
celldm(1)=1.889726
nat=32
ntyp=3
ecutwfc=$ecut
ecutrho=${ecut}0
/
&ELECTRONS
mixing_beta=0.7
diago_thr_init=1e-4
diagonalization='david'
conv_thr = 1.0d-8
electron_maxstep=200
/
&IONS
trust_radius_max=0.2
/
&CELL
cell_dynamics='bfgs'
/
ATOMIC_SPECIES
C 12.0110 C.pbe-n-kjpaw_psl.1.0.0.UPF
H 1.0079 H.pbe-kjpaw_psl.1.0.0.UPF
Cl 35.4527 Cl.pbe-n-kjpaw_psl.1.0.0.UPF
CELL_PARAMETERS (alat)
5.0448000000 0.0000000000 0.0000000000
-0.6763200777 8.3276819801 0.0000000000
0.0000000000 0.0000000000 11.0060000000
ATOMIC_POSITIONS (crystal)
C 0.752000000 0.241000000 0.172000000
H 0.910900000 0.304900000 0.143200000
C 0.755000000 0.254700000 0.288000000
H 0.756000000 0.367800000 0.308500000
H 0.919700000 0.217200000 0.318800000
Cl 0.472600000 0.325000000 0.100900000
Cl 0.777700000 0.043900000 0.113700000
Cl 0.473000000 0.144500000 0.370200000
Cl -0.027000000 0.644500000 0.129800000
Cl 0.277700000 0.543900000 0.386300000
Cl -0.027400000 0.825000000 0.399100000
H 0.419700000 0.717200000 0.181200000
H 0.256000000 0.867800000 0.191500000
C 0.255000000 0.754700000 0.212000000
H 0.410900000 0.804900000 0.356800000
C 0.252000000 0.741000000 0.328000000
Cl 0.527000000 0.855500000 0.629800000
Cl 0.222300000 0.956100000 0.886300000
Cl 0.527400000 0.675000000 0.899100000
H 0.080300000 0.782800000 0.681200000
H 0.244000000 0.632200000 0.691500000
C 0.245000000 0.745300000 0.712000000
H 0.089100000 0.695100000 0.856800000
C 0.248000000 0.759000000 0.828000000
Cl 1.027000000 0.355500000 0.870200000
Cl 0.722300000 0.456100000 0.613700000
Cl 1.027400000 0.175000000 0.600900000
H 0.580300000 0.282800000 0.818800000
H 0.744000000 0.132200000 0.808500000
C 0.745000000 0.245300000 0.788000000
H 0.589100000 0.195100000 0.643200000
C 0.748000000 0.259000000 0.672000000
K_POINTS automatic
4 4 4 1 1 1
EOF
$e
$e "$0 by $(whoami) running on $HOSTNAME " >> debug.log
$e "$(date +%b%d-%T-%Y)" >> debug.log
$e " ...running pw.x ... ecut = $ecut" >> debug.log
$e
mpirun -n 8 nice -n 19 pw.x < scf.pz-n-kjpaw-kp-3x4-3x1.$ecut.in > scf.pz-n-kjpaw-kp-3x4-3x1.$ecut.out
done
@miroi

miroi commented Jul 13, 2021

Copy link
Copy Markdown

Thanks for the script !

@Altoidnerd

Copy link
Copy Markdown
Author

yw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment