Thanks all for the replies.

@ Greg: I noticed that some literature are using angle between bonds as
input feature for ML property prediction and was trying to reimplement this
for QM9.

Best,
Navid

On Sat, Sep 21, 2019 at 2:07 AM Greg Landrum <greg.land...@gmail.com> wrote:

> Dan already mentioned this in his reply, but I will reinforce: the RDKit
> stores atom positions in conformers, so if a molecule has no conformers it
> also has no atom positions. Without atom positions it doesn’t make sense to
> calculate angles.
>
> What exactly are you trying to do?
>
> -greg
>
> On Fri, 20 Sep 2019 at 20:16, Navid Shervani-Tabar <nshe...@gmail.com>
> wrote:
>
>> Hello,
>>
>> Couple weeks ago, I asked if there is an RDKit based method that can give
>> the distance between two atoms between the molecule. The solution that I
>> got was:
>>
>> from rdkit.Chem import AllChem
>>
>> mol = Chem.MolFromSmiles('O=CC1OC12CC1OC12')
>> AllChem.EmbedMolecule(mol)
>> conf = mol.GetConformer()
>>
>> at1Coords = np.array(conf.GetAtomPosition(bond_i.GetBeginAtomIdx()))
>> at2Coords = np.array(conf.GetAtomPosition(bond_i.GetEndAtomIdx()))
>>
>> dist = np.linalg.norm(at2Coords - at1Coords)
>>
>> This was good until I tried the same for molecules such as  'CC12CCC1CC2' 
>> where
>> there are zero conformations and the method did not work. I found the
>> alternative
>>
>> from rdkit.Chem import rdDistGeom as molDG
>>
>> bound_matrix = molDG.GetMoleculeBoundsMatrix(mol)
>> bond_i = mol.GetBondWithIdx(idx)
>> d = bound_matrix[bond_i.GetBeginAtomIdx(), bond_i.GetEndAtomIdx()]
>>
>> Now getting back to my current question, I am trying to find the angle
>> between two atoms using the method
>>
>> angle = Chem.rdMolTransforms.GetAngleDeg(conf, atom[0], atom[1], atom[2])
>>
>> Again, this method does not work when there are zero conformations. I was
>> wondering if there are any RDKit alternatives for this that do not use
>> mol.GetConformer or my best bet is to use molDG.GetMoleculeBoundsMatrix
>> and trigonometry to find them.
>>
>> Thanks,
>> Navid
>>
>>
>> _______________________________________________
>> 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

Reply via email to