From: hackbard Date: Fri, 9 Oct 2009 15:42:24 +0000 (+0200) Subject: tool to visualize the kohn-sham levels X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d08cba6f75631ab842143f9dd5bb72dfe51b4427;p=physik%2Fposic.git tool to visualize the kohn-sham levels --- diff --git a/vasp_tools/get_ks_levels b/vasp_tools/get_ks_levels new file mode 100755 index 0000000..220c7c9 --- /dev/null +++ b/vasp_tools/get_ks_levels @@ -0,0 +1,89 @@ +#!/bin/bash + +# get the kohn sham levels (plotted nicely) + +# spin component 1 + +file=$1/OUTCAR + +WUP=1.2 +WDOWN=1.8 +PS=2 +OPT=7 +UPT=4 + +if [ ! -f $file ]; then + echo "no OUTCAR file found ..." + exit +fi + +rm -f $1/ks_levels_* + +center="0" + + +# spin component 1 +startline=`grep -n spin\ component\ 1 $file | tail -1 | awk -F: '{ print $1 }'` +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 + echo "0.18 $energy 0.1" >> $1/ks_levels_o + else + echo "0.18 $energy 0.1" >> $1/ks_levels_u + fi + done +echo "done" + +# spin component 2 +startline=`grep -n spin\ component\ 2 $file | tail -1 | awk -F: '{ print $1 }'` +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 + echo "0.42 $energy 0.1" >> $1/ks_levels_o + else + 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 + fi + done +echo "done" + +center=`cat $1/temp_e` +yl=`echo $center $WDOWN | awk '{ print $1-$2 }'` +yh=`echo $center $WUP | awk '{ print $1+$2 }'` +echo "generating gnuplot file ($center, $yl, $yh, $ly) ..." +cat > $1/ksl_plot.gpi <