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.5.tar.gz (1.8 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.5-cp313-cp313-win_amd64.whl (546.7 kB view details)

Uploaded CPython 3.13Windows x86-64

neighborlist_rs-0.1.5-cp313-cp313-manylinux_2_24_x86_64.whl (739.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64

neighborlist_rs-0.1.5-cp313-cp313-manylinux_2_24_aarch64.whl (698.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ ARM64

neighborlist_rs-0.1.5-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.5-cp312-cp312-win_amd64.whl (547.0 kB view details)

Uploaded CPython 3.12Windows x86-64

neighborlist_rs-0.1.5-cp312-cp312-manylinux_2_24_x86_64.whl (739.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64

neighborlist_rs-0.1.5-cp312-cp312-manylinux_2_24_aarch64.whl (699.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ ARM64

neighborlist_rs-0.1.5-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.5-cp311-cp311-win_amd64.whl (546.4 kB view details)

Uploaded CPython 3.11Windows x86-64

neighborlist_rs-0.1.5-cp311-cp311-manylinux_2_24_x86_64.whl (737.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64

neighborlist_rs-0.1.5-cp311-cp311-manylinux_2_24_aarch64.whl (698.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ ARM64

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

File metadata

  • Download URL: neighborlist_rs-0.1.5.tar.gz
  • Upload date:
  • Size: 1.8 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.5.tar.gz
Algorithm Hash digest
SHA256 476681f2cbf50717aae8573ec8d5cb364e9139d2ee28485dd891c55795984551
MD5 894fe9e692fbae7775bced8e6a22a4b4
BLAKE2b-256 3014169fdf21586390c742b5e8baab22b3dc103f1f57cd8920424c7a4b139f2a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 171debacb611e4dd53640630dc2b88f007519beaa33c774e999ba9965600e1ab
MD5 4a9ca5160fb97b751098b5030504e597
BLAKE2b-256 c00d7d3e472d9505dc2a8a1d8087c75eaba437f488c2b67e229c324d0767f169

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-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.5-cp313-cp313-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp313-cp313-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 9710fc819aea10763806917bcad3c10cf54f107384b681e5a918ba94d2a75510
MD5 3b5092cab34185d2e16f006a0706fb75
BLAKE2b-256 3db89b98531a3edafc472d56d0fae1f582cb8c130c86fe8adc2b3c5c365bfbb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-cp313-cp313-manylinux_2_24_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.5-cp313-cp313-manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp313-cp313-manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 9bb92c78429ea8df88b690d09f3be6a01828ec722d1027e1f163c58ac1118157
MD5 f1a6ed69230f4497d7614c838d394b7c
BLAKE2b-256 c84cdb3f825138b272b085a2a7a2b45a8b6aee01de17c363311c933bb4fb260f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-cp313-cp313-manylinux_2_24_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.5-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.5-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 4b94b8a8ad6930199e6e65cc431728a70862cf7c1fd306a15b9ea5ab1986d4ea
MD5 9bc246b8bf5f801588f451e619fc65f5
BLAKE2b-256 b82d7829f534e12b4570748ff3ed6b89965aae5d0ca674045c6fb064952c52e7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b47a904b49fd76624dec203f5c4a7eb5726c5bda4d5d78c0a1a646f47c83d330
MD5 1b4623ad664ecfcc12a4dab386961d7c
BLAKE2b-256 d87722e54ab9fcbf9db759937812ae89a373c0e99284e9f404dedbc29fa557d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-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.5-cp312-cp312-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp312-cp312-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 fbc9dfe1fb19cbc0f25d1d3f2010614efc3c031f06369e6373bea6bf161382ee
MD5 57ae4424894a82d5c0be36560010341a
BLAKE2b-256 46cd01b41862d9b74ea53b90a567966f08a70cc5ec4c0d6b4710ba942ee262c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-cp312-cp312-manylinux_2_24_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.5-cp312-cp312-manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp312-cp312-manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 b259cc007fd212dc5990bec4e5bb653a5cf352a51bc882a4859bf74f809bbbd9
MD5 344cbc80bbbcd2646090cea2f403590c
BLAKE2b-256 bf6dd48d8ab4447281beb53c52c66ec4ef55af5e8b315210bd05eb45cc954254

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-cp312-cp312-manylinux_2_24_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.5-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.5-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 1e08174a794d197f2b5f942f27f658dc4416ccbfb9fc52cc6e4114120baf1f65
MD5 e705497ce63d50758e1bdfaba9024e69
BLAKE2b-256 ba9b5f5596fdb06bc9c023b2fedaefdeec010a5536e1fe86afc94e241a73c4b4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3400240eeb8e81ffddb3301d5168cfadcad0985f4dec273f03c650fb78ddcffe
MD5 cedb90b1aff355d9c8e8a5f8554dcd66
BLAKE2b-256 c28b3c0385dd1e142794f782743e49dc5333c5226d149648b1d883113aba08a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-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.5-cp311-cp311-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d21d35fca84df3824320e40fc48330a38ffe8732ed1ce16a13759443634b8c81
MD5 1acaf6705dcd8e7b47af95530684ff8f
BLAKE2b-256 e4ec86bd45e94cf49e92ce25745ae4d5727e79d3c44b89173f8e644683552b21

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-cp311-cp311-manylinux_2_24_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.5-cp311-cp311-manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for neighborlist_rs-0.1.5-cp311-cp311-manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 316bf6305fc78ed7982fa9dc8d6eb817ad2fd68decb153f889f9f2ad5c27072a
MD5 c084453bb707ae42ad3c33e2dca10833
BLAKE2b-256 2375441eb8bb03969459a1e4b77d26881abccb80ce7ec65e47220cd648765f7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for neighborlist_rs-0.1.5-cp311-cp311-manylinux_2_24_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.5-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.5-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 dc1139b2c90d5257a00e2d005b7f2abb10cb03bb8c9b4e0641594bbb068ae21f
MD5 3ae813c31866a72cb9afdad67c2a0387
BLAKE2b-256 fbd3d3924d8a08688a5cbd0ab29026aed9279a25e9fcbe4f6e13acb8b316ddd8

See more details on using hashes here.

Provenance

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