-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGetLastCoordinate
64 lines (48 loc) · 1013 Bytes
/
GetLastCoordinate
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#This script is for printing the last coordinate of a geometry optimization and printing it into a .last file in a nerw coordinate directory
#Paul gave me this script, and I have modified it since then (lines 9, 62) so I do not know what each line does
#Please annotate what you know
#This script was used for qchemmay142015
#!/bin/bash
mkdir coordinate
if [ ! -f $1 ]
then
echo $1 "does not exist"
exit
fi
file=$1
endm=`grep -n "Standard Nuclear Orientation" $file`
i=0
for line in $endm
do
if [ $i -eq 0 ]
then
#echo "saving: $line "
final=$line
fi
if [ $i -eq 4 ]
then
i=-1
fi
let i=i+1
done
gdata=$(echo $final | tr ":" " ")
#echo "gdata: $gdata"
ends=gdata+2
alist=`grep -A 1 "NAtoms" $file`
x=0
for item in $alist
do
if [ $x -eq 8 ]
then
#echo $item
natoms=$item
fi
let x=x+1
done
let cstart=ends
let cend=ends+2+natoms
csplit -s $file $cstart $cend
echo "$natoms" > $file.last
awkx xx01 >> $file.last
mv $file.last coordinate
rm xx00 xx01 xx02