Re: [Rdkit-discuss] Are Partial Charge Calculations Dependent on Conformers?

2021-06-30 Thread Hao
Thanks Greg!

That helps a lot, it was purely out of curiosity and understanding. I'm
working with some legacy code that requires conformer generation before
calculating partial charges. Now that I know it's unnecessary, I can speed
up this process by quite a bit. It's good to know that there aren't really
other RDKit descriptors that rely on conformers. In the future, I'll be
using QM to generate partial charges as you have suggested.

Best,
Hao

On Wed, Jun 30, 2021 at 11:07 PM Greg Landrum 
wrote:

> Hi Hao,
>
> The reference for how the Gasteiger charges is calculated is in the
> documentation for the function:
>
> https://www.rdkit.org/docs/source/rdkit.Chem.rdPartialCharges.html#rdkit.Chem.rdPartialCharges.ComputeGasteigerCharges
> It does not use atomic coordinates.
>
> The MMFF charges are described in the MMFF94 papers (googling for MMFF94
> will turn these up). They also do not use atomic coordinates.
>
> If you really need partial charges which are dependent on the 3D conformer
> (and I wonder why you do), the only option in the RDKit would be to use
> it's implementation with the YAeHMOP package to do a semi-empirical QM
> calculation:
>
> from rdkit import Chem
> from rdkit.Chem import rdDistGeom
> from rdkit.Chem import rdEHTTools
> m = Chem.AddHs(Chem.MolFromSmiles('OCCN'))
> rdDistGeom.EmbedMolecule(m)
> ok,res = rdEHTTools.RunMol(m)
> res.GetAtomicCharges()
>
>
> Note that I call AddHs() there before generating the 3D coordinates.
> Recent versions of the RDKit generate a warning if you don't do
> this. That's not one which you should ignore: you generally need the Hs
> there in order to get good conformations.
>
> There are many other methods out there which derive charges from quantum
> mechanical calculations, but those all require using external software.
>
> Why do you want partial charges which are dependent on conformer?
>
> -greg
>
>
> On Thu, Jul 1, 2021 at 3:53 AM Hao  wrote:
>
>> Hi RDKit community,
>>
>> I am not familiar with how partial charges are calculated and I couldn't
>> seem to find anything in my searches.
>>
>> If you run the code below, you'll see that the partial charges are always
>> the same, even though the embedded mol is different - which leads me to
>> believe these partial charge calculations are not dependent on conformers
>> (which I always thought they were?)
>>
>> Can someone with more knowledge than me confirm my hypothesis? Also does
>> rdkit have any partial charge calculators that are dependent on conformers?
>>
>> mol = Chem.MolFromSmiles('C[C@@](CC1=CC(O)=C(O)C=C1)(NN)C(O)=O')
>> AllChem.EmbedMolecule(mol, AllChem.ETKDG())
>> AllChem.ComputeGasteigerCharges(mol)
>> contribs = [float(mol.GetAtomWithIdx(i).GetProp('_GasteigerCharge')) for
>> i in range(mol.GetNumAtoms())]
>> fps = AllChem.MMFFGetMoleculeProperties(mol)
>> mmff_partial_charges = [fps.GetMMFFPartialCharge(x) for x in
>> range(mol.GetNumAtoms())]
>> print(mmff_partial_charges)
>> print(contribs)
>>
>> Thanks,
>> Hao
>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Are Partial Charge Calculations Dependent on Conformers?

2021-06-30 Thread Greg Landrum
Hi Hao,

The reference for how the Gasteiger charges is calculated is in the
documentation for the function:
https://www.rdkit.org/docs/source/rdkit.Chem.rdPartialCharges.html#rdkit.Chem.rdPartialCharges.ComputeGasteigerCharges
It does not use atomic coordinates.

The MMFF charges are described in the MMFF94 papers (googling for MMFF94
will turn these up). They also do not use atomic coordinates.

If you really need partial charges which are dependent on the 3D conformer
(and I wonder why you do), the only option in the RDKit would be to use
it's implementation with the YAeHMOP package to do a semi-empirical QM
calculation:

