thiophene gets only 1 C atom type, but 2 different C-C bond lengths
See original GitHub issueHi folks, I am working towards a python-based workflow for the parameterisation of a library of aromatic polymer fragments. In the past, I used exclusively ambertools/tleap but I would like to speed up and automatise my workflow, hence my interest in openff-toolkit.
Describe the bug
In the example below, I try to get a topology file for thiophene starting from SMILES. However the resulting file (attached) contains only 1 carbon type, C1. To my surprise I get 2 different H types, H1 and H2:
; name at.num mass charge ptype sigma epsilon
C1 6 12.010780 0.00000000 A 0.34806469 0.36350306
S1 16 32.065500 0.00000000 A 0.35635949 1.046
H1 1 1.007947 0.00000000 A 0.24536265 0.054839681
H2 1 1.007947 0.00000000 A 0.25725815 0.06531786
on the other hand, the topology correctly differentiates between the 2 kinds of C-C bonds:
[ bonds ]
; ai aj funct c0 c1 c2 c3
1 2 1 0.13717 334016.498332
2 3 1 0.14546 233580.248618
3 4 1 0.13717 334016.498332
4 5 1 0.17602 225745.023800
5 1 1 0.17602 225745.023800
1 6 1 0.10854 332422.631675
2 7 1 0.10854 332422.631675
3 8 1 0.10854 332422.631675
4 9 1 0.10854 332422.631675
To Reproduce
import parmed
from openff.toolkit.topology import Molecule, Topology
from openff.toolkit.typing.engines.smirnoff import ForceField
forcefield = ForceField("openff_unconstrained-2.0.0.offxml")
mol = Molecule.from_smiles('c1cccs1')
top = Topology.from_molecules(mol)
sys = forcefield.create_openmm_system(top)
structure = parmed.openmm.load_topology(top.to_openmm(), system=sys)
structure.residues[0].name = "RES"
structure.save('test_thio.top')
This ambiguity in the topology results in an error when I try and write amber files with parmed:
structure.save('test_thio.prmtop')
test = parmed.load_file('test_thio.prmtop')
parmed.tools.actions.writeFrcmod(test, 'test_thio.frcmod').execute()
Output
---------------------------------------------------------------------------
ParameterError Traceback (most recent call last)
Input In [87], in <cell line: 1>()
----> 1 parmed.tools.actions.writeFrcmod(test, 'test_thio.frcmod').execute()
File ~/anaconda3/envs/mamba/envs/mdapsikit/lib/python3.9/site-packages/parmed/tools/actions.py:344, in writeFrcmod.execute(self)
342 if not Action.overwrite and os.path.exists(self.frcmod_name):
343 raise FileExists('%s exists; not overwriting' % self.frcmod_name)
--> 344 parmset = AmberParameterSet.from_structure(self.parm)
345 title = 'Force field parameters from %s' % os.path.split(str(self.parm))[1]
346 parmset.write(self.frcmod_name, title=title)
File ~/anaconda3/envs/mamba/envs/mdapsikit/lib/python3.9/site-packages/parmed/amber/parameters.py:364, in AmberParameterSet.from_structure(cls, struct)
349 @classmethod
350 def from_structure(cls, struct):
351 """ Extracts known parameters from a Structure instance
352
353 Parameters
(...)
362 The parameter set with all parameters defined in the Structure
363 """
--> 364 return super(AmberParameterSet, cls).from_structure(struct, allow_unequal_duplicates=False)
File ~/anaconda3/envs/mamba/envs/mdapsikit/lib/python3.9/site-packages/parmed/parameters.py:228, in ParameterSet.from_structure(cls, struct, allow_unequal_duplicates)
226 if key in params.bond_types:
227 if not allow_unequal_duplicates and params.bond_types[key] != bond.type:
--> 228 raise ParameterError('Unequal bond types defined between %s and %s' % key)
229 continue # pragma: no cover
230 typ = copy(bond.type)
ParameterError: Unequal bond types defined between C1 and C1
Copying the parmed error is a bit of a tangent, but I hope you don’t mind. My overall goal is to save each small fragment as a library file and build polymers by mixing and matching - not sure whether this could be achieved entirely through openff/openmm data structures?
Computing environment:
- Mac OS 11.4
- ambertools 21.11
- openbabel 3.1.1
- openff-bespokefit 0.1.1
- openff-forcefields 2.0.0
- openff-fragmenter-base 0.1.2
- openff-qcsubmit 0.3.1
- openff-toolkit 0.10.4
- openff-toolkit-base 0.10.4
- openff-utilities 0.1.3
- openmm 7.7.0
Additional context
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (5 by maintainers)
This sounds exciting. I am working on a new workflow for my students and I’m hitting a few walls similar to this one, so I can afford to wait a few months for something that can potentially simplify my life (and eventually theirs).
👀 I tried passing my system through
bespokefit
just to see, but I get the same result with 1 C type and 2 H types. I will try my luck with gaff andGAFFTemplateGenerator
where the thiophene atoms are assigned ascc
andcd
types.Thanks for looking into this @mattwthompson
Thanks for the thorough report - I’m pretty sure this is a bug in ParmEd and/or this interface to it, but I haven’t looked closely enough to say for sure. I’ll have another look tomorrow and update you then.
My overall goal is to save each small fragment as a library file and build polymers by mixing and matching - not sure whether this could be achieved entirely through openff/openmm data structures?
I assume your fragments here are monomers of some sort within a larger, connected polymer - i.e. bonded to neighboring fragments (/residues/monomers)?