Hello Greg,

Is UpdatePropertyCache "heavy"? If not, is it possible to fold it into
SanitizeMol, so that users only need to remember the SanitizeMol function
for refreshing a molecule?

Thank you.

Ling

On Mon, Aug 29, 2016 at 10:41 PM, Greg Landrum <[email protected]>
wrote:

> Hi Brian,
>
> On Tue, Aug 30, 2016 at 6:41 AM, Bennion, Brian <[email protected]> wrote:
>
>>
>> I have seemed to hit a wall with what seems like a simple task.
>>
>> First, I have ~9800 compounds that have a primary amine for a reaction
>> that I am completing in rdkit.
>> About 250 of those compounds have a tertiary alkylamine that is most
>> likely protonated at pH 7.4.
>>
>> The dataset is a set of smiles strings for which the tertiary amine is
>> not protonated.   I thought this would be easy enough to fix, just use a
>> smarts substructure search, set the formal charge on any hits to one and
>> then AddHs, sanitize, embed, and then minimize.
>>
>> Well, what I get is [N+] with all the other carbons with explicit atoms
>> in the resulting smiles files, and if output to sdf I get a positively
>> charged  diradical positioned at the tertiary nitrogen.
>>
>
> Yes, what's happening here is that AddHs() is using the implicit valence
> on the N atoms to determine how many Hs to add. Since the implicit valence
> is not recomputed when you set the formal charge, you end up with the wrong
> number of Hs attached to the N. A call to UpdatePropertyCache() will fix
> this:
>
> n [16]: m = Chem.MolFromSmiles('CN')
>
> In [17]: AllChem.CalcMolFormula(m)
> Out[17]: 'CH5N'
>
> In [18]: m.GetAtomWithIdx(1).SetFormalCharge(1)
>
> In [19]: AllChem.CalcMolFormula(m)
> Out[19]: 'CH5N+'
>
> In [20]: m.UpdatePropertyCache()
>
> In [21]: AllChem.CalcMolFormula(m)
> Out[21]: 'CH6N+'
>
> In [22]: mh = Chem.AddHs(m)
>
> In [24]: mh.GetAtomWithIdx(1).GetDegree()
> Out[24]: 4
>
> Thank you for such a great tool
>>
>
> You're welcome! Thanks for saying thanks. :-)
>
> Hope this helps,
> -greg
>
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to