#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2021, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
assert tpr_source.output.parameters['nsteps'].result() == 2
-@pytest.mark.usefixtures('cleandir')
-def test_core_tprcopy_alt(spc_water_box):
- """Test gmx.core.copy_tprfile() for update of end_time.
-
- Set a new end time that is 5000 steps later than the original. Read dt
- from file to avoid floating point round-off errors.
-
- Transitively test gmx.fileio.read_tpr()
- """
- tpr_filename = spc_water_box
- additional_steps = 5000
- sim_input = read_tpr(tpr_filename)
- params = sim_input.parameters.extract()
- dt = params['dt']
- nsteps = params['nsteps']
- init_step = params['init-step']
- initial_endtime = (init_step + nsteps) * dt
- new_endtime = initial_endtime + additional_steps*dt
- _, temp_filename = tempfile.mkstemp(suffix='.tpr')
- gmxapi._gmxapi.rewrite_tprfile(source=tpr_filename, destination=temp_filename, end_time=new_endtime)
- tprfile = TprFile(temp_filename, 'r')
- with tprfile as fh:
- params = read_tpr(fh).parameters.extract()
- dt = params['dt']
- nsteps = params['nsteps']
- init_step = params['init-step']
- assert (init_step + nsteps) * dt == new_endtime
-
- os.unlink(temp_filename)
-
-
@pytest.mark.usefixtures('cleandir')
def test_write_tpr_file(spc_water_box):
"""Test gmx.fileio.write_tpr_file() using gmx.core API.