Closed mattwthompson closed 2 years ago
I had more success exploiting the Python API; no error, although I also did not check the output system.
ff14sb_off_remapped_impropers.txt
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from simtk.openmm.app import PDBFile
from openff.toolkit.utils import get_data_file_path
from openff.toolkit.topology import Molecule, Topology
from openff.toolkit.typing.engines.smirnoff import ForceField
t4 = Molecule.from_file(get_data_file_path('proteins/T4-protein.sdf'))
ff = ForceField('ff14sb_off_impropers_0.0.1.offxml')
# In[2]:
import re
impropers = ff.get_parameter_handler("ImproperTorsions")
for imp in impropers.parameters:
imp.smirks = re.sub("(:[23])(.+)(:[23])", r"\3\2\1", imp.smirks)
# In[3]:
ff.create_openmm_system(t4.to_topology())
# Out[3]:
<simtk.openmm.openmm.System; proxy of <Swig Object of type 'OpenMM::System *' at 0x7f8263ede1e0> >
Yeah, I was getting this locally too. I think @lilyminium's solution is the right one (switching :2
s with :3
s throughout the impropers section, though I'm not sure that we can safely change parameter SMIRKS in-place). Sorry about the sloppiness of that file in the initial release.
though I'm not sure that we can safely change parameter SMIRKS in-place
You could give loading the forcefield from the remapped file a try -- if that passes any tests you have in place, it could just get released as a fix.
This has been fixed in the ff14sb_off_impropers_0.0.2.offxml
file in release 0.0.2
(And the improper-fixing and validation code was piggybacked onto the parameter deduplication notebook in #34 )
Thanks ! Conda packages coming soon ...
Using https://github.com/openforcefield/openff-toolkit/pull/951/commits/7fb46c7ff6b7a49a6c04ef10956c66f790f7673e
In:
Out:
The source of the error is an improper:
ff.get_parameter_handler('ImproperTorsions')._INFOTYPE._VALENCE_TYPE = None
did not fix it@j-wags has suggested it might be due to where in the SMIRKS patterns the central atoms are specified. I tried swapping indices 2 and 3, but that produces the same error. I could have screwed up the editing of the file; I don't really want to check hundreds of lines of XMLs by hand.
test.offxml.txt