parameters: (self, file, topology, dt, firstStep=0, interval=1, append=False)
docstring: Create a DCD file and write out the header, or open an existing file to append.
  
          Parameters
          ----------
          file : file
              A file to write to
          topology : Topology
              The Topology defining the molecular system being written
          dt : time
              The time step used in the trajectory
          firstStep : int=0
              The index of the first step in the trajectory
          interval : int=1
              The frequency (measured in time steps) at which states are written
              to the trajectory
          append : bool=False
              If True, open an existing DCD file to append to.  If False, create a new file.
docstring_summary: Create a DCD file and write out the header, or open an existing file to append.
docstring_tokens: Create a DCD file and write out the header or open an existing file to append .
function: def __init__(self, file, topology, dt, firstStep=0, interval=1, append=False):
          """Create a DCD file and write out the header, or open an existing file to append.
  
          Parameters
          ----------
          file : file
              A file to write to
          topology : Topology
              The Topology defining the molecular system being written
          dt : time
              The time step used in the trajectory
          firstStep : int=0
              The index of the first step in the trajectory
          interval : int=1
              The frequency (measured in time steps) at which states are written
              to the trajectory
          append : bool=False
              If True, open an existing DCD file to append to.  If False, create a new file.
          """
          self._file = file
          self._topology = topology
          self._firstStep = firstStep
          self._interval = interval
          self._modelCount = 0
          if is_quantity(dt):
              dt = dt.value_in_unit(picoseconds)
          dt /= 0.04888821
          self._dt = dt
          boxFlag = 0
          if topology.getUnitCellDimensions() is not None:
              boxFlag = 1
          if append:
              file.seek(8, os.SEEK_SET)
              self._modelCount = struct.unpack('<i', file.read(4))[0]
              file.seek(268, os.SEEK_SET)
              numAtoms = struct.unpack('<i', file.read(4))[0]
              if numAtoms != len(list(topology.atoms())):
                  raise ValueError('Cannot append to a DCD file that contains a different number of atoms')
          else:
              header = struct.pack('<i4c9if', 84, b'C', b'O', b'R', b'D', 0, firstStep, interval, 0, 0, 0, 0, 0, 0, dt)
              header += struct.pack('<13i', boxFlag, 0, 0, 0, 0, 0, 0, 0, 0, 24, 84, 164, 2)
              header += struct.pack('<80s', b'Created by OpenMM')
              header += struct.pack('<80s', b'Created '+time.asctime(time.localtime(time.time())).encode('ascii'))
              header += struct.pack('<4i', 164, 4, len(list(topology.atoms())), 4)
              file.write(header)
function_tokens: def __init__ ( self , file , topology , dt , firstStep = 0 , interval = 1 , append = False ) : self . _file = file self . _topology = topology self . _firstStep = firstStep self . _interval = interval self . _modelCount = 0 if is_quantity ( dt ) : dt = dt . value_in_unit ( picoseconds ) dt /= 0.04888821 self . _dt = dt boxFlag = 0 if topology . getUnitCellDimensions ( ) is not None : boxFlag = 1 if append : file . seek ( 8 , os . SEEK_SET ) self . _modelCount = struct . unpack ( '<i' , file . read ( 4 ) ) [ 0 ] file . seek ( 268 , os . SEEK_SET ) numAtoms = struct . unpack ( '<i' , file . read ( 4 ) ) [ 0 ] if numAtoms != len ( list ( topology . atoms ( ) ) ) : raise ValueError ( 'Cannot append to a DCD file that contains a different number of atoms' ) else : header = struct . pack ( '<i4c9if' , 84 , b'C' , b'O' , b'R' , b'D' , 0 , firstStep , interval , 0 , 0 , 0 , 0 , 0 , 0 , dt ) header += struct . pack ( '<13i' , boxFlag , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 24 , 84 , 164 , 2 ) header += struct . pack ( '<80s' , b'Created by OpenMM' ) header += struct . pack ( '<80s' , b'Created ' + time . asctime ( time . localtime ( time . time ( ) ) ) . encode ( 'ascii' ) ) header += struct . pack ( '<4i' , 164 , 4 , len ( list ( topology . atoms ( ) ) ) , 4 ) file . write ( header )