Commit dd5c7aae authored by Jan Kosinski's avatar Jan Kosinski
Browse files

Fix ANISOU in transform pdb

parent 77bb635c
......@@ -39,20 +39,21 @@ def transform(pdbfilename, rot, trans, trans_first=False):
with open(pdbfilename) as f:
for line in f:
if is_coord_line(line):
x = line[30:38]
y = line[38:46]
z = line[46:54]
coord = numpy.array((x, y, z), "f")
if trans_first:
coord = trans + numpy.dot(coord, rot)
else:
coord = numpy.dot(coord, rot)+trans
new_x = '{1:8.{0}f}'.format(2 if coord[0]<0 else 3,coord[0])
new_y = '{1:8.{0}f}'.format(2 if coord[1]<0 else 3,coord[1])
new_z = '{1:8.{0}f}'.format(2 if coord[2]<0 else 3,coord[2])
line = line[:30] + new_x + new_y + new_z + line[54:]
if not line.startswith('ANISOU'):
x = line[30:38]
y = line[38:46]
z = line[46:54]
coord = numpy.array((x, y, z), "f")
if trans_first:
coord = trans + numpy.dot(coord, rot)
else:
coord = numpy.dot(coord, rot)+trans
new_x = '{1:8.{0}f}'.format(2 if coord[0]<0 else 3,coord[0])
new_y = '{1:8.{0}f}'.format(2 if coord[1]<0 else 3,coord[1])
new_z = '{1:8.{0}f}'.format(2 if coord[2]<0 else 3,coord[2])
line = line[:30] + new_x + new_y + new_z + line[54:]
outlines.append(line)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment