mdtraj.reporters.NetCDFReporter

class mdtraj.reporters.NetCDFReporter(file, reportInterval, coordinates=True, time=True, cell=True, atomSubset=None)[source]

NetCDFReporter stores a molecular dynamics trajectory in the AMBER NetCDF format.

Parameters:
  • file (str, or NetCDFTrajectoryFile) – Either an open NetCDFTrajectoryFile object to write to, or a string specifying the filename of a new NetCDF file

  • reportInterval (int) – The interval (in time steps) at which to write frames.

  • coordinates (bool) – Whether to write the coordinates to the file.

  • time (bool) – Whether to write the current time to the file.

  • cell (bool) – Whether to write the current unitcell dimensions to the file.

  • atomSubset (array_like, default=None) – Only write a subset of the atoms, with these (zero based) indices to the file. If None, all of the atoms will be written.

Examples

>>> simulation = Simulation(topology, system, integrator)
>>> nc_reporter = NetCDFReporter('traj.h5', 100)
>>> simulation.reporters.append(nc_reporter)
>>> simulation.step(10000)
>>> traj = mdtraj.trajectory.load('traj.nc')
Attributes:
backend

Methods

close()

Close the underlying trajectory file

describeNextReport(simulation)

Get information about the next report this object will generate.

report(simulation, state)

Generate a report.

__init__(file, reportInterval, coordinates=True, time=True, cell=True, atomSubset=None)[source]

Create a NetCDFReporter.

Methods

__init__(file, reportInterval[, ...])

Create a NetCDFReporter.

close()

Close the underlying trajectory file

describeNextReport(simulation)

Get information about the next report this object will generate.

report(simulation, state)

Generate a report.

Attributes

backend