Dear Markus,

On Fri, Aug 15, 2008 at 1:23 PM, markus <[email protected]> wrote:
> Dear all,
> as there is so much Geometry functionality within the RDKit, I wonder if
> it provides
> a function that computes the DistanceMatrix of a list of Point3D Objects.
> If RDKit does not have this functionality, can anyone give Ideas if the
> Boost Libaries themselve
> are capable of that?

Point3D objects have a Distance method you can use for this.

Here's some sample code to generate the atom-atom distance matrix of a
molecule (not particularly well written) to give you a flavor for it:
conf = m.GetConformer()
import numpy
nA = m.GetNumAtoms()
dm = numpy.zeros((nA,nA),numpy.double)
for i in range(nA):
    for j in range(i+1,nA):
        d = conf.GetAtomPosition(i).Distance(conf.GetAtomPosition(j))
        dm[i,j]=dm[j,i]=d


> At the moment I have my own compiled version of the C Clustering Library
> (PyCluster) which I modified in order to get a distancematrix,
> but this Libraries do not out of the box calculate the spatial  Distance.

I'd be curious to hear how PyCluster performs relative to the
clustering code distributed with the RDKit. We don't have an SOM or
k-means clustering implementation, but there is a hierarchical cluster
that one could compare.

-greg

Reply via email to