Skip to content

[BUG] Incorrect charges from Sire to RDKit conversion #350

@tom-potter-cresset

Description

@tom-potter-cresset

Describe the bug
Converting some molecules from Sire to RDKit results in some strange formal charges and bonded structure. For example, the following molecule:

Image

becomes (formal charges labelled):

Image

This only happens if loading from a format which lacks bond-order information (eg. prmtop). Loading from an sdf, for example, works fine.

To Reproduce
Steps to reproduce the behavior:

mol1 = sr.load('input.inpcrd','input.prmtop')[0]
rdmol1 = sr.convert.to_rdkit(mol1)
for atom in rdmol1.GetAtoms():
    print(atom.GetFormalCharge())

mol2 = sr.load('input.sdf')
rdmol1 = sr.convert.to_rdkit(mol2)
for atom in rdmol2.GetAtoms():
    print(atom.GetFormalCharge())

I'm not sure what the ideal solution would be, as the information about the correct structure isn't available. Possibly there could be some way to flag unlikely groups like carbanions?

inputs.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions