Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Changes
* Maximum pinned versions in setup.py removed for python 3.6+ (PR #3139)

Deprecations
* ParmEdConverter no longer accepts Timestep objects at all
(Issue #3031, PR #3172)
* NCDFWriter `scale_factor` writing will change in version 2.0 to
better match AMBER outputs (Issue #2327)
* Deprecated using the last letter of the segid as the
Expand Down
6 changes: 4 additions & 2 deletions package/MDAnalysis/coordinates/ParmEd.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import functools
import itertools
import warnings
from six import raise_from

from . import base
from ..topology.tables import SYMB2Z
Expand Down Expand Up @@ -174,9 +175,10 @@ def convert(self, obj):
ag_or_ts = obj.atoms
except AttributeError:
if isinstance(obj, base.Timestep):
ag_or_ts = obj.copy()
raise ValueError("Writing Timesteps to ParmEd "
"objects is not supported")
else:
raise_from(TypeError("No Timestep found in obj argument"), None)
raise_from(TypeError("No atoms found in obj argument"), None)

# Check for topology information
missing_topology = []
Expand Down
15 changes: 15 additions & 0 deletions testsuite/MDAnalysisTests/coordinates/test_parmed.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

from MDAnalysisTests.coordinates.base import _SingleFrameReader
from MDAnalysisTests.coordinates.reference import RefAdKSmall
from MDAnalysis.coordinates.ParmEd import ParmEdConverter

from MDAnalysisTests.datafiles import (
GRO,
Expand Down Expand Up @@ -288,3 +289,17 @@ class TestParmEdConverterPDB(BaseTestParmEdConverter):
def test_equivalent_coordinates(self, ref, output):
assert_almost_equal(ref.coordinates, output.coordinates, decimal=3)


def test_pass_ts_error():
u = mda.Universe(PDB_small)
err = "Writing Timesteps to ParmEd objects is not supported"
with pytest.raises(ValueError, match=err):
c = ParmEdConverter()
c.convert(u.trajectory.ts)


def test_incorrect_object_passed_typeerror():
err = "No atoms found in obj argument"
with pytest.raises(TypeError, match=err):
c = ParmEdConverter()
c.convert("we still don't support emojis :(")