Skip to main content

High-performance neighborlist construction for atomistic systems in Rust with Python bindings.

Project description

neighborlist-rs

High-performance neighborlist construction for atomistic systems in Rust with Python bindings.

CI PyPI version License

Features

  • High-performance Cell Lists: O(N) scaling for large systems.
  • Batched Processing: Parallelized neighbor list construction across multiple systems (ideal for GNN training).
  • Multi-Cutoff pass: Generate multiple neighbor lists (e.g., short-range GNN, long-range dispersion) in a single optimized pass.
  • SIMD Acceleration: Explicit wide SIMD kernels for small systems and brute-force fallbacks.
  • Auto-Box Inference: Automatic bounding box calculation for isolated molecules.
  • Robust PBC support: Minimum image convention for orthorhombic and triclinic cells.
  • ASE Integration: Direct support for ase.Atoms objects.
  • Zero-copy NumPy integration: Efficient data exchange via PyO3 and rust-numpy.

Installation

From PyPI

pip install neighborlist-rs

From Source

pip install .

Usage (Python)

Refer to PYTHON_API.md for full documentation and advanced usage examples.

Quick Start (with ASE)

import neighborlist_rs
from ase.build import molecule

atoms = molecule("C2H5OH")
# Single pass search directly from ASE Atoms
result = neighborlist_rs.build_from_ase(atoms, cutoff=5.0)

edge_index = result["edge_index"]  # (2, M) array of atom pairs
shifts = result["shift"]           # (M, 3) periodic shift vectors

Manual Search

import neighborlist_rs
import numpy as np

positions = np.array([[0, 0, 0], [1, 1, 1]], dtype=float)
# None for cell means isolated system (non-PBC)
result = neighborlist_rs.build_neighborlists(None, positions, cutoff=5.0)

Performance

neighborlist-rs is designed for high-performance atomistic simulations, outperforming established baselines across a wide range of system sizes and conditions.

Comprehensive Benchmarks

(Measured on CPU: ARM64 8-core / NVIDIA GB10 proxy. Results in wall-clock time ms.)

1. Single System Scaling

Single System Benchmark

The table below shows the average wall-clock time (in milliseconds) to construct the neighbor list. Lower is better.

System Cutoff ASE Matscipy Freud Vesin neighborlist-rs
Isolated 1k 6.0 Å 101.5 3.3 4.1 1.7 3.0
14.0 Å 2688.1 10.2 12.2 5.8 2.8
Ethanol 1k 6.0 Å 149.9 5.9 2.7 3.0 5.3
(PBC) 14.0 Å 6677.0 130.8 N/A* 64.0 37.6
Ethanol 10k 6.0 Å 1222.8 50.7 34.9 37.9 19.8
(PBC) 14.0 Å 11948.5 608.5 485.1 342.6 250.5

*Freud requires box dimensions > 2x cutoff.

Detailed Raw Timing Summary
======================================== Single System Benchmarks ========================================

>>> CUTOFF: 6.0 Angstroms <<<

--- Isolated 1k (N=1000, rc=6.0) ---
Library              | Device | Time (ms)  | Std       
-------------------------------------------------------
 ASE                 | CPU   | 101.48     | 0.76      
 Matscipy            | CPU   | 3.28       | 0.01      
 Freud               | CPU   | 4.13       | 0.85      
 Vesin               | CPU   | 1.72       | 0.02      
 RS (1 thread)       | CPU   | 3.16       | 0.47      
 RS (Parallel)       | CPU   | 2.97       | 0.26      
 TorchCluster        | CPU   | 2.49       | 0.11      
 TorchCluster        | GPU   | 18.51      | 1.05      
 TorchNL             | CPU   | 16.34      | 3.01      
 TorchNL             | GPU   | 6.52       | 0.80      

--- Ethanol 1k (PBC) (N=1008, rc=6.0) ---
Library              | Device | Time (ms)  | Std       
-------------------------------------------------------
 ASE                 | CPU   | 149.92     | 15.19     
 Matscipy            | CPU   | 5.91       | 0.01      
 Freud               | CPU   | 2.71       | 0.59      
 Vesin               | CPU   | 2.99       | 0.02      
 RS (1 thread)       | CPU   | 5.44       | 0.11      
 RS (Parallel)       | CPU   | 5.35       | 0.01      
 TorchCluster        | ---   | N/A (No PBC support) |           
 TorchNL             | CPU   | 31.72      | 1.27      
 TorchNL             | GPU   | 18.85      | 4.69      

