Dump File ReaderΒΆ

The DumpFileReader processes LAMMPS trajectory files. Is has a practical interface to read frames from a trajectory file and access them as Universe objects in the UniverseSequence class.

Trajectory contains 1 frames
Dump file contains 3 frames

import os

from pylimer_tools_cpp import DumpFileReader, UniverseSequence

# Load trajectory data
sequence = UniverseSequence()
file_path = os.path.join(
    os.getcwd(),
    "../..",
    "tests/pylimer_tools/fixtures/",
)
sequence.initialize_from_dump_file(
    initial_data_file=os.path.join(file_path, "lammps_data_file_small.out"),
    dump_file=os.path.join(file_path, "lammps_dump_small.lammpstrj"),
)

print(f"Trajectory contains {len(sequence)} frames")

# Access specific frames
first_frame = sequence.at_index(0)
last_frame = sequence.at_index(len(sequence) - 1)  # Last frame

dump_file_reader = DumpFileReader(
    os.path.join(file_path, "lammps_dump_small_3step.lammpstrj")
)
print(f"Dump file contains {dump_file_reader.get_length()} frames")

Total running time of the script: (0 minutes 0.002 seconds)

Gallery generated by Sphinx-Gallery