-
Notifications
You must be signed in to change notification settings - Fork 0
/
runIRC
executable file
·100 lines (88 loc) · 3.51 KB
/
runIRC
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
#############################################################################
# Program : #
# Generate a lot IRC input with different parameter setting in order to #
# brute force of gaining more grid points of an IRC simulation. #
# #
# Intput: #
# $1 = TS.log #
# $2 = GenEcp.dat #
# #
# History: #
# 2018/08/23, Grace, rewrite. #
# 2020/10/05, Grace, add description and modify the structure of script. #
#############################################################################
function main(){
# 1. Extract necessary rawdata from Gaussian output files
# global variable: $method, $basis, $charge, $multi
method=''
basis=''
charge=''
multi=''
###
getCoord $1 # output: coord.tmp, and modify above global variables
# 2. Generate a series of IRC input files
# reference for parameters: https://gaussian.com/irc/
# global array
algoArr=(HPC EulerPC LQA DVV)
forceArr=(CalcFC CalcAll)
stepsizeArr=(2 5 10)
coordArr=(Cartesian) #(Internal Cartesian MW)
###
maxcycle=500
maxpoints=500
genIRC $2
}
function getCoord(){
# $1 = *.log; TS Gaussian output file
# Gaussian
rm -f coord.tmp
num=$(grep -w 'NAtoms' $1 | head -n 1 | awk '{print $2}' )
### sometimes, the keyword changes, fuck!
keywordCoord=('Input orientation:' 'Standard orientation:')
checkCoord=$(grep "${keywordCoord[0]}" $1)
[ -z "$checkCoord" ] && numOrien=1 || numOrien=0
grep -A $(($num+4)) "${keywordCoord[$numOrien]}" $1 | tail -n $num | \
awk '{print $2 "\t" $4 "\t" $5 "\t" $6}' > coord.tmp
###
basis=$(grep 'Standard basis' $1 | tail -n 1 | awk '{print $3}')
[ -z "$basis" ] && basis='GenEcp'
method=$(grep 'SCF Done:' $1 | tail -n 1 | awk '{print $3}' \
| sed 's/E(//g' | sed 's/)//g')
charge=$(grep Charge $1 | head -n 1 | awk '{print $3}')
multi=$(grep Multiplicity $1 | head -n 1 | awk '{print $6}')
}
function genIRC(){
# $1 = filename of ECP
n=0
for algo in `echo ${algoArr[@]}`
do
for force in `echo ${forceArr[@]}`
do
for stepsize in `echo ${stepsizeArr[@]}`
do
for coord in `echo ${coordArr[@]}`
do
n=$(($n+1))
name=$(echo "$algo"_"$force"_"$stepsize"_"$coord")
# echo $name
# cp TS_ET.Rot_Cs.chk $name.chk
#%chk=$name.chk
cat << EOF > $name.com
# $method/$basis IRC($algo,$force,$coord,Stepsize=$stepsize,maxcycle=$maxcycle,maxpoints=$maxpoints)
IRC forward
$charge $multi
EOF
cat coord.tmp >> $name.com
echo '' >> $name.com
[ -z $1 ] || cat `echo $1` >> $name.com
echo '' >> $name.com
#g09sub $name.com $name.log
done
done
done
done
echo "There are $n IRC Gaussian input files"
rm -f coord.tmp
}
main $@