mdtraj.formats.LAMMPSTrajectoryFile

class mdtraj.formats.LAMMPSTrajectoryFile(filename, mode='r', force_overwrite=True)

Interface for reading and writing to a LAMMPS lammpstrj files. This is a file-like object, that both reading or writing depending on the mode flag. It implements the context manager protocol, so you can also use it with the python ‘with’ statement.

Parameters
filenamestr

The filename to open. A path to a file on disk.

mode{‘r’, ‘w’}

The mode in which to open the file, either ‘r’ for read or ‘w’ for write.

force_overwritebool

If opened in write mode, and a file by the name of filename already exists on disk, should we overwrite it?

Methods

close(self)

Close the lammpstrj file.

parse_box(self, style)

Extract lengths and angles from a frame.

read(self[, n_frames, stride, atom_indices])

Read data from a lammpstrj file.

read_as_traj(self, topology[, n_frames, …])

Read a trajectory from a lammpstrj file

seek(self, offset[, whence])

Move to a new file position.

tell(self)

Current file position.

write(self, xyz, cell_lengths[, …])

Write one or more frames of data to a lammpstrj file.

write_box(self, lengths, angles, mins)

Write the box lines in the header of a frame.

__init__(self, filename, mode='r', force_overwrite=True)

Open a LAMMPS lammpstrj file for reading/writing.

Methods

__init__(self, filename[, mode, force_overwrite])

Open a LAMMPS lammpstrj file for reading/writing.

close(self)

Close the lammpstrj file.

parse_box(self, style)

Extract lengths and angles from a frame.

read(self[, n_frames, stride, atom_indices])

Read data from a lammpstrj file.

read_as_traj(self, topology[, n_frames, …])

Read a trajectory from a lammpstrj file

seek(self, offset[, whence])

Move to a new file position.

tell(self)

Current file position.

write(self, xyz, cell_lengths[, …])

Write one or more frames of data to a lammpstrj file.

write_box(self, lengths, angles, mins)

Write the box lines in the header of a frame.

Attributes

distance_unit