center="0"
+cntup=0
+echo $cntup > $1/temp_cu
+fup=0
+echo $fup > $1/temp_fu
+cntdown=0
+echo $cntdown > $1/temp_cd
+fdown=0
+echo $fdown > $1/temp_fd
# spin component 1
startline=`grep -n spin\ component\ 1 $file | tail -1 | awk -F: '{ print $1 }'`
while read number energy occu; do
if [ "$occu" = "1.00000" ]; then
echo "0.18 $energy 0.1" >> $1/ks_levels_o
+ cntup=`cat $1/temp_cu`
+ ((cntup+=1))
+ echo $cntup > $1/temp_cu
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
+ fup=`cat $1/temp_fu`
+ fup=`echo $fup $occu | awk '{ print $1+$2 }'`
+ echo $fup > $1/temp_fu
fi
done
echo "done"
while read number energy occu; do
if [ "$occu" = "1.00000" ]; then
echo "0.42 $energy 0.1" >> $1/ks_levels_o
+ cntdown=`cat $1/temp_cd`
+ ((cntdown+=1))
+ echo $cntdown > $1/temp_cd
elif [ "$occu" = "0.00000" ]; then
if [ "$center" = "0" ]; then
echo -en "setting mid value -> $energy ... "
echo "0.42 $energy 0.1" >> $1/ks_levels_u
else
echo "0.42 $energy 0.1" >> $1/ks_levels_p
+ fdown=`cat $1/temp_fd`
+ fdown=`echo $fdown $occu | awk '{ print $1+$2 }'`
+ echo $fdown > $1/temp_fd
fi
done
echo "done"
+cntup=`cat $1/temp_cu`
+fup=`cat $1/temp_fu`
+cntdown=`cat $1/temp_cd`
+fdown=`cat $1/temp_fd`
center=`cat $1/temp_e`
yl=`echo $center $WDOWN | awk '{ print $1-$2 }'`
yh=`echo $center $WUP | awk '{ print $1+$2 }'`
+fup=`awk -v var=$fup 'BEGIN{ printf"%0.f\n", var }'`
+fdown=`awk -v var=$fdown 'BEGIN{ printf"%0.f\n", var }'`
+((cntup+=fup))
+((cntdown+=fdown))
+((difference=cntup-cntdown))
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 "", "ks_levels_p" w xerrorbars pt $OPT ps $PS t ""
set yrange [$yl:$yh]
set xlabel "Spin up / down"
set format x ""
+set x2label "$cntup / $cntdown (Delta: $difference)"
unset xtics
set mytics 5
set size ratio 3.0