-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgengmxtop.py
More file actions
executable file
·37 lines (34 loc) · 937 Bytes
/
Copy pathgengmxtop.py
File metadata and controls
executable file
·37 lines (34 loc) · 937 Bytes
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
#!/usr/bin/python
import sys,os
usage='''
Generate gromacs top file , firstly use tleap to get amber paramters, then translate to gmxtop by amb2gmx.pl
Usage $0 rec.pdb ssbond.list outputname
# e.g. outputname=rec, then output will be rec.gro and rec.top
'''
if len(sys.argv)<4:
print usage
sys.exit()
infile,ssfile,outname=sys.argv[1:4]
sslist=list()
for line in open(ssfile,"r"):
a,b=line.split()
sslist.append((a,b))
ofp=open("gengmxtop_leap.in","w")
head='''
source leaprc.ff99SB
rec = loadpdb %s
'''%infile
tail='''
savepdb rec gengmxtop_tmp.pdb
saveamberparm rec prmtop inpcrd
quit
'''
ofp.write(head)
for (i,j) in sslist:
ofp.write("bond rec.%s.SG rec.%s.SG\n"%(i,j))
ofp.write("remove rec.%s rec.%s.HG\n"%(i,i))
ofp.write("remove rec.%s rec.%s.HG\n"%(j,j))
ofp.write(tail)
ofp.close()
os.system("tleap -f gengmxtop_leap.in")
os.system("amb2gmx.pl --prmtop prmtop --crd inpcrd --outname %s"%outname)