actions.CHARMMTrajectory() — write out a CHARMM trajectory

CHARMMTrajectory(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.WriteStructure(), 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.6You 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., ConjugateGradients() or MolecularDynamics()).

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 MolecularDynamics, 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 = MolecularDynamics(output='REPORT')
md.optimize(atmsel, temperature=300, max_iterations=100,
            actions=actions.CHARMMTrajectory(5, filename=code+'.dcd'))