-
Notifications
You must be signed in to change notification settings - Fork 0
/
potcar
executable file
·34 lines (34 loc) · 1.19 KB
/
potcar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#Program:
# Extract element POTCAR (PAW_PBE) from $pot directory
#Usage:
# pot pours $ele1/POTCAR into current POTCAR.
# but, if POTdatabase contains Pb Pb_d entry, then Pb_d instead of Pb is used as ele
ele1=$1
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pot=$SCRIPTDIR
# real element name. default to POTdatabase, then first listed folder containing $ele1 char
ele=`cat $SCRIPTDIR/POTdatabase | grep "$ele1 " | awk '{printf "%s", $2 }'`
if [ -z $ele ] ; then
ele=`ls $pot/paw_pbe/ | grep $ele1 |sed -n '1p'`
fi
if [ -z $ele ] ;then
ele="Unobtanium"
fi
# pour the POTCAR
if [ -f $pot/paw_pbe/$ele/POTCAR.Z ] ; then
zcat $pot/paw_pbe/$ele/POTCAR.Z
elif [ -f $pot/paw_pbe/$ele/POTCAR ] ; then
cat $pot/paw_pbe/$ele/POTCAR
elif [ -f $pot/paw_pbe/$ele/POTCAR.gz ] ; then
zcat $pot/paw_pbe/$ele/POTCAR.gz
elif [ -f $pot/paw_pbe/"$ele"_sv/POTCAR ] ; then
cat $pot/paw_pbe/"$ele"_sv/POTCAR
elif [ -f $pot/paw_pbe/"$ele"_sv/POTCAR.Z ] ; then
zcat $pot/paw_pbe/"$ele"_sv/POTCAR.Z
elif [ -f $pot/paw_pbe/"$ele"_sv/POTCAR.gz ] ; then
zcat $pot/paw_pbe/"$ele"_sv/POTCAR.gz
else
echo "pot error: No {$ele} element pseudopotential found! Aborting..."
exit 64
fi