mdtraj.formats.NetCDFTrajectoryFile

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

Interface for reading and writing to AMBER NetCDF files. This is a file-like object, that supports 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 name of the file to open

mode{‘r’, ‘w’}, default=’r’

The mode in which to open the file. Valid options are ‘r’ and ‘w’ for ‘read’ and ‘write’, respectively.

force_overwritebool, default=False

In write mode, if a file named filename already exists, clobber it and overwrite it.

Attributes
n_atoms
n_frames

Methods

close(self)

Close the NetCDF file handle

flush(self)

Write all buffered data in the to the disk file.

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

Read data from a molecular dynamics trajectory in the AMBER NetCDF format.

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

Read a trajectory from a NetCDF file

seek(self, offset[, whence])

Move to a new file position

tell(self)

Current file position

write(self, coordinates[, time, …])

Write one or more frames of a molecular dynamics trajectory to disk in the AMBER NetCDF format.

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

Initialize self. See help(type(self)) for accurate signature.

Methods

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

Initialize self.

close(self)

Close the NetCDF file handle

flush(self)

Write all buffered data in the to the disk file.

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

Read data from a molecular dynamics trajectory in the AMBER NetCDF format.

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

Read a trajectory from a NetCDF file

seek(self, offset[, whence])

Move to a new file position

tell(self)

Current file position

write(self, coordinates[, time, …])

Write one or more frames of a molecular dynamics trajectory to disk in the AMBER NetCDF format.

Attributes

distance_unit

n_atoms

n_frames