Skip to content

Commit ac51c37

Browse files
committed
Test: Check for missing coordinates in LAMMPS DumpReader
1 parent 9cbc8ea commit ac51c37

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

testsuite/MDAnalysisTests/coordinates/test_lammps.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,3 +990,21 @@ def test_box(self, u_dump, u_data, reference_box):
990990
)
991991

992992
assert_allclose(u_data.dimensions, reference_box, rtol=1e-5, atol=0)
993+
def test_missing_coords_error(tmpdir):
994+
# creating a dummy lammps file without x, y, z columns
995+
f = tmpdir.join("bad_lammps.dump")
996+
f.write("""ITEM: TIMESTEP
997+
0
998+
ITEM: NUMBER OF ATOMS
999+
1
1000+
ITEM: BOX BOUNDS pp pp pp
1001+
0.0 10.0
1002+
0.0 10.0
1003+
0.0 10.0
1004+
ITEM: ATOMS id type
1005+
1 1
1006+
""")
1007+
1008+
# reader should raise ValueError because coordinates are missing
1009+
with pytest.raises(ValueError, match="No coordinate information"):
1010+
mda.coordinates.LAMMPS.DumpReader(str(f))

0 commit comments

Comments
 (0)