--- /dev/null
+#!/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