From: hackbard Date: Tue, 13 Jul 2010 20:26:16 +0000 (+0200) Subject: tool to build crude interface for vasp X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ffcb7c7b0cddea0a0a9cce32cf91cfb544368e7;p=physik%2Fposic.git tool to build crude interface for vasp --- diff --git a/vasp_tools/create_intf_crude b/vasp_tools/create_intf_crude new file mode 100755 index 0000000..f5e0c3d --- /dev/null +++ b/vasp_tools/create_intf_crude @@ -0,0 +1,69 @@ +#!/bin/bash + +si_file=$1 +sic_file=$2 + +cnt_si_si=`sed -n 6p $si_file` +cnt_si_sic=`sed -n 6p $sic_file | awk '{ print $1 }'` +cnt_c_sic=`sed -n 6p $sic_file | awk '{ print $2 }'` + +lc_si=`sed -n 2p $si_file` + +x_si=`sed -n 3p $si_file | awk '{ print $1 }'` +x_sic=`sed -n 3p $sic_file | awk '{ print $1 }'` + +h_si=`sed -n 5p $si_file | awk '{ print $3 }'` +h_sic=`sed -n 5p $sic_file | awk '{ print $3 }'` +h_sic=`echo $h_sic $x_si $x_sic | awk '{ print $1*$2/$3 }'` + +((tot_si=cnt_si_si+cnt_si_sic)) + +h_tot=`echo $h_si + $h_sic | bc` + +((offset=8)) + +# header: +sed -n 1,4p $si_file +echo " 0.00000 0.00000 $h_tot" +echo " $tot_si $cnt_c_sic" +sed -n 7,8p $si_file + +# silicon atoms of si lattice (bottom) +((cnt=1)) +while [ $cnt -le $cnt_si_si ]; do + ((gl=cnt+offset)) + line=`sed -n ${gl}p $si_file` + x=`echo $line | awk '{ print $1 }'` + y=`echo $line | awk '{ print $2 }'` + z=`echo $line | awk '{ print $3 }'` + nz=`echo $z $h_tot $h_si | awk '{ print $1*$3/$2 }'` + echo " $x $y $nz T T T" + ((cnt+=1)) +done + +# silicon atoms of sic lattice (top / 2nd fcc) +((cnt=1)) +while [ $cnt -le $cnt_si_sic ]; do + ((gl=cnt+offset+cnt_c_sic)) + line=`sed -n ${gl}p $sic_file` + x=`echo $line | awk '{ print $1 }'` + y=`echo $line | awk '{ print $2 }'` + z=`echo $line | awk '{ print $3 }'` + nz=`echo $z $h_tot $h_si $h_sic | awk '{ print $1*$4/$2 + $3/$2 }'` + echo " $x $y $nz T T T" + ((cnt+=1)) +done + +# carbon atoms of sic lattice (top / 1st fcc <- odd counts) +((cnt=1)) +while [ $cnt -le $cnt_c_sic ]; do + ((gl=cnt+offset)) + line=`sed -n ${gl}p $sic_file` + x=`echo $line | awk '{ print $1 }'` + y=`echo $line | awk '{ print $2 }'` + z=`echo $line | awk '{ print $3 }'` + nz=`echo $z $h_tot $h_si $h_sic | awk '{ print $1*$4/$2 + $3/$2 }'` + echo " $x $y $nz T T T" + ((cnt+=1)) +done +