from rdkit import Chem
from rdkit.Chem import rdDistGeom
from rdkit.Chem import rdEHTTools
m = Chem.AddHs(Chem.MolFromSmiles('OCCN'))
rdDistGeom.EmbedMolecule(m)
ok,res = rdEHTTools.RunMol(m)
res.GetAtomicCharges()


Note that I call AddHs() there before generating the 3D coordinates. Recent
versions of the RDKit generate a warning if you don't do this. That's not
one which you should ignore: you generally need the Hs there in order to
get good conformations.

There are many other methods out there which derive charges from quantum
mechanical calculations, but those all require using external software.

Why do you want partial charges which are dependent on conformer?

-greg


On Thu, Jul 1, 2021 at 3:53 AM Hao  wrote:

> Hi RDKit community,
>
> I am not familiar with how partial charges are calculated and I couldn't
> seem to find anything in my searches.
>
> If you run the code below, you'll see that the partial charges are always
> the same, even though the embedded mol is different - which leads me to
> believe these partial charge calculations are not dependent on conformers
> (which I always thought they were?)
>
> Can someone with more knowledge than me confirm my hypothesis? Also does
> rdkit have any partial charge calculators that are dependent on conformers?
>
> mol = Chem.MolFromSmiles('C[C@@](CC1=CC(O)=C(O)C=C1)(NN)C(O)=O')
> AllChem.EmbedMolecule(mol, AllChem.ETKDG())
> AllChem.ComputeGasteigerCharges(mol)
> contribs = [float(mol.GetAtomWithIdx(i).GetProp('_GasteigerCharge')) for i
> in range(mol.GetNumAtoms())]
> fps = AllChem.MMFFGetMoleculeProperties(mol)
> mmff_partial_charges = [fps.GetMMFFPartialCharge(x) for x in
> range(mol.GetNumAtoms())]
> print(mmff_partial_charges)
> print(contribs)
>
> Thanks,
> Hao
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Are Partial Charge Calculations Dependent on Conformers?

2021-06-30 Thread Hao
Hi RDKit community,

I am not familiar with how partial charges are calculated and I couldn't
seem to find anything in my searches.

If you run the code below, you'll see that the partial charges are always
the same, even though the embedded mol is different - which leads me to
believe these partial charge calculations are not dependent on conformers
(which I always thought they were?)

Can someone with more knowledge than me confirm my hypothesis? Also does
rdkit have any partial charge calculators that are dependent on conformers?

mol = Chem.MolFromSmiles('C[C@@](CC1=CC(O)=C(O)C=C1)(NN)C(O)=O')
AllChem.EmbedMolecule(mol, AllChem.ETKDG())
AllChem.ComputeGasteigerCharges(mol)
contribs = [float(mol.GetAtomWithIdx(i).GetProp('_GasteigerCharge')) for i
in range(mol.GetNumAtoms())]
fps = AllChem.MMFFGetMoleculeProperties(mol)
mmff_partial_charges = [fps.GetMMFFPartialCharge(x) for x in
range(mol.GetNumAtoms())]
print(mmff_partial_charges)
print(contribs)

Thanks,
Hao
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Shape Tanimoto distance question

2021-06-30 Thread Andrew Dalke


> On Jun 30, 2021, at 04:20, Francois Berenger  wrote:
> 
> On 29/06/2021 12:26, Greg Landrum wrote:
>> Hi Leon,
>> You can convert the tanimoto distance to similarity, but the formula
>> is:
>> Similarity = 1 - Distance
> 
> In other words:
> 
> Tanimoto_distance = 1.0 - Tanimoto_score

As a side note, Rogers and Tanimoto (1960) define their distance as

 distance =  - log_2 (similarity)

The Jaccard distance is 1 - similarity

https://en.wikipedia.org/wiki/Jaccard_index#Other_definitions_of_Tanimoto_distance

Yes, this confusing set of terms is an annoying nuisance.


Andrew
da...@dalkescientific.com




___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss