Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMILES output wrong for strange CO species. #183

Closed
rwest opened this issue Feb 12, 2014 · 4 comments
Closed

SMILES output wrong for strange CO species. #183

rwest opened this issue Feb 12, 2014 · 4 comments

Comments

@rwest
Copy link
Member

rwest commented Feb 12, 2014

I'm not sure what this represents (still not used to the lone pairs column) but I'm pretty sure there are only two atoms, a C and an O

1 *4 C 1 0 {2,S}
2    O 0 2 {1,S}

However, the SMILES (generated via RDKit) is [CH2]O

In [19]: print m.fromAdjacencyList('1  *4   C  1 0 {2,S} \n  2 O 0 2 {1,S}').toAdjacencyList()
1 *4 C 1 0 {2,S}
2    O 0 2 {1,S}


In [20]: print m.fromAdjacencyList('1  *4   C  1 0 {2,S} \n  2 O 0 2 {1,S}').getFormula()
CO

In [21]: print m.fromAdjacencyList('1  *4   C  1 0 {2,S} \n  2 O 0 2 {1,S}').toSMILES()
[CH2]O

Strangely, RDKit agrees that there are two atoms:

In [22]: r = m.fromAdjacencyList('1  *4   C  1 0 {2,S} \n  2 O 0 2 {1,S}').toRDKitMol()

In [23]: r
Out[23]: <rdkit.Chem.rdchem.Mol at 0x1048ee600>

In [24]: r.GetNumAtoms()
Out[24]: 2

so I'm not sure what's going on. Perhaps start with some more unit tests on SMILES output from strange things?

@bbuesser
Copy link
Contributor

I think the problem is a missing check in fromAdjacencyList() that rejects wrong or incomplete adjacency lists like the one you mentioned:

1 *4 C 1 0 {2,S}
2    O 0 2 {1,S}

Where did you find it?

@rwest
Copy link
Member Author

rwest commented Feb 12, 2014

We made it up as a test.
Is the problem that we have a Carbon with 1 radical, 1 bond, and 0 lone pairs? (thus 2 valence electrons instead of 8)
Or an Oxygen with 0 radical, 1 bond, and 2 lone pair electrons (thus 3 valence electrons instead of 8).
Would this end up with an 11+ change? Or is it just entirely invalid?

@bbuesser
Copy link
Contributor

I think that is what is happening. fromAdjacencyList() is reading that adjacency list assuming all hydrogen atoms are explicitly present as saturateH=False is standard for that function. Can you print the charge attribute of the two atoms? Also can you try it with fromAdjacencyList(saturateH=True)?

@connie
Copy link
Member

connie commented Oct 30, 2014

This is a deprecated issue. The adjlist should have explicit hydrogens or if it is carbon monoxide it should be a triple bonded adjlist with 1 lone pair on both carbon and oxygen.

@connie connie closed this as completed Oct 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants