-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcenter.py
More file actions
executable file
·36 lines (31 loc) · 768 Bytes
/
Copy pathcenter.py
File metadata and controls
executable file
·36 lines (31 loc) · 768 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
#!/usr/bin/python
import sys,os
infile = sys.argv[1]
tmpgro = 'TMP.gro'
tmppdb = 'TMP.pdb'
gmx = 'gmx'
# get box size
if infile[-3:] == 'gro':
last = None
for line in open(infile):
last = line
print last
x,y,z = last.split()
x = float(x)
y = float(y)
z = float(z)
tmp = tmpgro
elif infile[-3:] == 'pdb':
cryst1 = None
for line in open(infile):
if 'CRYST1' in line :
cryst1 = line
print cryst1
x = float(cryst1.split()[1])/10.
y = float(cryst1.split()[2])/10.
z = float(cryst1.split()[3])/10.
tmp = tmppdb
os.system("cp %s %s"%(infile,tmp))
os.system("%s editconf -f %s -o %s -center %f %f %f "%(gmx,tmp,infile,x/2.,y/2.,z/2.) )
os.system("rm %s"%tmp)
print "Done"