]> hackdaworld.org Git - physik/posic.git/commitdiff
count spins ...
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 13 Oct 2009 15:46:55 +0000 (17:46 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 13 Oct 2009 15:46:55 +0000 (17:46 +0200)
vasp_tools/get_ks_levels

index 922955a0ef911e9a39f9a9f3fe3ee839c5d74632..8ef690efbed00e2280438a22542d7fc0dd90eb95 100755 (executable)
@@ -21,6 +21,14 @@ rm -f $1/ks_levels_*
 
 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 }'`
@@ -29,10 +37,16 @@ sed -n "$startline,/spin component 2/p" $file | grep ^' '*[0-9] | \
        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"
@@ -44,6 +58,9 @@ sed -n "$startline,/---/p" $file | grep ^' '*[0-9] | \
        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 ... "
@@ -53,13 +70,25 @@ sed -n "$startline,/---/p" $file | grep ^' '*[0-9] | \
                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 ""
@@ -69,6 +98,7 @@ set xrange [0:0.6]
 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