question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

thiophene gets only 1 C atom type, but 2 different C-C bond lengths

See original GitHub issue

Hi 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

test_thio.top.zip

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
micaela-mattacommented, Apr 19, 2022

The next release of the toolkit (0.11.0, RC package hopefully online within the month, full release a month after that) adds support for (bio)polymers and switches OpenMM system creation to our pseudo replacement for Parmed, Interchange. Non-biological polymers are certainly something we want to support better throughout our infrastructure, but if your work is timely, it might not be worth changing course from how you’re currently wrestling existing tools.

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).

The piece of ParmEd code should be considering charges when asking itself if two OpenMM atoms should be assigned the same atom type.

👀 I tried passing my system throughbespokefit just to see, but I get the same result with 1 C type and 2 H types. I will try my luck with gaff and GAFFTemplateGenerator where the thiophene atoms are assigned as cc and cd types.

Thanks for looking into this @mattwthompson

1reaction
mattwthompsoncommented, Apr 19, 2022

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)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theoretical Study on the Structures, Electronic Properties, and ...
The lengths of the fused bonds differed in bcCDT depending on the fused position of the thiophene ring (Figure 2c). Accordingly, the WBI...
Read more >
A Molecular Mechanics (MMZ) Study of Furan, Thiophene ...
types of C-C bond lengths (2-3 and 3-41 ... "The symbol C stands for sp2 type carbon atoms. type 2 in the MM2(85)...
Read more >
spectroscopic shifts with the adsorption of thiophene on ...
In thiophene and benzothiophene, the C2–H bond length at the α-position with respect to the S atom, is shorter than the rest of...
Read more >
Mechanism of formation of carbon-carbon bonds in the ring ...
splitting in Cp2CoNi(C3B2R5)+ is only 27 X 10"4 cm"1. ... The reaction of (C5Me5)Rh(C2H4)2 with 2-methoxythiophene is found to lead to the monomer....
Read more >
Revisiting the Rearrangement of Dewar Thiophenes - PMC
Dewar thiophenes are bicyclic structural isomers of thiophenes, where the carbon atoms bonded to the S atom have sp 3 hybridization (Scheme 1)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found