Created
June 27, 2017 14:09
-
-
Save aditya95sriram/a550356b5e41b13560ae94023b02097c to your computer and use it in GitHub Desktop.
Extracts wavefunction for multiple bands using pp.x from Quantum Espresso.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#------------------------------------------------------------------------------ | |
# Shell script: allband.sh | |
#------------------------------------------------------------------------------ | |
# | |
# Description: | |
# Extracts wavefunction for multiple bands using pp.x from Quantum Espresso. | |
# | |
#------------------------------------------------------------------------------ | |
# | |
# What does it do: | |
# | |
# * Sequentially submits pp.x jobs waiting for one to finish | |
# before submitting the next one. | |
# * Works in the home directory and then cleans it up, moving | |
# and renaming newly generated files to another directory ($newdir) | |
# * Requires ppx-template.in in the same directory | |
# * Requires job script queue_ppx in the same directory | |
# * Requires modified version of QE source | |
# where plot_num 22/23 return real/imag parts of the wave function | |
# * Range of bands to extract is set using $startband and $endband | |
# * k-point is set using $kpoint | |
#------------------------------------------------------------------------------ | |
# | |
# Author: P. R. Vaidyanathan (aditya95sriram <at> gmail <dot> com) | |
# Date: 27th June 2017 | |
startband=1 | |
endband=4 | |
newdir="task2/attempt3" # directory to put log files and output files | |
kpoint=1 | |
# function to substitute all occurences of {key} in arg2 with val, | |
# where key and val are taken from arg1 | |
# arg1 must be in the format "key1:val1,key2:val2,key3:val3,..." | |
function replace { | |
repl=$(echo "$1" | tr "," "\n") | |
s="$2" | |
for keyval in $repl; do | |
key=$(echo $keyval | cut -f1 -d:) | |
val=$(echo $keyval | cut -f2 -d:) | |
s="${s//\{$key\}/$val}" | |
done | |
echo "$s" | |
} | |
fstr=$(<ppx-template.in) | |
for i in {$startband..$endband}; do | |
for j in 0 1; do | |
if [ $j = 1 ]; then | |
reim="real" | |
plot_num=22 | |
else | |
reim="imag" | |
plot_num=23 | |
fi | |
replace "kpoint:$kpoint,kband:$i,reim:$reim,plot_num:$plot_num" "$fstr" > ppx.in | |
jobid=$(qsub -N band$i-$reim queue_ppx) | |
echo "processing band $i - $reim for j=$j with jobid $jobid" | |
qstat $jobid | tail -n 1 | |
while [ "$(qstat $jobid | tail -n 1 | cut -c70)" != "C" ]; do | |
true | |
done | |
echo "waiting..." | |
sleep 1 | |
qstat $jobid | tail -n 1 | |
echo "processed band $i - $reim" | |
cp ppx.in $newdir/ppx$i.$reim.in | |
cp ppx.out $newdir/ppx$i.$reim.out | |
cp band$i.$reim.cube $newdir | |
done | |
done | |
rm band*.*.cube -v | |
rm band*.o* -v | |
rm ppx.* -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
&inputpp | |
prefix = 'test2a3', | |
outdir = './temp_dir', | |
filplot = 'int_plot', | |
plot_num = {plot_num}, | |
kpoint = {kpoint}, | |
kband = {kband}, | |
/ | |
&plot | |
nfile=1, | |
iflag=3, | |
output_format=6, | |
e1(1)=1.0, e1(2)=0.0, e1(3)=0.0, | |
e2(1)=0.0, e2(2)=1.0, e2(3)=0.0, | |
e3(1)=0.0, e3(2)=0.0, e3(3)=1.0, | |
x0(1)=0.0, x0(2)=0.0, x0(3)=0.0, | |
nx=60, ny=60, nz=60, | |
fileout="band{kband}.{reim}.cube" | |
/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#PBS -N ppx-vloc | |
#PBS -j oe | |
#PBS -l walltime=2:30:00 | |
#PBS -l nodes=1:ppn=20 | |
module purge | |
module load openmpi-1.6/gcc-4.7.2 | |
export QE=<path/to/QE> | |
cd $PBS_O_WORKDIR | |
mpirun -np 4 $QE/bin/pp.x < ppx.in > ppx.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment