Interface for reading and writing AMBER NetCDF files. This is a file-like object, that supports both reading and 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’}, default=’r’
force_overwrite : bool, default=False
|
---|
Methods
__init__(filename[, mode, force_overwrite]) | |
close() | |
flush() | |
read([atom_indices]) | Read data from an AMBER NetCDF restart file |
read_as_traj(topology[, atom_indices]) | Read an AMBER ASCII restart file as a trajectory. |
write(coordinates[, time, cell_lengths, ...]) | Write one frame of a MD trajectory to disk in the AMBER NetCDF restart file format. |
Attributes
distance_unit | |
n_atoms | |
n_frames |
Read an AMBER ASCII restart file as a trajectory.
Parameters: | topology : Topology
atom_indices : array_like, optional
|
---|---|
Returns: | trajectory : Trajectory
|
Read data from an AMBER NetCDF restart file
Parameters: | atom_indices : np.ndarray, dtype=int, optional
|
---|---|
Returns: | coordinates : np.ndarray, shape=(1, n_atoms, 3)
time : np.ndarray, None
cell_lengths : np.ndarray, None
cell_angles : np.ndarray, None
|
Notes
If the file is not a NetCDF file with the appropriate convention, a TypeError is raised. If variables that are needed do not exist or if illegal values are passed in for parameters, ValueError is raised. If I/O errors occur, IOError is raised.
Write one frame of a MD trajectory to disk in the AMBER NetCDF restart file format.
Parameters: | coordinates : np.ndarray, dtype=np.float32, shape=([1,] n_atoms, 3)
time : array-like with 1 element or float, optional
cell_lengths : np.ndarray, dtype=np.double, shape=([1,] 3)
cell_angles : np.ndarray, dtype=np.double, shape=([1,] 3)
|
---|
Notes
You must only have one frame to write to this file.