Skip to content

Use native scipy periodic KDTree for orthorhombic boxes? #5114

@orbeckst

Description

@orbeckst

The MDAnalysos PBC-awared distance calculations normally use a grid-based method with "augmentation" to find minimum image distances.

However, as an alternative method a KDTree based method also exists in lib.pkdtree. More recent versions of scipy have added the boxsize=[Lx, Ly, Lz] kwarg to scipy.spatial.cKDTree to natively compute nearest neighbors on a toroidal topology (i.e., orthorhombic boxes in the case of MD simulations). As recently pointed out in scipy/scipy#16191 (comment) we could use this update to scipy.

  1. We should investigate if the performance of the native scipy periodic KDTree is better than our implementation.
  2. If yes, we should consider changing
    self, box: Optional[npt.ArrayLike] = None, leafsize: int = 10
    so that we only use our augmented KDTree for cases that native scipy cannot handle.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions