<https://stackoverflow.com/posts/76197437/timeline>
Hi All,
I am trying to add atom numbers in smiles as belows,
from rdkit import Chem
mol=Chem.MolFromSmiles('c1ccccc(C(N)=O)1')
for i, atom in enumerate(mol.GetAtoms()):
atom.SetProp('molAtomMapNumber',str(i))
smi=Chem.MolToSmiles(mol)
print(smi)
the output is: [cH:0]1[cH:1][cH:2][cH:3][cH:4][c:5]1C:6=[O:8]
then I want to split the smiles into atoms, I did it like this:
from rdkit import Chem
mol=Chem.MolFromSmiles('c1ccccc(C(N)=O)1')
for i, atom in enumerate(mol.GetAtoms()):
atom.SetProp('molAtomMapNumber',str(i))
print(i,atom.GetSymbol())
the output is:
0 C
1 C
2 C
3 C
4 C
5 C
6 C
7 N
8 O
*But what I do want is something like this (with fragments instead of
atoms): *
*0 cH1 CH...7 NH28 O *
Can anyone help me figure out how to get each atom with H from the smiles
as above. Thanks so much!
best,
Hal
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss