added del_atoms, playing with Ef calc, some more TODO
[physik/posic.git] / calc_delta_e
1 #!/bin/bash
2
3 # bulk chemical potentials
4 musi=-4.63
5 muc=-7.374
6 music=-12.68
7
8 # formation enthalpy
9 dhf=0.68
10 #dhf=-9.64
11
12 # first method to calculate formation energy
13 file=`ls $1/atomic_conf_* | tail -1`
14 atom_cnt=`grep '# \[P\]' $file | awk '{ print $3 }'`
15 e0=`awk 'NR==2' $1/energy | awk '{ print $4 }'`
16 e1=`tail -n 1 $1/energy | awk '{ print $4 }'`
17
18 echo "$e0 $e1 $atom_cnt" | \
19         awk '{ print "  "($2-$1)*$3" eV (simple)" }'
20
21 # second method to calculate formation energy
22 si_cnt=`grep ^Si $file | wc -l`
23 c_cnt=`grep ^C $file | wc -l`
24 ed=`tail -n 1 $1/energy | awk '{ print $3 }'`
25
26 echo "$si_cnt $c_cnt $musi $muc $ed $music $dhf" | \
27         awk '{ print "  "$5*($1+$2)-0.5*($1+$2)*$6-0.5*($1-$2)*($3-$4)-0.5*($1-$2)*$7 " eV (Albe, #Si=" $1 " #C=" $2 ") " }'
28 echo "$si_cnt $c_cnt $ed $e0" | \
29         awk '{ print "  " $3*($1+$2)-($1+$2)*$4 " eV (Gao, #Si=" $1 " #C=" $2 ")" }'
30
31