From: hackbard Date: Tue, 13 Oct 2009 15:46:55 +0000 (+0200) Subject: count spins ... X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=f5f06f39f0951cc5f1fcb199c2d5dc56094688a2;p=physik%2Fposic.git count spins ... --- diff --git a/vasp_tools/get_ks_levels b/vasp_tools/get_ks_levels index 922955a..8ef690e 100755 --- a/vasp_tools/get_ks_levels +++ b/vasp_tools/get_ks_levels @@ -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 <