choderalab / openmoltools

An open set of tools for automating tasks relating to small molecules
MIT License
63 stars 30 forks source link

Add new OEGAFFTemplateGenerator #285

Closed jchodera closed 4 years ago

jchodera commented 5 years ago

This PR adds a new, robust residue template generator plugin for the OpenMM ForceField class that uses OpenEye OEMols to represent known small molecules that are matched to residues encountered in the Topology lacking parameters.

Here are some examples of its use:

Create a template generator for GAFF for a single OEMol and register it with ForceField:

from openmoltools.forcefield_generators import OEGAFFTemplateGenerator
template_generator = OEGAFFTemplateGenerator(oemols=oemol)
from simtk.openmm.app import ForceField
forcefield = ForceField('gaff.xml', 'amber14-all.xml', 'tip3p.xml')
forcefield.registerTemplateGenerator(template_generator.generator)

Create a template generator for GAFF2 for multiple OEMols:

template_generator = OEGAFFTemplateGenerator(oemols=[oemol1, oemol2], gaff_version='gaff2')

You can also some OEMols later on after the generator has been registered:

forcefield.add_oemols(oemol)
forcefield.add_oemols([oemol1, oemol2])

You can optionally create or use a tiny database cache of pre-parameterized molecules:

template_generator = OEGAFFTemplateGenerator(cache='gaff-molecules.json')

Newly parameterized molecules will be written to the cache, saving time next time!

I've also updated the generateResidueTemplate() method to use the new OEAM1BCCELF10Charges scheme in the latest OpenEye release.

jchodera commented 5 years ago

Hm, I'm not sure why everything segfaults on travis.

@andrrizzi : Would you be able to quickly review the main part of this PR? This is the new forcefield generator in openmoltools/forcefield_generators.py that uses OEMols.

jchodera commented 5 years ago

@andrrizzi : Thanks for the feedback! I've fixed this in https://github.com/choderalab/perses/pull/536 and will backport my changes here.

jchodera commented 4 years ago

This has been deprecated in favor of http://github.com/openmm/openmmforcefields