Hi
It looks to me like N5 [nH:5] also has a problem. This has 3 connections to
heavy atoms, is specified to have a hydrogen attached, but has no charge.
This may not have triggered an error but it looks wrong, especially in this
structure. Surely this atom should just be [n:5] ?
Best regards,
Chris
On 26 July 2018 at 10:42, Paolo Tosco <paolo.tosco.m...@gmail.com> wrote:
> Dear Lewis,
>
> C #7 indeed has 5 valences:
>
> *
> |
> -C=O
> |
> H
>
>
> If you change [CH:14] into [C:14] sanitization will succeed.
>
> Cheers,
> p.
>
> On 07/26/18 09:42, Lewis J Martin wrote:
>
> Hi all,
>
> I have generated a molecule that I can both visualize and export as
> SMILES, but I can't Sanitize it. Creating a new molecule from that SMILES
> fails due to something to do with the valence. It seems to me that it has
> the correct amount of bonds.
>
> Code to reproduce and 'debugging' that Ive tried:
> --------------------------------------
> #sanitize=False or it won't load this SMILES
> mol = Chem.MolFromSmiles('[CH3:0][CH2:1][CH2:2][CH2:3][CH2:4][
> nH:5]1[c:6]([CH:14](=[O:15])[*:16])[n:7][c:8]2[cH:9][cH:10][
> cH:11][cH:12][c:13]12',sanitize=False)
>
> #print atom indices and atomic number:
> for i in mol.GetAtoms():
> print(i, i.GetIdx(), i.GetAtomicNum())
>
> #display bonds relating to index 7. Seems correct for a carbon.
> for i in mol.GetBonds():
> if i.GetBeginAtomIdx()==7 or i.GetEndAtomIdx()==7:
> print(i.GetBeginAtomIdx(), i.GetEndAtomIdx(), i.GetBondType())
>
> #print valences. Fails on index 7.
> for i in mol.GetAtoms():
> print(i.GetIdx(), i.GetExplicitValence())
> --------------------------------------
>
>
> Can anyone please offer some advice as to what the problem is?
> Much appreciated!
>
> Lewis
>
>
> PS. here is the output I get:
>
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 0 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 1 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 2 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 3 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 4 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 5 7
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 6 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 7 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 8 8
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 9 0
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 10 7
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 11 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 12 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 13 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 14 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c60> 15 6
> <rdkit.Chem.rdchem.Atom object at 0x11a440c10> 16 6
> 6 7 SINGLE
> 7 8 DOUBLE
> 7 9 SINGLE
> 0 4
> 1 4
> 2 4
> 3 4
> 4 4
> 5 3
> 6 4
>
> ---------------------------------------------------------------------------RuntimeError
> Traceback (most recent call
> last)<ipython-input-24-62fd51819686> in <module>() 7 8 for i in
> mol.GetAtoms():----> 9 print(i.GetIdx(), i.GetExplicitValence()) 10
> #valence = oneMol.GetAtomWithIdx(7).GetExplicitValence() 11
> #print(valence)
> RuntimeError: Pre-condition Violation
> getExplicitValence() called without call to calcExplicitValence()
> Violation occurred on line 162 in file Code/GraphMol/Atom.cpp
> Failed Expression: d_explicitValence > -1
> RDKIT: 2018.03.3
> BOOST: 1_65_1
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Rdkit-discuss mailing
> listRdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss