script to calculate the energy over the reaction coordinate
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 21 Sep 2009 17:29:46 +0000 (19:29 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 21 Sep 2009 17:29:46 +0000 (19:29 +0200)
vasp_tools/mig_calc [new file with mode: 0755]

diff --git a/vasp_tools/mig_calc b/vasp_tools/mig_calc
new file mode 100755 (executable)
index 0000000..506fdae
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+if [ ! -d $1 ] ; then
+       echo "no valid dir"
+       exit
+fi
+
+last=""
+rc=0.0
+
+for i in $1/OUTCAR.*; do
+       index=`echo $i | awk -F. '{ print $2 }'`
+       if [ ! -f $1/CONTCAR.${index} ] ; then
+               echo "no such file: CONTCAR.${index}"
+               exit
+       else
+               cfile=$1/CONTCAR.${index}
+       fi
+       if [ -z $last ]; then
+               last=$cfile
+               lst=$index
+       fi
+
+       acnt=`sed -n 6p $cfile | awk '{ print $1 }'`
+       ((acnt+=9))
+       ((lcnt=9))
+
+       while [ $lcnt -le $acnt ]; do
+               line="`sed -n ${lcnt}p $cfile`"
+               x1=`echo $line | awk '{ print $1 }'`
+               x2=`echo $line | awk '{ print $2 }'`
+               x3=`echo $line | awk '{ print $3 }'`
+               line="`sed -n ${lcnt}p $last`"
+               y1=`echo $line | awk '{ print $1 }'`
+               y2=`echo $line | awk '{ print $2 }'`
+               y3=`echo $line | awk '{ print $3 }'`
+               rc=`echo $rc $x1 $x2 $x3 $y1 $y2 $y3 |\
+                       awk '{ print $1+sqrt(($2-$5)^2+($3-$6)^2+($4-$7)^2) }'`
+               ((lcnt+=1))
+       done
+
+       energy=`./e_coh $i | grep Si\ and\ C | awk '{ print $8 }'`
+       
+       echo "$rc $energy"
+
+       last=$cfile
+       lst=$index      
+done