Last active
April 18, 2022 17:48
-
-
Save Asif-Iqbal-Bhatti/41b827011c16cc7143dc14d6d2ac5fa6 to your computer and use it in GitHub Desktop.
Script to extract energy from each directory for VASP calculation
This file contains 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 | |
# | |
# USAGE: script to extract energy from each folder. This script output energy-vs-volume | |
# and energy-vs-strain output files. The units are converted from eV to Ha | |
# and A3 to Bohr3. | |
# | |
echo -e "************************************************************************* \e[92m" | |
echo "*************************************************************************" | |
echo -e "*************************************************************************\e[0m" | |
rm energy-vs-strain energy-vs-volume | |
s=0 | |
echo -e "\e[0m" | awk '{printf "%15s %15s %15s\n", "Directory", "ENERGY (eV)", "VOLUME (A**3)"}' | |
for d in */; | |
do | |
#echo -e "\e[96m Directory name: " "$d \e[0m" | |
#list=`sed '6q;d' $d/POSCAR` | |
#echo " Number of Atoms for each element:" $list | |
#for n in $list; do ((s = s + n)); done | |
#echo " # of atoms in a supercell: " $s | |
E=`grep "free energy TOTEN =" $d/OUTCAR | tail -1 | awk '{printf "%f", $5 }'` | |
#E=`grep "energy(sigma->0) =" $d/OUTCAR | tail -1 | awk '{printf "%f", $8 }'` | |
V=`grep " volume of cell :" $d/OUTCAR | tail -1 | awk '{printf "%f", $5 }'` | |
echo -e "$d $E $V" | awk '{printf "%15s %15.6f %15.6f", $1, $2, $3}' | |
########################### IN UNITS OF BOHR ####### | |
echo "$E" | awk '{printf "%6.6f \n ", $1* 0.0367493 } ' >> .tmp1 | |
echo "$V" | awk '{printf "%6.6f \n ", $1* 6.74833 } ' >> .tmp_v | |
################################################## | |
########################### IN UNITS OF VASP ####### | |
#echo "$E" | awk '{printf "%6.6f \n ", $1 } ' >> .tmp1 | |
#echo "$V" | awk '{printf "%6.6f \n ", $1 } ' >> .tmp_v | |
################################################## | |
cat $d/strain-* >> .tmp2 | |
paste .tmp2 .tmp1 > energy-vs-strain | |
paste .tmp_v .tmp1 > energy-vs-volume | |
echo -e " \e[0m" | |
unset s | |
done; | |
#echo " PRINTING file in terms of VASP" | |
echo " COnvert VASP eV --> Ha; A --> Bohr to the output file" | |
rm .tmp1 .tmp2 .tmp_v | |
CHECKFIT-energy-vs-strain.py #(obtain from exciting website) | |
#PLOT-energy.py | |
#PLOT-bmeos.py | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment