mdtraj.formats.XYZTrajectoryFile

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

Interface for reading and writing to xyz 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:
filenamepath-like

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()

Close the xyz file.

read([n_frames, stride, atom_indices])

Read data from a xyz file.

read_as_traj(topology[, n_frames, stride, ...])

Read a trajectory from a XYZ file

seek(offset[, whence])

Move to a new file position.

tell()

Current file position.

write(xyz[, types])

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

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

Open a xyz file for reading/writing.

Methods

__init__(filename[, mode, force_overwrite])

Open a xyz file for reading/writing.

close()

Close the xyz file.

read([n_frames, stride, atom_indices])

Read data from a xyz file.

read_as_traj(topology[, n_frames, stride, ...])

Read a trajectory from a XYZ file

seek(offset[, whence])

Move to a new file position.

tell()

Current file position.

write(xyz[, types])

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

Attributes

distance_unit