Python-Ref > Cheminformatics > OpenBabel > Aromaticity perception
 
 

<-^^->
Klíčová slova
Moduly
Knihovní funkce

Aromaticity perception

Expand/Shrink
Zdroj: (babel8-1.py)
  1   import pybel
  2   
  3   for smiles in ["c1ccccc1","c1cccc2c1cncc2","c1cscc1","C1=CC=C1","c1cccc-2c1CCCC2"]:
  4     mol = pybel.readstring( "smi", smiles)
  5     print smiles
  6     for ring in mol.OBMol.GetSSSR():
  7       print " *", ring.Size(), ring.IsAromatic()
stdout:
c1ccccc1
 * 6 True
c1cccc2c1cncc2
 * 6 True
 * 6 True
c1cscc1
 * 5 True
C1=CC=C1
 * 4 False
c1cccc-2c1CCCC2
 * 6 True
 * 6 False
Doba běhu: 141.7 ms
Expand/Shrink
Zdroj: (babel8-2.py)
  1   import pybel, openbabel
  2   
  3   mol = pybel.readstring( "smi", "c1cccc-2c1CCCC2")
  4   for atom in mol.atoms:
  5     print atom.OBAtom.IsAromatic()
  6   print "--------------------"
  7   for bond in openbabel.OBMolBondIter( mol.OBMol):
  8     atom1 = bond.GetBeginAtom()
  9     atom2 = bond.GetEndAtom()
 10     print bond.IsAromatic(), atom1.IsAromatic(), atom2.IsAromatic()
stdout:
True
True
True
True
True
True
False
False
False
False
--------------------
True True True
True True True
True True True
True True True
True True True
True True True
False True False
False False False
False False False
False False False
False True False
Doba běhu: 145.5 ms