#!/bin/bash if [ $# = 2 ]; then echo "unsupported ..." fi if [ $# = 3 ]; then echo "Calculation of formation energy (Method 2, two species)" e3=`./e_coh $3 | grep cohesive | grep and | awk '{ print $6 }'` sicnt=`./e_coh $3 | grep ^\ \ Si: | awk '{ print $2 }' | sed 's/,//'` ccnt=`./e_coh $3 | grep ^\ \ Si: | awk '{ print $4 }' | sed 's/,//'` et=`echo $e3 $sicnt $ccnt | awk '{ print $1*($2+$3) }'` echo " Interstitial configuration: `basename $3` -> $et" e1=`./e_coh $1 | grep cohesive | grep and | awk '{ print $6 }'` e2=`./e_coh $2 | grep cohesive | grep and | awk '{ print $6 }'` emuc=`echo $e2 $e1 | awk '{ print 2*$1-$2 }'` echo " Cohesive energies:" echo " `basename $1` -> $e1 ($sicnt)" echo " `basename $2` -> $emuc / $e2 ($ccnt)" ((count = sicnt + ccnt)) #echo "$et $sicnt $e1 $ccnt $emuc" | \ # awk '{ print " formation energy M2: "$1-$2*$3-$4*$5 " eV" }' echo "$et $sicnt $e1 $ccnt $e2" | \ awk '{ print " formation energy M2: "$1-($2-$4)*$3-$4*$5*2 " eV" }' echo fi