3 # get the kohn sham levels (plotted nicely)
15 if [ ! -f $file ]; then
16 echo "no OUTCAR file found ..."
25 echo $cntup > $1/temp_cu
27 echo $fup > $1/temp_fu
29 echo $cntdown > $1/temp_cd
31 echo $fdown > $1/temp_fd
34 startline=`grep -n spin\ component\ 1 $file | tail -1 | awk -F: '{ print $1 }'`
35 echo -en "spin component 1 ($startline)... "
36 sed -n "$startline,/spin component 2/p" $file | grep ^' '*[0-9] | \
37 while read number energy occu; do
38 if [ "$occu" = "1.00000" ]; then
39 echo "0.18 $energy 0.1" >> $1/ks_levels_o
40 cntup=`cat $1/temp_cu`
42 echo $cntup > $1/temp_cu
43 elif [ "$occu" = "0.00000" ]; then
44 echo "0.18 $energy 0.1" >> $1/ks_levels_u
46 echo "0.18 $energy 0.1" >> $1/ks_levels_p
48 fup=`echo $fup $occu | awk '{ print $1+$2 }'`
49 echo $fup > $1/temp_fu
55 startline=`grep -n spin\ component\ 2 $file | tail -1 | awk -F: '{ print $1 }'`
56 echo -en "spin component 2 ($startline) ... "
57 sed -n "$startline,/---/p" $file | grep ^' '*[0-9] | \
58 while read number energy occu; do
59 if [ "$occu" = "1.00000" ]; then
60 echo "0.42 $energy 0.1" >> $1/ks_levels_o
61 cntdown=`cat $1/temp_cd`
63 echo $cntdown > $1/temp_cd
64 elif [ "$occu" = "0.00000" ]; then
65 if [ "$center" = "0" ]; then
66 echo -en "setting mid value -> $energy ... "
68 echo "$energy" > $1/temp_e
70 echo "0.42 $energy 0.1" >> $1/ks_levels_u
72 echo "0.42 $energy 0.1" >> $1/ks_levels_p
73 fdown=`cat $1/temp_fd`
74 fdown=`echo $fdown $occu | awk '{ print $1+$2 }'`
75 echo $fdown > $1/temp_fd
80 cntup=`cat $1/temp_cu`
82 cntdown=`cat $1/temp_cd`
83 fdown=`cat $1/temp_fd`
84 center=`cat $1/temp_e`
85 yl=`echo $center $WDOWN | awk '{ print $1-$2 }'`
86 yh=`echo $center $WUP | awk '{ print $1+$2 }'`
87 fup=`awk -v var=$fup 'BEGIN{ printf"%0.f\n", var }'`
88 fdown=`awk -v var=$fdown 'BEGIN{ printf"%0.f\n", var }'`
91 ((difference=cntup-cntdown))
92 echo "generating gnuplot file ($center, $yl, $yh, $ly) ..."
93 cat > $1/ksl_plot.gpi <<!
94 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 ""
96 set ylabel "Kohn-Sham levels [eV]"
99 set xlabel "Spin up / down"
101 set x2label "$cntup / $cntdown (Delta: $difference)"
106 set term epslatex standalone color solid size 3.5,7
113 echo "running gnuplot and latex ..."
122 echo "file: $1/ksl.ps"