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

Uploaded CPython 3.13Windows x86-64

neighborlist_rs-0.1.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (742.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12Windows x86-64

neighborlist_rs-0.1.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (742.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (701.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

neighborlist_rs-0.1.7-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.7-cp311-cp311-win_amd64.whl (548.5 kB view details)

Uploaded CPython 3.11Windows x86-64

neighborlist_rs-0.1.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (740.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

neighborlist_rs-0.1.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (700.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

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

File metadata

  • Download URL: neighborlist_rs-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 46acd473330f949f3abf40928341be292b2182894c733afd754f793b5543197c
MD5 3fb5708b3a8d86fbcbc7c7a7b0add1a8
BLAKE2b-256 5e51711ab9f4bd79344e7ef14f2bd2994ef8ad27f4a72ade23e5ab50f890e297

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 21e18626927c7cdb37220b8821055b960746dc3eb5b3a09d7dab943d66d0c908
MD5 af3ded264b6f2ca0fe3b75554e43d136
BLAKE2b-256 196c13eaf09429bc38aae3ac3d4bc8a64f35c43979712e900b30a8ea7c357a80

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1e9aaaea33a7fdda0804d757b889db33b2a0441f00fe0255b50b494a899c5f5
MD5 53e4e5d7de28e152105cfdb43aaa6e9a
BLAKE2b-256 5bacef8fc469ce121c08fa95837346e75d99cbd8c3a60a226ba945cbd9f3ef0c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 755dfd7f4ba5d1675eb62ceb7655449fac8465e8846da6158beb9f2cd6365dad
MD5 207ca97fa6b9f81b8aa93709171e5a00
BLAKE2b-256 7afc168894b688f1ef881fe4e79822dfd7c8f0417271376ddced2622635a09d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.7-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.7-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.7-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 54afde8b73dc679e6d4a2d4585dc2bfb2c18f2fde247753e98fc9806c7dd4cc9
MD5 01c385498e1a06e143d0ad0e1e8513b5
BLAKE2b-256 1876afd89673ebd971997e0ee1ee8dc82faadc842e0d02720c561af43748e1f3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f07a964974dd64e08b8abad62f70d91fd5110db11f86a9ab9ded787b63d5445a
MD5 3e408c2749c2c86111b605821faf661b
BLAKE2b-256 74f9da785884b7f9df826c3d9af715f04488c4bdc497f17b1a4499209fb507ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b6dc6fc6d3ef1f9018ba919883908bc3dc4a6c6c7f0325df3718d7d9e1f16dc
MD5 275334b00910ec61f6c50e0e39a2f2fb
BLAKE2b-256 fe02ee5488c37dc89398eb9061719e442048c940212590f6504b2483fb1dcc73

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d84687f469b98e995c20d5beb447becda46719f2c95cc421bc9f624baaf4f4d
MD5 11e0842ebf6006c3f440de22f6899346
BLAKE2b-256 5387a7c9849d682be5d2fb7f256a4175030d9869f2bb1e61eda52cd518c8795c

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.7-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.7-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.7-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8450d62519c8363819a15320f8651a821da1614a64e81f2ccaba5df3596b89d4
MD5 f7a3316b172a9d8fb0cb3fc5db618fbd
BLAKE2b-256 323ece7079e02579af29a1769551996d77fb609175a7304db6f4308264c17362

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 114cd9590bb19b9de1a03556ccb49eab519130563cebf5d167105e9d4157a06c
MD5 5fc27db1d9cfb15958e7402cfeee0dab
BLAKE2b-256 243a41e5884da838aafd3ac19fb9d95976bc0b712687c5cc322c012d086a0486

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1eac332b9728da8a754d855bd56da838d224c6b1316515e46df318678cace652
MD5 e0d8946053281f7fdd33c5c94de90197
BLAKE2b-256 4019c2eaea4c41440898af8cff583566d579336576dc7c96299305314444bf21

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1ce932a0e8e8c74cf3cdda0ca6943b289fe0b6928d7bacae5381bdb276dd3551
MD5 55010f7911c07b4cce5cec987ad6e48d
BLAKE2b-256 c1e3bf755af87fcaa06518c1fcc4d4dce44dfe34182d083f6268389336315549

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.7-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.7-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.7-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7228f3258880115a6a8e1f09cfc0bfd3c214f9b9128e84cbd3d41781fd3b69e2
MD5 973890db5521654252cebe5e98d1584c
BLAKE2b-256 a032f44f54f71e06dcebe77c08f590666f86fa910557a636aa3e9687b040bf37

See more details on using hashes here.

Provenance

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