-
Notifications
You must be signed in to change notification settings - Fork 0
/
resp_stage1.sh
executable file
·87 lines (66 loc) · 1.81 KB
/
resp_stage1.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
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
#!/bin/bash
# Default arguements
NAME="MOL"
NETCHARGE=0
DIR=$(pwd)
HOME=$(pwd)
# Parse the command line
while getopts n:c:d:r: flag
do
case "${flag}" in
n) NAME=${OPTARG};;
c) NETCHARGE=${OPTARG};;
d) DIR=${OPTARG};;
r) RES=${OPTARG};;
esac
done
# If name.mol2 not in directrory, exit
usage () { echo "Usage: ./resp_stage1.sh -n NAME -c CHARGE -d DIRECTORY"; exit 1;}
# General resp protocol
gen_resp () {
if [ ! -f $1.pdb ]; then
usage
fi
grep -F -v CONECT $1.pdb > geo.pdb
sed -i -e 's/\FA/F /' geo.pdb
sed -i -e 's/\FB/F /' geo.pdb
sed -i -e 's/\FC/F /' geo.pdb
sed -i -e 's/\FD/F /' geo.pdb
sed -i -e 's/\FE/F /' geo.pdb
sed -i -e 's/\FF/F /' geo.pdb
sed -i -e 's/\FG/F /' geo.pdb
sed -i -e 's/CL/C /' geo.pdb
# Generate Gaussian input file, single point HF/6-31*
antechamber -i geo.pdb -fi pdb -o geo.dat -fo gcrt -gv 1 -ge geo.gesp
sed -i -e 's/\opt//' geo.dat
sed -i -e "s/\0 1/${NETCHARGE} 1/" geo.dat
sed -i -e "s/\ 1 1/${NETCHARGE} 1/" geo.dat
#./run_job.sh rung16 geo.dat
# Convert from Guassian electrostatic potential
espgen -i geo.gesp -o geo.esp
# 1st and 2nd iteration of the RESP procedure
resp -O -i resp1.in -o resp1.out -p resp1.pch -t resp1.chg -q resp.qin -e geo.esp
resp -O -i resp2.in -o resp2.out -p resp2.pch -t resp2.chg -q resp1.chg -e geo.esp
}
cp run_job.sh $DIR
cd $DIR
# Get all the stage 1 folders in an array
folders=`ls -d ./stage1*`
folders=( $folders )
if [ -z $folders ]; then
usage
fi
# Multiple primary conformations
for conform in ${folders[@]}; do
cp run_job.sh resp* $conform
cd $conform
gen_resp $NAME
cd ..
done
# In case the name and residue ID differ
if [ -z "$RES" ]; then
RES=$NAME
fi
cd $HOME
python ave_charges.py $NAME $DIR $RES
exit 0