From 57f2209b6b362c2db63df8e915a6f04200b7b0f2 Mon Sep 17 00:00:00 2001 From: hackbard Date: Mon, 21 Sep 2009 19:29:46 +0200 Subject: [PATCH] script to calculate the energy over the reaction coordinate --- vasp_tools/mig_calc | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 vasp_tools/mig_calc diff --git a/vasp_tools/mig_calc b/vasp_tools/mig_calc new file mode 100755 index 0000000..506fdae --- /dev/null +++ b/vasp_tools/mig_calc @@ -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 -- 2.39.2