You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I ran the following code, the error occured. The error message is as follow
File "check2.py", line 7, in
print (Chem.MolToSmiles(m))
Boost.Python.ArgumentError: Python argument types in
rdkit.Chem.rdmolfiles.MolToSmiles(NoneType)
did not match C++ signature:
MolToSmiles(RDKit::ROMol mol, bool isomericSmiles=True, bool kekuleSmiles=False, int rootedAtAtom=-1, bool canonical=True, bool allBondsExplicit=False, bool allHsExplicit=False)
If I remove 'rdmolfiles.SDWriter.SetKekulize(w, False)', there's no problem (For some reason the molecule should not be keulized when writing sdf file)
My code is
from rdkit import Chem
from rdkit.Chem import rdmolfiles
w = Chem.SDWriter('tmp.sdf')
rdmolfiles.SDWriter.SetKekulize(w, False)
w.write(Chem.MolFromSmiles('CC(c1cc(=O)[nH]c(n1)N1CCN(CC1)c1ccccc1)C'))
m = Chem.SDMolSupplier('tmp.sdf')[0]
print (Chem.MolToSmiles(m))
Anyone knows the reason or solution?
Thank you
The text was updated successfully, but these errors were encountered:
In [2]: m = Chem.MolFromSmiles('CC(c1cc(=O)[nH]c(n1)N1CCN(CC1)c1ccccc1)C')
In [3]: mb = Chem.MolToMolBlock(m,kekulize=False)
In [4]: nm =Chem.MolFromMolBlock(mb)
[05:09:07] Can't kekulize mol. Unkekulized atoms: 2 3 6 7 8
and the simplest form:
In [5]: m = Chem.MolFromSmiles('c1ccc[nH]1')
In [6]: mb = Chem.MolToMolBlock(m,kekulize=False)
In [7]: nm =Chem.MolFromMolBlock(mb)
[05:11:37] Can't kekulize mol. Unkekulized atoms: 0 1 2 3 4
Though I don't see this as a very urgent problem (according to the MDL documentation, aromatic bonds are only supposed to be in Mol files for queries, and you wouldn't sanitize a query), it probably should still be fixed.
@jaechanglim : why do you need the aromatic bonds in the SD file?
Description:
when I ran the following code, the error occured. The error message is as follow
File "check2.py", line 7, in
print (Chem.MolToSmiles(m))
Boost.Python.ArgumentError: Python argument types in
rdkit.Chem.rdmolfiles.MolToSmiles(NoneType)
did not match C++ signature:
MolToSmiles(RDKit::ROMol mol, bool isomericSmiles=True, bool kekuleSmiles=False, int rootedAtAtom=-1, bool canonical=True, bool allBondsExplicit=False, bool allHsExplicit=False)
If I remove 'rdmolfiles.SDWriter.SetKekulize(w, False)', there's no problem (For some reason the molecule should not be keulized when writing sdf file)
My code is
from rdkit import Chem
from rdkit.Chem import rdmolfiles
w = Chem.SDWriter('tmp.sdf')
rdmolfiles.SDWriter.SetKekulize(w, False)
w.write(Chem.MolFromSmiles('CC(c1cc(=O)[nH]c(n1)N1CCN(CC1)c1ccccc1)C'))
m = Chem.SDMolSupplier('tmp.sdf')[0]
print (Chem.MolToSmiles(m))
Anyone knows the reason or solution?
Thank you
The text was updated successfully, but these errors were encountered: