-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakexyz.sh
executable file
·46 lines (36 loc) · 1.16 KB
/
makexyz.sh
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
#!/bin/bash
# created by Jan Mewes Sep 2017 www.janmewes.de
file=$1
output=$(echo $file | sed s/out/xyz/)
natoms=0
quiet=""
otherout=$2
if [ $otherout ] && [ -n $otherout ]
then output=$otherout
echo "Using non default outputfile $output"
else echo "Using default outputfile $output"
fi
if [ ! $quiet ]
then echo "### Q-CHEM OPTIMIZED XYZ MAKER V1.0 ###"
echo
echo "Usage: 1st argument output file (has to be an optimization)"
echo " 2nd optional argument: name of desired output file. Default is outputfile.xyz"
echo
echo "Now doing $1..."
fi
for i in $file
do if [ $(cat $1 | grep -c "OPTIMIZATION CONVERGED") -eq 1 ]
then natoms=$(grep "NAtoms," $1 -A1 | tail -n1 | awk '{print $1}')
nlines=$((natoms+4))
[ ! $quiet ] && echo "Found $natoms atoms..."
if [ -e $output ]
then cp $output "$output"_bkup
echo "Desired output file already exists, backing up..."
fi
echo "$natoms" > $output
grep "Final energy is" $file >> $output
grep "OPTIMIZATION CONVERGED" -A $nlines $file | tail -n $natoms | cut -c 10- >> $output
[ ! $quiet ] && echo "### All done, sweetas!"
else echo "Optimization not converged, exiting"
fi
done