From a1b0bd69b047c7f4c2a7d451a3cc07b935162aaf Mon Sep 17 00:00:00 2001 From: hackbard Date: Mon, 27 Jul 2009 13:34:08 +0200 Subject: [PATCH] method 2 working now ... --- vasp_tools/e_form | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/vasp_tools/e_form b/vasp_tools/e_form index dadc46c..7c9e490 100755 --- a/vasp_tools/e_form +++ b/vasp_tools/e_form @@ -1,11 +1,46 @@ #!/bin/bash -echo "#### `basename $2` # `basename $1` ####" -e1=`./e_coh $1 | grep cohesive | awk '{ print $5 }'` -e2=`./e_coh $2 | grep cohesive | awk '{ print $5 }'` -count=`./e_coh $2 | grep total\: | awk '{ print $6 }'` +if [ $# = 2 ]; then -echo "$e1 $e2 $count" | \ - awk '{ print "formation energy: "($2-$1)*$3 " eV" }' +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 -- 2.39.2