openmmforcefields
openmmforcefields copied to clipboard
GPU acceleration
Can AMBER be accelerated by GPU in the openmm environment? or no
Yes. All calculations are supported on GPUs.
Do you want to bring AMBER input files from the AMBER ecosystem, or do you want to apply AMBER parameters to a PDB file within the OpenMM ecosystem?
I would like to use gpu GAFF on an RDKit small molecule @jchodera . Do you have any guidelines or starter code for how I might implement this?
Sure! You can use this example, and just preface it with code to convert your RDKit molecule (let's call it rdmol
) to an Open Force Field Molecule
:
from openforcefield.topology import Molecule
molecule = Molecule.from_rdkit(rdmol)
The rest of the code is the same as in the example!
awesome @jchodera. I'm assuming there's a similar to_rdkit function to get the minimized conformer(s) back?
Getting an error, wondering if you know anything about it.
Edit: @jchodera still struggling with the same problem, wondering if you have any insight.
AllChem.EmbedMultipleConfs(molOrig)
Chem.rdmolops.AssignAtomChiralTagsFromStructure(molOrig)
from openforcefield.topology import Molecule
molecule = Molecule.from_rdkit(molOrig)
forcefield_kwargs = { 'constraints' : app.HBonds, 'rigidWater' : True, 'removeCMMotion' : False, 'hydrogenMass' : 4*unit.amu }
# Initialize a SystemGenerator using GAFF
from openmmforcefields.generators import SystemGenerator
system_generator = SystemGenerator(forcefields=['amber/ff14SB.xml', 'amber/tip3p_standard.xml'], small_molecule_forcefield='gaff-2.11', forcefield_kwargs=forcefield_kwargs, cache='db.json')
# Create an OpenMM System from an Open Force Field toolkit Topology object
system = system_generator.create_system(molecule.to_topology())
Produces error:
AttributeError Traceback (most recent call last)
<ipython-input-17-f0ca2e3ce49f> in <module>
4 system_generator = SystemGenerator(forcefields=['amber/ff14SB.xml', 'amber/tip3p_standard.xml'], small_molecule_forcefield='gaff-2.11', forcefield_kwargs=forcefield_kwargs, cache='db.json')
5 # Create an OpenMM System from an Open Force Field toolkit Topology object
----> 6 system = system_generator.create_system(molecule.to_topology())
7
8
~/.conda/envs/my-rdkit-env/lib/python3.6/site-packages/openmmforcefields/generators/system_generators.py in create_system(self, topology, molecules)
299 import copy
300 forcefield_kwargs = copy.deepcopy(self.forcefield_kwargs)
--> 301 if topology.getPeriodicBoxVectors() is None:
302 forcefield_kwargs.update(self.nonperiodic_forcefield_kwargs)
303 else:
AttributeError: 'Topology' object has no attribute 'getPeriodicBoxVectors'
Using openmm topology produces a different error:
It looks like it's expecting a protein, but I am trying to use GAFF for small molecules.
Also dealing with a separate error if I do not EmbedMolecules into 3d in RDKit before I convert to openff topology: