modeling - Counting valency of atoms, in a molecule with python -


the documentation indigo module can found here

http://ggasoftware.com/opensource/indigo/api#inputoutput

so instance if have molecule object smiles string, e.g. "[c](=[o])", wish calculate valency of each atom, instance here desired output [atom=c, unbound_electrons=2],[atom=o, valency=0]

if consider atom "[c]" can explain why code printing [atom=c, unbound_electrons=0] not [atom=c, unbound_electrons=4]

from indigo import * indigo = indigo()  mol=indigo.loadmolecule("[c]")  print(mol.grossformula(),"\n")  atom in mol.iterateatoms():         print([atom.symbol(),atom.radicalelectrons()]) 

edit: work out if generate list of types of bonds on atom in conjuction atom.atomicnumber(). e.g. if [c] has double bond take it's atomic number - 2 (second shell) - 2 (double bond)

edit#2: might useful visualising i'm talking about

from indigo_renderer import * renderer = indigorenderer(indigo) renderer.rendertofile(mol,"mol.png") 

edit#3: not chemist, might have got concepts wrong


Comments