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)

Usage (Rust)

Refer to RUST_API.md for detailed Rust documentation.

Single System Search

use neighborlist_rs::build_neighborlists;

let positions = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]];
let cutoff = 1.5;
let result = build_neighborlists(&positions, cutoff, None, true).unwrap();

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.9.tar.gz (3.3 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.9-cp313-cp313-win_amd64.whl (548.5 kB view details)

Uploaded CPython 3.13Windows x86-64

neighborlist_rs-0.1.9-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.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

neighborlist_rs-0.1.9-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.9-cp312-cp312-win_amd64.whl (548.8 kB view details)

Uploaded CPython 3.12Windows x86-64

neighborlist_rs-0.1.9-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.9-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.9-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.9-cp311-cp311-win_amd64.whl (548.4 kB view details)

Uploaded CPython 3.11Windows x86-64

neighborlist_rs-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (740.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

neighborlist_rs-0.1.9-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.9.tar.gz.

File metadata

  • Download URL: neighborlist_rs-0.1.9.tar.gz
  • Upload date:
  • Size: 3.3 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.9.tar.gz
Algorithm Hash digest
SHA256 ff1262f0bc2eba62113972e44c19fb3220a0279120693b3517da3574c619617b
MD5 d879fb30024ec45d1b03312b4f0594b7
BLAKE2b-256 f0cee6c63c2ed8e0b1bf4d52db4ad59b316f4fb4a61850e7d424959de7f7cc09

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9.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.9-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e4becd3c339e8cd3f12072d8ca0a3f527a05e566626516590c979b19f5cb2b10
MD5 3ec168aa6795dce678369dc6f38720ef
BLAKE2b-256 fff66b3d76e817ef17f604d0c855168a612115809634af52d3edd747764b3262

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37dcd20d02dc162c1f2b58daa2830b553fa9d139272cfd03e441a34fedbc52e8
MD5 0dad3f9c94ede03712522929803a21d7
BLAKE2b-256 e4cbbece639edd86a20d155596a3b81492e670a88c3329566022add9c934c76b

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 82387db31abbe7a854ea3f9abebc2583e6317f3511af0f333dea9050c21cbadb
MD5 3aa512f91f89363f8fb4cd878769e124
BLAKE2b-256 18791769a99aa81239cd091c3f798b881b7549b083975bd98317aaeec0a629d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-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.9-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8043035389bc5bb0bbf36e609bdc7b23a4a24ff947bb2587169b842aee7a27f8
MD5 289eb7069a72fb5caab199a674fe8245
BLAKE2b-256 c2d262c1e24135853babf7a45f99d2474ab08971dde9181f5a4dfcbbeaf76bf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 543e0b0eda20f151073a820e8fd93e8b08836f716765f31e39046f455b3b87ca
MD5 8bb6aef3d7d42a9c86e61bf0f610d50a
BLAKE2b-256 17c6a387edebccae988a22dce5b83126d8c9a7289e84c11910dc3fcc5e781033

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08391a53ed0335b66e5e77535a6b1acfa835b23d951290b853488e6e2a245956
MD5 e2f11497fd509441f990bbbecdf68ffd
BLAKE2b-256 45bab3027e136f7361cdac253b68eafff296885047db55b510a15839eeeccc66

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 81af0dc87889b0daedf7256849366c85756667a2f87de55e5399b6a08c7eb0a4
MD5 058d50807c11a75919c281d1d2e3f137
BLAKE2b-256 e8fb2f9c41a42c20e9ebfba6b81b77614d235de1332100583bf4116037267e7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-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.9-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8d2d11f63368952fc3acd918e3e8b55186c39b8d4bf999a5b0cceb4f55f1fa08
MD5 8d7a72c4a437f150be2b0e39078a1291
BLAKE2b-256 f5c8b071a8e61015ffac8e97932d94375a59eb8fa19546cb8f8b745166f40c58

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 98bf8ed9d2a7a0f4e806273d79f3492917e35eabd8ec565f94a7771358628d0f
MD5 a60587d07253b8022d7ff31d5d0c2a49
BLAKE2b-256 dbc3952b23bdc2d3112c46f1f4afaebf2a6de53ee963e8ea0cfd4357674345f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 462b44d98f3a23f943772e410d64ef8caebfe3daa9caba07b685c6f83ecea94c
MD5 b2e71a6df43c1e1e4e418287ea8b27a8
BLAKE2b-256 2f99c85548393c56ab27048732eeebba22172cbbe2d6a906f11bf1d6fbf74123

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 23e7f198e60f4c0e01438894fce75124ee0e1047617f86e23cfcb77e831f7f9a
MD5 285243bc26bc9b4a1e7cd1c7fb9f750e
BLAKE2b-256 ed7b9d729f479ae16c6fa1f241b6c20fae34eb92dfca6702c8b4bcaa0d920341

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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.9-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.9-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 998749c4efdbe2fdc4f55bb4690bc2bcd33930277e33cd9de87c30f96ef09f43
MD5 58021bd3e5f42b5ae5308b2c864fc313
BLAKE2b-256 bb2832fb8855314782178f47eaeade13603ed7c0079a39884e4c516e7ae36ad1

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.9-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