-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgDn
44 lines (43 loc) · 1.45 KB
/
gDn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#########################################################################
# File Name: gDn.sh
# Author: [email protected]
# Created Time: Mon 12 May 2014 10:54:44 AM CST
#########################################################################
if [ x$1 == x ]; then
outfile=OUTCAR
else
outfile=$1
fi
if [ ! -f $outfile ];then
echo "usage: gDn [OUTCAR] (default) "
#echo "$outfile is not a OUTCAR file"
exit 0
fi
grep RMS $outfile|uniq > tempForce
grep "distance after opt" $outfile > tempdisafter
grep "distance i" $outfile | uniq -c > tempdis
step=0
#disafternum=0
i=0
for gap in `cat tempdis | awk '{print $1}'`
do
let "i = $i + 1"
let "stepold = $step +1 "
let "step = $step + $gap "
#let "disafternum = $disafternum + $gap"
Force=`sed -n ''$step''p tempForce | awk '{printf"%.4f", $5}'`
aveF=`sed -n ''$stepold','$step''p tempForce |tail -10| awk '{a+=$5}END{printf"%.4f", a/NR}'`
dist=`sed -n ''$i''p tempdis | awk -F " " '{print $1}' |sed 's/ //'`
dist2=`sed -n ''$i''p tempdis | awk -F " " '{print $2}' |sed 's/ //g'`
disafteropt=`sed -n ''$step''p tempdisafter | awk '{print $4 }'`
avedisafteropt=`sed -n ''$stepold','$step''p tempdisafter |tail -10 |awk '{a+=$4}END{printf"%.4f", a/NR}'`
echo -n "$dist: "
echo -ne "\033[33m$dist2"
echo -ne "\033[0m Force: "
echo -ne "\033[32m$Force $aveF"
echo -ne "\033[0m distance after opt: "
echo -e "\033[32m$disafteropt $avedisafteropt"
echo -ne "\033[0m"
done
rm -f temp*