Hi,

On Fri, Mar 15, 2013 at 3:56 PM, Syeda Sabrina <[email protected]> wrote:
> I was trying to how understand how the AddHs ()works and how I can relate
> its output with the GetNumExplicitHs() to see how many explicit hydrogens
> were added. But It seems like AddHs does not work correctly. Below is the
> code that I used.

I think the code in your example shows the RDKit behaving as it is supposed
to. The difference between "implicit" and "explicit" Hs is one that
never should have been exposed in the API and that I am (slowly) in
the process of removing. There's a post explaining this, or at least
trying to, here:
http://www.mail-archive.com/[email protected]/msg00077.html

Does this help?

Best,
-greg

>
> m = Chem.MolFromSmiles('C')
>
> for a in m.GetAtoms():
>     print a.GetIdx(), a.GetNumImplicitHs()
>
> 0 4
>
> mnew = Chem.AddHs(m)
>
> for a in mnew.GetAtoms():
>     print a.GetIdx(), a.GetNumImplicitHs()
>
> 0 0
> 1 0
> 2 0
> 3 0
> 4 0
>
> for a in mnew.GetAtoms():
>     print a.GetIdx(), a.GetSymbol(), a.GetNumExplicitHs()
>
> 0 C 0
> 1 H 0
> 2 H 0
> 3 H 0
> 4 H 0
>
> mnew = Chem.AddHs(m, explicitOnly=True)
>
> for a in mnew.GetAtoms():
>     print a.GetIdx(), a.GetSymbol(), a.GetNumExplicitHs()
>
> 0 C 0
>
> for a in mnew.GetAtoms():
>     print a.GetIdx(), a.GetSymbol(), a.GetNumImplicitHs()
>
> 0 C 4
>
> mnew = Chem.AddHs(m, explicitOnly=False)
>
> for a in mnew.GetAtoms():
>     print a.GetIdx(), a.GetSymbol(), a.GetNumImplicitHs()
>
> 0 C 0
> 1 H 0
> 2 H 0
> 3 H 0
> 4 H 0
>
> for a in mnew.GetAtoms():
>     print a.GetIdx(), a.GetSymbol(), a.GetNumExplicitHs()
>
> 0 C 0
> 1 H 0
> 2 H 0
> 3 H 0
> 4 H 0
>
> Is it possible to fix?
>
> Thanks!
> Syeda Sabrina
> Graduate Assistant
> 25, Fenske Laboratory
> Department of Chemical Engineering, Penn State University
> University Park, PA
>
>
> ------------------------------------------------------------------------------
> 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
>

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