def simpleTemplateGenerator(forcefield, residue): """\ Simple residue template generator. This implementation uses the programmatic API to define residue templates. NOTE: We presume we have already loaded the force definitions into ForceField. """ # Generate a unique prefix name for generating parameters. from uuid import uuid4 template_name = uuid4() # Create residue template. from simtk.openmm.app.forcefield import _createResidueTemplate template = _createResidueTemplate(residue) # use helper function template.name = template_name # replace template name for (template_atom, residue_atom) in zip(template.atoms, residue.atoms()): template_atom.type = 'XXX' # replace atom type # Register the template. forcefield.registerResidueTemplate(template) # Signal that we have successfully parameterized the residue. return True