Interface for reading and writing to an AMBER BINPOS file. 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.
The conventional units in the BINPOS file are angstroms. The format only supports storing the cartesian coordinates.
Parameters: | filename : str
mode : {‘r’, ‘w’}
force_overwrite : bool
|
---|---|
Other Parameters: | |
min_chunk_size : int, default=100
chunk_size_multiplier : int, default=1.5
|
See also
Examples
>>> # copy data from one file to another
>>> with BINPOSTrajectoryFile('traj.binpos') as f:
>>> xyz = f.read()
>>> with BINPOSTrajectoryFile('out.binpos') as f:
>>> f.write(xyz)
x.__init__(...) initializes x; see help(type(x)) for signature
Methods
close | Close the BINPOS file |
read([n_frames, stride, atom_indices]) | Read data from a BINPOS file |
read_as_traj(topology[, n_frames, stride, ...]) | Read a trajectory from a BINPOS file |
seek(offset[, whence]) | Move to a new file position |
tell | Current file position |
write(xyz) | Write cartesian coordinates to a binpos file |
Attributes
distance_unit |
Close the BINPOS file
Read data from a BINPOS 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
|
Read a trajectory from a BINPOS file
Parameters: | topology : Topology
n_frames : int, None
stride : int, optional
atom_indices : array_like, optional
|
---|---|
Returns: | trajectory : Trajectory
|
See also
Move to a new file position
Parameters: | offset : int
whence : {0, 1, 2}
|
---|
Current file position
Returns: | offset : int
|
---|
Write cartesian coordinates to a binpos file
Parameters: | xyz : np.ndarray, dtype=np.float32, shape=(n_frames, n_atoms, 3)
|
---|