Commit dbd7fd3a authored by peastman's avatar peastman
Browse files

Merge pull request #715 from mpharrigan/py3

Python 3 compatitbility
parents 20f00d80 47b73dfd
...@@ -70,10 +70,10 @@ class DCDFile(object): ...@@ -70,10 +70,10 @@ class DCDFile(object):
boxFlag = 0 boxFlag = 0
if topology.getUnitCellDimensions() is not None: if topology.getUnitCellDimensions() is not None:
boxFlag = 1 boxFlag = 1
header = struct.pack('<i4c9if', 84, 'C', 'O', 'R', 'D', 0, firstStep, interval, 0, 0, 0, 0, 0, 0, dt) header = struct.pack('<i4c9if', 84, b'C', b'O', b'R', b'D', 0, firstStep, interval, 0, 0, 0, 0, 0, 0, dt)
header += struct.pack('<13i', boxFlag, 0, 0, 0, 0, 0, 0, 0, 0, 24, 84, 164, 2) header += struct.pack('<13i', boxFlag, 0, 0, 0, 0, 0, 0, 0, 0, 24, 84, 164, 2)
header += struct.pack('<80s', 'Created by OpenMM') header += struct.pack('<80s', b'Created by OpenMM')
header += struct.pack('<80s', 'Created '+time.asctime(time.localtime(time.time()))) header += struct.pack('<80s', b'Created '+bytes(time.asctime(time.localtime(time.time())), 'ascii'))
header += struct.pack('<4i', 164, 4, len(list(topology.atoms())), 4) header += struct.pack('<4i', 164, 4, len(list(topology.atoms())), 4)
file.write(header) file.write(header)
......
...@@ -99,7 +99,7 @@ class StateDataReporter(object): ...@@ -99,7 +99,7 @@ class StateDataReporter(object):
raise RuntimeError("Cannot write .bz2 file because Python could not import bz2 library") raise RuntimeError("Cannot write .bz2 file because Python could not import bz2 library")
self._out = bz2.BZ2File(file, 'w', 0) self._out = bz2.BZ2File(file, 'w', 0)
else: else:
self._out = open(file, 'w', 0) self._out = open(file, 'w')
else: else:
self._out = file self._out = file
self._step = step self._step = step
......
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