--- Ethanol 10k (PBC) (N=10008, rc=6.0) ---
Library              | Device | Time (ms)  | Std       
-------------------------------------------------------
 ASE                 | CPU   | 1222.77    | 2.29      
 Matscipy            | CPU   | 50.70      | 0.21      
 Freud               | CPU   | 34.93      | 2.36      
 Vesin               | CPU   | 37.92      | 0.56      
 RS (1 thread)       | CPU   | 20.61      | 0.68      
 RS (Parallel)       | CPU   | 19.82      | 0.10      
 TorchCluster        | ---   | N/A (No PBC support) |           
 TorchNL             | CPU   | 487.77     | 8.08      
 TorchNL             | GPU   | 134.06     | 27.62     


>>> CUTOFF: 14.0 Angstroms <<<

--- Isolated 1k (N=1000, rc=14.0) ---
Library              | Device | Time (ms)  | Std       
-------------------------------------------------------
 ASE                 | CPU   | 2688.05    | 5.74      
 Matscipy            | CPU   | 10.16      | 0.03      
 Freud               | CPU   | 12.20      | 2.00      
 Vesin               | CPU   | 5.82       | 0.06      
 RS (1 thread)       | CPU   | 2.89       | 0.07      
 RS (Parallel)       | CPU   | 2.82       | 0.06      
 TorchCluster        | CPU   | 9.14       | 0.51      
 TorchCluster        | GPU   | 18.36      | 0.82      
 TorchNL             | CPU   | 81.01      | 4.50      
 TorchNL             | GPU   | 24.08      | 1.98      

--- Ethanol 1k (PBC) (N=1008, rc=14.0) ---
Library              | Device | Time (ms)  | Std       
-------------------------------------------------------
 ASE                 | CPU   | 6676.95    | 4.42      
 Matscipy            | CPU   | 130.84     | 0.63      
 Vesin               | CPU   | 63.95      | 0.47      
 RS (1 thread)       | CPU   | 37.62      | 0.22      
 RS (Parallel)       | CPU   | 37.88      | 0.15      
 TorchCluster        | ---   | N/A (No PBC support) |           
 TorchNL             | CPU   | 522.08     | 8.28      
 TorchNL             | GPU   | 90.39      | 2.55      

--- Ethanol 10k (PBC) (N=10008, rc=14.0) ---
Library              | Device | Time (ms)  | Std       
-------------------------------------------------------
 ASE                 | CPU   | 11948.54   | 273.39    
 Matscipy            | CPU   | 608.45     | 2.64      
 Freud               | CPU   | 485.05     | 3.00      
 Vesin               | CPU   | 342.63     | 1.84      
 RS (1 thread)       | CPU   | 250.45     | 5.98      
 RS (Parallel)       | CPU   | 264.32     | 3.57      
 TorchCluster        | ---   | N/A (No PBC support) |           
 TorchNL             | CPU   | 4605.02    | 71.68     
 TorchNL             | GPU   | 790.87     | 9.78      

2. Multi-Cutoff Pass [6.0, 14.0] Å

Benchmark for generating two neighbor lists simultaneously (e.g., GNN + Dispersion). (System: Ethanol 10k atoms)

Library Strategy Time (ms)
neighborlist-rs Single Pass (Native) 313
Vesin Filtered (14.0 -> 6.0) 414
Freud Filtered (14.0 -> 6.0) 491
Matscipy Filtered (14.0 -> 6.0) 667
ASE Filtered (14.0 -> 6.0) 11680

3. Batch Throughput (GNN Workloads)

Batch Throughput Benchmark

Throughput in systems per second for batches of isolated 100-atom molecules.

Batch Size neighborlist-rs TorchCluster TorchNL
1 34,477 11,756 525
32 38,198 11,047 481
128 35,293 12,173 445

Note: TorchCluster does not support Periodic Boundary Conditions (PBC).

Key Optimizations

  • Spatial Sorting: Uses Z-order (Morton) indexing to improve cache locality.
  • Dynamic Configuration: Runtime-tunable thresholds for switching between SIMD Brute-Force and Cell Lists.
  • Two-Pass Search: Minimizes heap allocations by pre-calculating neighbor counts.
  • Cross-Platform SIMD: Optimized for both x86_64 (AVX2/FMA) and aarch64 (NEON).

Verification

Run Rust tests:

cargo test

Run Python tests:

pytest tests/

License

