mdtraj.reporters.NetCDFReporter

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

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')
__init__(file, reportInterval, coordinates=True, time=True, cell=True, atomSubset=None)

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
close()

Close the underlying trajectory file

describeNextReport(simulation)

Get information about the next report this object will generate.

Parameters:

simulation : simtk.openmm.app.Simulation

The Simulation to generate a report for

Returns:

report_description : tuple

A five element tuple. The first element is the number of steps until the next report. The remaining elements specify whether that report will require positions, velocities, forces, and energies respectively.

report(simulation, state)

Generate a report.

Parameters:

simulation : simtk.openmm.app.Simulation

The Simulation to generate a report for

state : simtk.openmm.State

The current state of the simulation

Versions