Unverified Commit fed44c57 authored by Zheng GONG's avatar Zheng GONG Committed by GitHub
Browse files

XTCReporter overwrites existing xtc file (#4657)

* XTCReporter overwrite existing xtc file

* add position size check for xtcfile
parent 462a9be3
......@@ -99,6 +99,8 @@ class XTCFile(object):
raise ValueError(
"Particle position is infinite. For more information, see https://github.com/openmm/openmm/wiki/Frequently-Asked-Questions#nan"
)
if (np.abs(positions * 1000) > (2 ** 31 - 1)).any():
raise ValueError("Particle position is too large for XTC format")
self._modelCount += 1
if (
......
......@@ -29,6 +29,8 @@ class XTCReporter(object):
self._enforcePeriodicBox = enforcePeriodicBox
self._fileName = file
self._xtc = None
if not append:
open(file, 'wb').close()
def describeNextReport(self, simulation):
"""Get information about the next report this object will generate.
......
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