#!/bin/bash
-sicnt=`grep 'ions per' $1/OUTCAR | awk '{ print $5 }'`
-ccnt=`grep 'ions per' $1/OUTCAR | awk '{ print $6 }'`
+free_si_250=-0.70036911
+free_si_650=-0.70021403
+free_c_650=-1.3535731
+
+file=$1
+
+[ -d $1 ] && file=$1/OUTCAR
+
+sicnt=`grep 'ions per' $file | awk '{ print $5 }'`
+ccnt=`grep 'ions per' $file | awk '{ print $6 }'`
((total=sicnt+ccnt))
-echo "parsing OUTCAR file ..."
+echo "parsing file $file ..."
echo " Si: $sicnt, C: $ccnt, total: $total"
cnt=0
tcnt=0
-energy=`grep energy\ without $1/OUTCAR | tail -1 | awk '{ print $8 }'`
+energy=`grep energy\ without $file | tail -1 | awk '{ print $8 }'`
-echo " total energy: $energy eV"
-echo "$energy $total" | \
- awk '{ print " cohesive energy: "$1/$2 " eV" }'
+echo $energy $total | \
+ awk '{ print " total e: " $1 " eV, per atom: " $1/$2 " eV"}'
+echo "$energy $total $free_si_250" | \
+ awk '{ print " cohesive energy (Si only 250): " ($1-$2*$3)/$2 " eV" }'
+echo "$energy $sicnt $ccnt $free_si_650 $free_c_650" | \
+ awk '{ print " cohesive energy (Si and C 650): " ($1-$2*$4-$3*$5)/($2+$3) " eV" }'
+#echo "$energy $total" | \
+# awk '{ print " Si:C -> cohesive energy: "$1/$2 " eV" }'
echo
#!/bin/bash
-echo "## `basename $2` - `basename $1` ##"
+echo "#### `basename $2` # `basename $1` ####"
e1=`./e_coh $1 | grep cohesive | awk '{ print $5 }'`
e2=`./e_coh $2 | grep cohesive | awk '{ print $5 }'`
echo "$e1 $e2 $count" | \
awk '{ print "formation energy: "($2-$1)*$3 " eV" }'
-echo
-