forked from ZimmermanGroup/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHARMMPDB
66 lines (41 loc) · 1.36 KB
/
CHARMMPDB
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
#This script converts a .xyz file to a CHARMM formatted .pdb file
#If the files are not formatted properly, CHARMM calculations will crash
#!/bin/bash
# f is using Babel to convert .xyz to .pdb
# g is using grep to remove lines w/a particular phrase
# h is for converting HETATM to ATOM (plus two spaces)
# i is for removing the 11th column, but retaining the table format (otherwise the file is no good)
# j is for adding a new 11th column w/the correct formatting (six spaces)
module load Babel/2.3.2
mkdir backup
cp *xyz backup
for f in *xyz
do
babel $f -opdb -m
mv *pdb new.pdb
done
for g in new.pdb
do
grep -v "\bCOMPND\b" $g > $g.tmp
grep -v "\bAUTHOR\b" $g.tmp > $g.tmp.tmp
grep -v "\bCONECT\b" $g.tmp.tmp > $g.tmp.tmp.tmp
grep -v "\bMASTER\b" $g.tmp.tmp.tmp > $g.tmp.tmp.tmp.tmp
grep -v "\bEND\b" $g.tmp.tmp.tmp.tmp > new.pdb
rm -f $g.tmp $g.tmp.tmp $g.tmp.tmp.tmp $g.tmp.tmp.tmp.tmp
done
for h in new.pdb
do
sed -i -e 's/HETATM/ATOM /g' $h
done
for i in new.pdb
do
awk '{ printf "%-10s%-3d%-4s%-8s%-1d %6.3f %6.3f %6.3f %-4.2f %-4.2f\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10 }' new.pdb > new.edit
mv new.edit new.pdb
done
for j in new.pdb
do
sed 's/$/ SUB/' new.pdb > new.tmp
mv new.tmp $f
mv $f tropcsubstrate.pdb
done
rm -f new.pdb