----- Forwarded Message -----
>From: S.L. Chan <[email protected]>
>To: JP <[email protected]> 
>Sent: Tuesday, January 14, 2014 10:03 PM
>Subject: Re: [Rdkit-discuss] Add a charge to an atom and modify Hs accordingly 
>(protonation)
> 
>
>
>Hello JP,
>
>You need to bear in mind that by default RDKit does not store the 
>hydrogens explicitly. RemoveHs() generally does not do anything on 
>a fresh molecule, and GetNumExplicitHs() generally returns 0 for all 
>atoms.
>
>Implicit hydrogens mean the hydrogen atoms implied.
>GetNumImplicitHs() returns the number of hydrogens EXPECTED to
>be bonded to that atom. This is why it returned 1 even though
>your molecule did not have explicit hydrogens.
>
>With these in mind you should be able to achieve what you want:
>
>>>> m = Chem.MolFromSmiles('C(=O)O')
>>>> m2 = Chem.AddHs(m)
>>>> m2.GetNumAtoms()
>5
>>>> m.GetAtomWithIdx(2).SetFormalCharge(-1)
>>>>
 Chem.SanitizeMol(m)
>>>> m3 = Chem.AddHs(m)
>>>> m3.GetNumAtoms()
>4
>>>> Chem.MolToSmiles(m)
>'O=C[O-]'
>
>Finally, remember that AddHs() does not generate coordinates for
>the hydrogens. You need to use AllChem.EmbedMolecule() if you
>need coordinates for them.
>
>Ling
>
>
>
>
>
>
>
>>________________________________
>> From: JP <[email protected]>
>>To: "[email protected]" 
>><[email protected]> 
>>Sent: Tuesday, January 14, 2014 10:58 AM
>>Subject: [Rdkit-discuss] Add a charge to an atom and modify Hs accordingly    
>>(protonation)
>> 
>>
>>
>>Hi there,
>>
>>
>>This must be really easy -- but anything I am trying is failing and I am 
>>losing my mind.  I want to add a charge (+ / -) to an atom and add or delete 
>>a connected H accordingly.
>>
>>
>>I thought an easy way to do this was to remove all Hs from the molecule 
>>(removeHs), add a charge (SetFormalCharge), and re-add all Hs (AddHs).  This 
>>doesn't work (the sanitization check fails in AddHs, incorrect valence - 
>>which I understand) - what is the best way to do this?
>>
>>
>>Also,
>>
>>
>>>>> m = Chem.MolFromSmiles('C(=O)O')
>>>>> m.Debug()
>>Atoms:
>>0 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 0 chi: 0
>>1 8 O chg: 0  deg: 1 exp: 2 imp: 0 hyb: 3 arom?: 0 chi: 0
>>2 8 O chg: 0  deg: 1 exp: 1 imp: 1 hyb: 3 arom?: 0 chi: 0
>>Bonds:
>>0 0->1 order: 2 conj?: 1 aromatic?: 0
>>1 0->2 order: 1 conj?: 1 aromatic?: 0
>>>>> m_noHs = Chem.RemoveHs(m)
>>>>> m_noHs.Debug()
>>Atoms:
>>0 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 0 chi: 0
>>1 8 O chg: 0  deg: 1 exp: 2 imp: 0 hyb: 3 arom?: 0 chi: 0
>>2 8 O chg: 0  deg: 1 exp: 1 imp: 1 hyb: 3 arom?: 0 chi: 0
>>Bonds:
>>0 0->1 order: 2 conj?: 1 aromatic?: 0
>>1 0->2 order: 1 conj?: 1 aromatic?: 0
>>
>>
>>>>> m_noHs.GetAtomWithIdx(2).GetNumExplicitHs()
>>0
>>>>> m_noHs.GetAtomWithIdx(2).GetNumImplicitHs()
>>1
>>
>>
>>Why is there still an implicit H after I "removed" them?
>>
>>
>>I have tried to use ReplaceSubstructs() for this (a bit of an overkill) but I 
>>then lose the 3D information of the original atom.
>>
>>
>>Many Thanks... and sorry for the repeated spamming :((((
>>
>>
>>-
>>Jean-Paul Ebejer
>>Early Stage Researcher
>>------------------------------------------------------------------------------
>>CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>>Learn Why More Businesses Are Choosing CenturyLink Cloud For
>>Critical Workloads, Development Environments & Everything In Between.
>>Get a Quote or Start a Free Trial Today. 
>>http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>>_______________________________________________
>>Rdkit-discuss mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>>
>>
>
>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to