From e7096166a3230399e1087434696203ae4c90bbe0 Mon Sep 17 00:00:00 2001 From: Sean Kavanagh Date: Mon, 11 Sep 2023 09:15:55 +0100 Subject: [PATCH] Make `nbands-epsopt-data-converge` compatible with `vasp5.4.1` --- bin/nbands-epsopt-data-converge | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/nbands-epsopt-data-converge b/bin/nbands-epsopt-data-converge index 6576c3d..6c0dd09 100755 --- a/bin/nbands-epsopt-data-converge +++ b/bin/nbands-epsopt-data-converge @@ -4,21 +4,27 @@ rm -f data # delete data file if exists # Note that we ignore off-diagonal elements in this script n=0 shopt -s extglob -for i in {!(*_*),*_*}/CONTCAR +for i in {!(*_*),*_*}/OUTCAR do - if ! [[ $i == "*_*/CONTCAR" ]] + if ! [[ $i == "*_*/OUTCAR" ]] then - if ! [[ $i == "!(*_*)/CONTCAR" ]] + if ! [[ $i == "!(*_*)/OUTCAR" ]] then - folder=${i/CONTCAR/} + folder=${i/OUTCAR/} name=${folder//[\/]/} # folder name without slashes - n_atoms=$(sed '7q;d' $i | awk '{sum=0; for (i=1; i<=NF; i++) { sum+= $i } print sum}') # sum over row 7 of the CONTCAR - optic_dielectric_tensor=$(grep -s -A 3 "frequency dependent REAL DIELECTRIC FUNCTION (independent particle, no local field effects) density-density" $folder/OUTCAR | tail -1 | tr -d '\n') # tr is to remove the trailing newline - optic_dielectric_tensorX=$(grep -s -A 3 "frequency dependent REAL DIELECTRIC FUNCTION (independent particle, no local field effects) density-density" $folder/OUTCAR | tail -1 | awk '{print $2}' | tr -d '\n') - optic_dielectric_tensorY=$(grep -s -A 3 "frequency dependent REAL DIELECTRIC FUNCTION (independent particle, no local field effects) density-density" $folder/OUTCAR | tail -1 | awk '{print $3}' | tr -d '\n') - optic_dielectric_tensorZ=$(grep -s -A 3 "frequency dependent REAL DIELECTRIC FUNCTION (independent particle, no local field effects) density-density" $folder/OUTCAR | tail -1 | awk '{print $4}' | tr -d '\n') +# optic_dielectric_tensor=$(grep -s -A 3 "frequency dependent REAL DIELECTRIC FUNCTION (independent particle, no local field effects) density-density" $folder/OUTCAR | tail -1 | tr -d '\n') # tr is to remove the trailing newline + vasp_optics_string="frequency dependent REAL DIELECTRIC FUNCTION (independent particle, no local field effects)" + if grep -q "$vasp_optics_string density-density" "$folder/OUTCAR"; then + optic_dielectric_tensorX=$(grep -s -A 3 "$vasp_optics_string density-density" $folder/OUTCAR | tail -1 | awk '{print $2}' | tr -d '\n') + optic_dielectric_tensorY=$(grep -s -A 3 "$vasp_optics_string density-density" $folder/OUTCAR | tail -1 | awk '{print $3}' | tr -d '\n') + optic_dielectric_tensorZ=$(grep -s -A 3 "$vasp_optics_string density-density" $folder/OUTCAR | tail -1 | awk '{print $4}' | tr -d '\n') + else + optic_dielectric_tensorX=$(grep -s -A 3 "$vasp_optics_string" $folder/OUTCAR | tail -1 | awk '{print $2}' | tr -d '\n') + optic_dielectric_tensorY=$(grep -s -A 3 "$vasp_optics_string" $folder/OUTCAR | tail -1 | awk '{print $3}' | tr -d '\n') + optic_dielectric_tensorZ=$(grep -s -A 3 "$vasp_optics_string" $folder/OUTCAR | tail -1 | awk '{print $4}' | tr -d '\n') + fi echo -n -e "$name\t$optic_dielectric_tensorX\t$optic_dielectric_tensorY\t$optic_dielectric_tensorZ" >> data