echo -en "spin component 1 ($startline)... "
sed -n "$startline,/spin component 2/p" $file | grep ^' '*[0-9] | \
while read number energy occu; do
- if [ "$occu" != "0.00000" ]; then
+ if [ "$occu" = "1.00000" ]; then
echo "0.18 $energy 0.1" >> $1/ks_levels_o
- else
+ elif [ "$occu" = "0.00000" ]; then
echo "0.18 $energy 0.1" >> $1/ks_levels_u
+ else
+ echo "0.18 $energy 0.1" >> $1/ks_levels_p
fi
done
echo "done"
echo -en "spin component 2 ($startline) ... "
sed -n "$startline,/---/p" $file | grep ^' '*[0-9] | \
while read number energy occu; do
- if [ "$occu" != "0.00000" ]; then
+ if [ "$occu" = "1.00000" ]; then
echo "0.42 $energy 0.1" >> $1/ks_levels_o
- else
+ elif [ "$occu" = "0.00000" ]; then
if [ "$center" = "0" ]; then
echo -en "setting mid value -> $energy ... "
center=$energy
echo "$energy" > $1/temp_e
fi
echo "0.42 $energy 0.1" >> $1/ks_levels_u
+ else
+ echo "0.42 $energy 0.1" >> $1/ks_levels_p
fi
done
echo "done"
yh=`echo $center $WUP | awk '{ print $1+$2 }'`
echo "generating gnuplot file ($center, $yl, $yh, $ly) ..."
cat > $1/ksl_plot.gpi <<!
-plot "ks_levels_o" w xerrorbars pt $OPT ps $PS t "", "ks_levels_u" w xerrorbars pt $UPT ps $PS t ""
+plot "ks_levels_o" w xerrorbars pt $OPT ps $PS t "", "ks_levels_u" w xerrorbars pt $UPT ps $PS t "", "ks_levels_p" w xerrorbars pt $OPT ps $PS t ""
unset bars
set ylabel "Kohn-Sham levels [eV]"
set xrange [0:0.6]