Licensed under either of:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neighborlist_rs-0.1.8.tar.gz (3.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

neighborlist_rs-0.1.8-cp313-cp313-win_amd64.whl (548.3 kB view details)

Uploaded CPython 3.13Windows x86-64

neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (742.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

neighborlist_rs-0.1.8-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

neighborlist_rs-0.1.8-cp312-cp312-win_amd64.whl (548.6 kB view details)

Uploaded CPython 3.12Windows x86-64

neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (742.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

neighborlist_rs-0.1.8-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

neighborlist_rs-0.1.8-cp311-cp311-win_amd64.whl (548.2 kB view details)

Uploaded CPython 3.11Windows x86-64

neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (740.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

neighborlist_rs-0.1.8-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file neighborlist_rs-0.1.8.tar.gz.

File metadata

  • Download URL: neighborlist_rs-0.1.8.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for neighborlist_rs-0.1.8.tar.gz
Algorithm Hash digest
SHA256 f4c2eaca14e58f2b926b751e4d8fc7025327fe6778ffa425963831c117535271
MD5 073fa4d2871a06d3514dd1e1ff3ef9b4
BLAKE2b-256 267b6562f409c1d3a0637c9db620f729ac1a5ab7db86c82a627d5bb4d032ad12

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8.tar.gz:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 364be0a372a68cc2fde27f8055b8a52f77af30cdb0ceee9139d1d391e5459f1e
MD5 3b7b97e7d0d387965b04d8c3ebe4eeaa
BLAKE2b-256 f641a3a710d3e2e3cde1279d0e738a3d14241744d8960876b74c9f93d19299ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp313-cp313-win_amd64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 472420d794c68583b097476130aef721a8c7af26fce80cef9cecaededc3e09e0
MD5 4846932b8bf8aaa705d699216f09fe9d
BLAKE2b-256 4f3225f4409d8c2f5a540b93476fc9c6c4ee0d27e34125522e54f239731f20b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d7ea7752e38762902e3e3a40644b6e79424a8b29725b1f17540e22061bb05289
MD5 919f6dc9f2082e4c60b130425a067141
BLAKE2b-256 35a70660bb87037a5c8f9b5d2d554334205ebf291215735e7602b68b9ea3a6be

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 16149c110fee38300f7cc8839f24d73307258a706967b4cf5c58fcfb8877be17
MD5 c35099767cdf8e5374ccb1079ff28006
BLAKE2b-256 718bcf14cac36d645fc122717e506c85f1a74b5eea9d92196c4df7fb29b158a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8aa9afed2ef5418754f91e2c77e37a860b962e784696ba836aebdeb359cda59c
MD5 0951bb7512aaef1c636937bbe658f857
BLAKE2b-256 cf0d42e75e39db45a0d15383b95bc526d7b8dfbfd591c701071a0e2329cbba96

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp312-cp312-win_amd64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a94cc6bc494b50aef9722a820a52bf0e5ac811fdbc792da660a303d45b3da275
MD5 7affe21a33380c125be5d0b69428a510
BLAKE2b-256 bcd534d21ccef4fcd9307bb38cb5481c3a792569422bfecf82c59169a8c8385e

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 523fba98a2a77bf4b56fceda2c41bd226fbbbd14e9e75c8cac25a9488f3ff8a3
MD5 684adce0e3ac4e0a499209fcba942203
BLAKE2b-256 5e2061f56590c1d4e7049bc1997b2c241bf4da3cfc4b83bb881ef9d630f869e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b07fa40ce055c32883b037f315595c67e706ae0f3b832343d17a5baf62567b3e
MD5 432fb360fd455dd41d5b44f61953b64d
BLAKE2b-256 2a8078632ba01f19ee3e480f08b486405a2fce77b65839dffe238fc99dc50a30

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cc87a4cbf49020b4cd97a51c4f49ec84fd05bf42fb911a302ca0af24eb44aed2
MD5 3838027c90520067c4ef8da5fd847e83
BLAKE2b-256 211adfcedf449690d45bad99f8aa497ba5a9971421a2b74efd924bf78eb41bd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp311-cp311-win_amd64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e3151d00c8be16190d5fe24d383c8c9e922e8178c2dd08cad2de9c195308585
MD5 104f2c4241bf7ef4bb6d6b26bee36379
BLAKE2b-256 50e8a33905a8655a6a70cac8bc3b6ea81a366415c083dd622789f360b621e4fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5ba71ad4f32d20097731bafb3334e3ad9582525affdc4173dbba8fbee5775bc4
MD5 c02e596665e0a2df1588a60f75f40376
BLAKE2b-256 3cee93a40e6245a605ac231fe5ebecfec24509e59b215462b4673b0dda57fcec

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file neighborlist_rs-0.1.8-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.8-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e2e948dce89eecbdc7f9926d40ae8390de2fedee833ce8c5c66792c4760aeb2a
MD5 b390190da9e424e5b1bd9f8b8f0f3250
BLAKE2b-256 b9607cadf91d10eff96422eff17cdfff91d2567d50cae0e9f2363dc4cd827f21

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.8-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on solccp/neighborlist-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page