X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fposic.git;a=blobdiff_plain;f=vasp_tools%2Fe_form;fp=vasp_tools%2Fe_form;h=7c9e490b9ea26e3202ee0a56c45291246a5a3d67;hp=0000000000000000000000000000000000000000;hb=6e6d7126ea9a845f11637d8e1b8eb2b570ac4dc9;hpb=97dc63eb6a519b8e1f4fbfaa9760dd94539436b0 diff --git a/vasp_tools/e_form b/vasp_tools/e_form new file mode 100755 index 0000000..7c9e490 --- /dev/null +++ b/vasp_tools/e_form @@ -0,0 +1,46 @@ +#!/bin/bash + + +if [ $# = 2 ]; then + +echo "Calculation of formation energy (Method 1, single species)" +echo " Result: `basename $2`, Initial conf: `basename $1`" +echo + +e1only=`./e_coh $1 | grep cohesive | grep only | awk '{ print $5 }'` +e2only=`./e_coh $2 | grep cohesive | grep only | awk '{ print $5 }'` +e1and=`./e_coh $1 | grep cohesive | grep and | awk '{ print $6 }'` +e2and=`./e_coh $2 | grep cohesive | grep and | awk '{ print $6 }'` +count=`./e_coh $2 | grep ^\ \ Si: | awk '{ print $6 }'` + +echo "$e1only $e2only $count" | \ + awk '{ print " formation energy M1 (Si and C): "($2-$1)*$3 " eV" }' +echo "$e1and $e2and $count" | \ + awk '{ print " formation energy M1 (C only): "($2-$1)*$3 " eV" }' +echo + +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 only | awk '{ print $5 }'` +echo " Cohesive energies:" +echo " `basename $1` -> $e1 ($sicnt)" +echo " `basename $2` -> $e2 ($ccnt)" + +((count = sicnt + ccnt)) + +echo "$et $sicnt $e1 $ccnt $e2" | \ + awk '{ print " formation energy M2: "$1-$2*$3-$4*$5 " eV" }' +echo + +fi +