Dear all


from rdkit import Chem
from rdkit.Chem.rdchem import BondType


AROMATIC = BondType.AROMATIC
SINGLE = BondType.SINGLE
DOUBLE = BondType.DOUBLE
TRIPLE = BondType.TRIPLE


suppl = 
Chem.SDMolSupplier('/Users/GVALMTGG/Downloads/neemp-sources/examples/set00.sdf',removeHs
 = False)
i=0
for mol in suppl:
    i+=1
    v=-1
    for atom in mol.GetAtoms():
        v+=1
        t=1
        for bond in atom.GetNeighbors()[-1].GetBonds():
            if bond.GetBondType() == AROMATIC:
                t=1.5
            if bond.GetBondType() == DOUBLE:
                t=2
            if bond.GetBondType() == TRIPLE:
                t=3
        if i<2:
            print str(v) + " " + atom.GetSymbol() + " " + str(t)



Why the code return H with 1.5 type bond ?


I used anaconda environment to run the code:


/Users/GVALMTGG/anaconda/envs/my-rdkit-env/bin/python 
/Users/GVALMTGG/PycharmProjects/neemp/neemp.py
0 N 1
1 O 2
2 O 2
3 C 1
4 C 1
5 C 1
6 C 1
7 C 1
8 C 1
9 C 1
10 C 1
11 C 1.5
12 C 2
13 C 1
14 C 1
15 C 2
16 C 2
17 C 1
18 H 1.5
19 H 1.5
20 H 1.5
21 H 1.5
22 H 1.5
23 H 1.5
24 H 1.5
25 H 1.5
26 H 1.5
27 H 1
28 H 1


Dr. Guillaume GODIN
Principal Scientist
Chemoinformatic & Datamining
Innovation
CORPORATE R&D DIVISION
DIRECT LINE +41 (0)22 780 3645
MOBILE          +41 (0)79 536 1039
        Firmenich SA
        RUE DES JEUNES 1 | CASE POSTALE 239 | CH-1211 GENEVE 8
**********************************************************************  
DISCLAIMER  
This email and any files transmitted with it, including replies and forwarded 
copies (which may contain alterations) subsequently transmitted from Firmenich, 
are confidential and solely for the use of the intended recipient. The contents 
do not represent the opinion of Firmenich except to the extent that it relates 
to their official business.  
**********************************************************************

Attachment: set00.sdf
Description: set00.sdf

------------------------------------------------------------------------------
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

Reply via email to