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: | filename : str
mode : {‘r’, ‘w’}
force_overwrite : bool
|
---|
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 |
Close the xyz file.
Read a trajectory from a XYZ file
Parameters: | topology : Topology
n_frames : int, optional
stride : np.ndarray, optional
atom_indices : array_like, optional
|
---|---|
Returns: | trajectory : Trajectory
|
Read data from a xyz file.
Parameters: | n_frames : int, None
stride : np.ndarray, optional
atom_indices : array_like, optional
|
---|---|
Returns: | xyz : np.ndarray, shape=(n_frames, n_atoms, 3), dtype=np.float32 |
Write one or more frames of data to a xyz file.
Parameters: | xyz : np.ndarray, shape=(n_frames, n_atoms, 3)
types : np.ndarray, shape(3, )
|
---|
Move to a new file position.
Parameters: | offset : int
whence : {0, 1, 2}
|
---|
Current file position.
Returns: | offset : int
|
---|