6 echo "Calculation of formation energy (Method 1, single species)"
7 echo " Result: `basename $2`, Initial conf: `basename $1`"
10 e1only=`./e_coh $1 | grep cohesive | grep only | awk '{ print $5 }'`
11 e2only=`./e_coh $2 | grep cohesive | grep only | awk '{ print $5 }'`
12 e1and=`./e_coh $1 | grep cohesive | grep and | awk '{ print $6 }'`
13 e2and=`./e_coh $2 | grep cohesive | grep and | awk '{ print $6 }'`
14 count=`./e_coh $2 | grep ^\ \ Si: | awk '{ print $6 }'`
16 echo "$e1only $e2only $count" | \
17 awk '{ print " formation energy M1 (Si and C): "($2-$1)*$3 " eV" }'
18 echo "$e1and $e2and $count" | \
19 awk '{ print " formation energy M1 (C only): "($2-$1)*$3 " eV" }'
26 echo "Calculation of formation energy (Method 2, two species)"
28 e3=`./e_coh $3 | grep cohesive | grep and | awk '{ print $6 }'`
29 sicnt=`./e_coh $3 | grep ^\ \ Si: | awk '{ print $2 }' | sed 's/,//'`
30 ccnt=`./e_coh $3 | grep ^\ \ Si: | awk '{ print $4 }' | sed 's/,//'`
31 et=`echo $e3 $sicnt $ccnt | awk '{ print $1*($2+$3) }'`
32 echo " Interstitial configuration: `basename $3` -> $et"
33 e1=`./e_coh $1 | grep cohesive | grep and | awk '{ print $6 }'`
34 e2=`./e_coh $2 | grep cohesive | grep only | awk '{ print $5 }'`
35 echo " Cohesive energies:"
36 echo " `basename $1` -> $e1 ($sicnt)"
37 echo " `basename $2` -> $e2 ($ccnt)"
39 ((count = sicnt + ccnt))
41 echo "$et $sicnt $e1 $ccnt $e2" | \
42 awk '{ print " formation energy M2: "$1-$2*$3-$4*$5 " eV" }'