Skip to content

Commit

Permalink
test_io: Test that you can read in a slice
Browse files Browse the repository at this point in the history
You can process a slice of frames in a trajectory.
  • Loading branch information
amritagos committed Sep 11, 2024
1 parent 3268f19 commit 7128710
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ def small_system():
return system


def test_read_slice():
"""
Tests that you can read in a slice of frames from a trajectory file
"""
test_dir = Path(__file__).resolve().parent
infilename = test_dir / "../resources/Fe3_water_cluster.lammpstrj"
# Read in the trajectory (the last index in the slice is non inclusive)
systems, timesteps = solu.io.read_lammps_dump(infilename, "1:3")

assert len(systems) == 2
assert timesteps == [5, 10]
assert systems[0].atoms[0].position == [22.4864, 31.2099, 29.1459]


def test_write_read_single_dump(small_system):
"""
Tests that you can write out and then read back in a System object containing two molecules.
Expand Down

0 comments on commit 7128710

Please sign in to comment.