## actions.charmm_trajectory() — write out a CHARMM trajectory

`charmm_trajectory(skip, filename, first=False, last=False)`

> This action writes out a trajectory file in CHARMM or X-PLOR format. This is more efficient than actions.write_structure(), as binary files are smaller than multiple PDB files, and only the moving (selected) atom coordinates are written at each step after the first. Binary trajectory files can be read in by visualization software such as CHIMERA or VMD. 6.5You will typically also need a CHARMM-format `PSF` file to accompany the trajectory, which you can obtain with model.write_psf().

> To use, create a `charmm_trajectory` object, and pass it in the actions argument to an optimizer object (e.g., conjugate_gradients() or molecular_dynamics()).

> If first is `True`, then the structure at step 0 (before the optimization) is also written out. If last is `True`, then the structure of the last step is written, regardless of whether it is a multiple of skip. By default, both are `False`.

Example: examples/python/trajectory.py

      # Example for PSF and binary trajectory output

      from modeller import *
      from modeller.scripts import complete_pdb
      from modeller.optimizers import molecular_dynamics, actions

      env = environ()
      env.io.atom_files_directory = ['../atom_files']
      env.edat.dynamic_sphere = True
      env.libs.topology.read(file='$(LIB)/top_heav.lib')
      env.libs.parameters.read(file='$(LIB)/par.lib')

      code = '1fas'
      mdl = complete_pdb(env, code)

      # Stereochemical restraints on all atoms:
      atmsel = selection(mdl)
      mdl.restraints.make(atmsel, restraint_type='stereo', spline_on_site=False)

      # Write a PSF
      mdl.write_psf(code+'.psf')

      # Run 100 steps of MD, writing a CHARMM binary trajectory every 5 steps
      md = molecular_dynamics(output='REPORT')
      md.optimize(atmsel, temperature=300, max_iterations=100,
                  actions=actions.charmm_trajectory(5, filename=code+'.dcd'))