OpenMM
 All Classes Namespaces Functions Variables Pages
StateDataReporter Class Reference

StateDataReporter outputs information about a simulation, such as energy and temperature, to a file. More...

+ Inheritance diagram for StateDataReporter:

Public Member Functions

def __init__
 Create a StateDataReporter. More...
 
def describeNextReport
 Get information about the next report this object will generate. More...
 
def report
 Generate a report. More...
 
def __del__
 

Detailed Description

StateDataReporter outputs information about a simulation, such as energy and temperature, to a file.

To use it, create a StateDataReporter, then add it to the Simulation's list of reporters. The set of data to write is configurable using boolean flags passed to the constructor. By default the data is written in comma-separated-value (CSV) format, but you can specify a different separator to use.

Constructor & Destructor Documentation

def __init__ (   self,
  file,
  reportInterval,
  step = False,
  time = False,
  potentialEnergy = False,
  kineticEnergy = False,
  totalEnergy = False,
  temperature = False,
  volume = False,
  density = False,
  progress = False,
  remainingTime = False,
  speed = False,
  separator = ',
  systemMass = None,
  totalSteps = None 
)

Create a StateDataReporter.

Parameters
file(string or file) The file to write to, specified as a file name or file object
reportInterval(int) The interval (in time steps) at which to write frames
step(boolean=False) Whether to write the current step index to the file
time(boolean=False) Whether to write the current time to the file
potentialEnergy(boolean=False) Whether to write the potential energy to the file
kineticEnergy(boolean=False) Whether to write the kinetic energy to the file
totalEnergy(boolean=False) Whether to write the total energy to the file
temperature(boolean=False) Whether to write the instantaneous temperature to the file
volume(boolean=False) Whether to write the periodic box volume to the file
density(boolean=False) Whether to write the system density to the file
progress(boolean=False) Whether to write current progress (percent completion) to the file. If this is True, you must also specify totalSteps.
remainingTime(boolean=False) Whether to write an estimate of the remaining clock time until completion to the file. If this is True, you must also specify totalSteps.
speed(bool=False) Whether to write an estimate of the simulation speed in ns/day to the file
separator(string=',') The separator to use between columns in the file
systemMass(mass=None) The total mass to use for the system when reporting density. If this is None (the default), the system mass is computed by summing the masses of all particles. This parameter is useful when the particle masses do not reflect their actual physical mass, such as when some particles have had their masses set to 0 to immobilize them.
totalSteps(int=None) The total number of steps that will be included in the simulation. This is required if either progress or remainingTime is set to True, and defines how many steps will indicate 100% completion.

References StateDataReporter._density, StateDataReporter._hasInitialized, StateDataReporter._kineticEnergy, StateDataReporter._needEnergy, StateDataReporter._needsForces, StateDataReporter._needsPositions, StateDataReporter._needsVelocities, StateDataReporter._openedFile, PDBReporter._out, DCDReporter._out, CheckpointReporter._out, StateDataReporter._out, StateDataReporter._potentialEnergy, StateDataReporter._progress, StateDataReporter._remainingTime, PDBReporter._reportInterval, DCDReporter._reportInterval, CheckpointReporter._reportInterval, StateDataReporter._reportInterval, StateDataReporter._separator, StateDataReporter._speed, StateDataReporter._step, StateDataReporter._temperature, StateDataReporter._time, StateDataReporter._totalEnergy, StateDataReporter._totalMass, StateDataReporter._totalSteps, and StateDataReporter._volume.

def __del__ (   self)

References StateDataReporter._openedFile.

Member Function Documentation

def describeNextReport (   self,
  simulation 
)

Get information about the next report this object will generate.

Parameters
simulation(Simulation) The Simulation to generate a report for
Returns
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.

References StateDataReporter._needEnergy, StateDataReporter._needsForces, StateDataReporter._needsPositions, StateDataReporter._needsVelocities, PDBReporter._reportInterval, DCDReporter._reportInterval, CheckpointReporter._reportInterval, and StateDataReporter._reportInterval.

def report (   self,
  simulation,
  state 
)

Generate a report.

Parameters
simulation(Simulation) The Simulation to generate a report for
state(State) The current state of the simulation

References StateDataReporter._checkForErrors(), StateDataReporter._constructHeaders(), StateDataReporter._constructReportValues(), StateDataReporter._density, StateDataReporter._dof, StateDataReporter._hasInitialized, StateDataReporter._initialClockTime, StateDataReporter._initializeConstants(), StateDataReporter._initialSimulationTime, StateDataReporter._initialSteps, StateDataReporter._kineticEnergy, StateDataReporter._needEnergy, PDBReporter._out, DCDReporter._out, CheckpointReporter._out, StateDataReporter._out, StateDataReporter._potentialEnergy, StateDataReporter._progress, StateDataReporter._remainingTime, StateDataReporter._separator, StateDataReporter._speed, StateDataReporter._step, StateDataReporter._temperature, StateDataReporter._time, StateDataReporter._totalEnergy, StateDataReporter._totalMass, StateDataReporter._totalSteps, and StateDataReporter._volume.


The documentation for this class was generated from the following file: