Hi Illimar,

The easiest way to do this is to use the topological distance matrix:

In [2]: m = Chem.MolFromSmiles('CCCC')


In [3]: Chem.GetDistanceMatrix(m)

Out[3]:
array([[0., 1., 2., 3.],
       [1., 0., 1., 2.],
       [2., 1., 0., 1.],
       [3., 2., 1., 0.]])


Best,
-greg



On Mon, Mar 25, 2019 at 9:24 AM Illimar Hugo Rekand <illimar.rek...@uib.no>
wrote:

> Title is pretty self-explanatory.
>
>
> atom.GetNeighbors() is a pretty nifty tool for getting indices of the
> nearest atoms that are only a single bond-length away from the queried
> atom. But what if I also need two bond-lengths away? Alternatively, what if
> I *only* want neighbors two bond-lengths away?
>
>
> Illimar
>
> Department of Biomedicine
>
> University of Bergen
>
>
> _______________________________________________
> 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