Hi everyone,
I was trying to check whether all the atoms of product molecules for a
reaction have right number of valences as they supposed to be. I was not
clear whether there GetExplicitValence() is the right function to use or
not for this purpose. So I triet to start with it and  I used it in the
following code and ended up with Runtime Error.


rxn=AllChem.ReactionFromSmarts('[C:1]/[C:2]=[C:3]/[C:4][C:5]>>[C;1][C:2]\[C:3]=[C:4]\[C:5]')

rxn.Initialize()

reactants=[]

reactants.append(Chem.MolFromSmiles('C/C=C/CC'))

products=rxn.RunReactants(tuple(reactants))

for p in products:
    for mol in p:
        for atom in mol.GetAtoms():
            print atom.GetSymbol(), atom.GetExplicitValence()

C---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-14-513b40c7a212> in <module>()
      2     for mol in p:
      3         for atom in mol.GetAtoms():
----> 4             print atom.GetSymbol(), atom.GetExplicitValence()
      5

RuntimeError: Pre-condition Violation

However, it can calculate the implicit valence. How can this be possibly
fixed? Or, is there any other way to check whether an atom has correct
explicit valence that could be permitted.

Thanks
Sabrina
*
*
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to