Voronota-LT in Rust
Experimental, native Rust port of voronota-lt originally written in C++. Replaces the previous bindings crate. Computes radical Voronoi tessellation of atomic balls constrained inside a solvent-accessible surface. Outputs inter-atom contact areas, solvent accessible surface (SAS) areas, and volumes.
Features
- Pure, safe Rust
- Basic radical tessellation (stateless)
- Updateable tessellation for incremental updates (stateful)
- Periodic boundaries
- Per atom SASA and volume
- Explicit computed, empty, and unavailable cell measures
- Contacts-only mode (skips cells/SAS/volumes for ~30–50% speedup)
- Groupings to avoid internal contacts
- Parallel processing using Rayon - see benchmarks below
- PDB, mmCIF, and XYZR input formats with auto-detection
- Unit-tests and benchmarks carried over from the C++ side
- Python bindings via PyO3
- Rust API and CLI
- Based on Voronota-LT v1.1.479 — reviewed against v1.1.492; all upstream bug fixes are already incorporated and new features (preliminary cutting planes, CAD-score-LT) are CLI-level additions not relevant to the core tessellation library
Installation
The port can be used either as a library for other projects, or as a basic CLI tool:
cargo install voronota-ltr
The Python extension can be installed with pip install voronota-ltr. Building from source
requires a Rust toolchain. Install voronota-ltr[numpy] when using NumPy array input.
Version 0.7 fixes an ambiguity in per-ball measures and changes the Rust return type from
Vec<Option<f64>> to Vec<CellMeasure>. See the cell-measure migration guide
and 0.7 release notes.
Rust API
use voronota_ltr::{Ball, CellMeasure, Results, compute_tessellation};
let balls = vec![
Ball::new(0.0, 0.0, 0.0, 1.5),
Ball::new(3.0, 0.0, 0.0, 1.5),
Ball::new(1.5, 2.5, 0.0, 1.5),
];
let result = compute_tessellation(&balls, 1.4, None, None, false);
// Per-ball measures distinguish computed, empty, and unavailable cells.
let sas_areas: Vec<CellMeasure> = result.sas_areas();
let volumes: Vec<CellMeasure> = result.volumes();
for (index, volume) in volumes.iter().enumerate() {
match volume {
CellMeasure::Computed(value) => println!("ball {index}: {value:.3} ų"),
CellMeasure::Empty => println!("ball {index}: empty weighted cell"),
CellMeasure::NotComputed => println!("ball {index}: measure unavailable"),
}
}
// Total SAS area
let total_sas: f64 = result.total_sas_area();
// Detailed contact and cell data
for contact in &result.contacts {
println!("Contact {}-{}: area={:.2}", contact.id_a, contact.id_b, contact.area);
}
Contacts only (no cells/SAS/volumes)
When only contact areas are needed (e.g. for contact energy calculations),
compute_contacts_only skips solid angle, volume, and cell computation:
use voronota_ltr::{Ball, compute_contacts_only};
let balls = vec![
Ball::new(0.0, 0.0, 0.0, 1.5),
Ball::new(3.0, 0.0, 0.0, 1.5),
Ball::new(1.5, 2.5, 0.0, 1.5),
];
// Optional group IDs to restrict to inter-group contacts
let groups = vec![0, 0, 1];
let contacts = compute_contacts_only(&balls, 1.4, None, Some(&groups));
for c in &contacts {
println!("Contact {}-{}: area={:.2}", c.id_a, c.id_b, c.area);
}
With periodic boundary conditions
use voronota_ltr::{Ball, PeriodicBox, compute_tessellation};
let balls = vec![Ball::new(0.0, 0.0, 0.0, 1.5)];
let pbox = PeriodicBox::from_corners((0.0, 0.0, 0.0), (10.0, 10.0, 10.0));
let result = compute_tessellation(&balls, 1.4, Some(&pbox), None, false);
Updateable tessellation
For simulations where only a few spheres change position each step, UpdateableTessellation
provides efficient incremental updates:
use voronota_ltr::{Ball, UpdateableTessellation};
let mut balls = vec![
Ball::new(0.0, 0.0, 0.0, 1.0),
Ball::new(2.0, 0.0, 0.0, 1.0),
Ball::new(4.0, 0.0, 0.0, 1.0),
];
// Create with backup support for undo
let mut tess = UpdateableTessellation::with_backup();
tess.init(&balls, 1.0, None);
// Move first sphere
balls[0].x += 0.1;
tess.update_with_changed(&balls, &[0]); // Only recompute affected contacts
// Get results
let summary = tess.summary();
println!("Total contacts: {}", summary.contacts.len());
// Undo last update
tess.restore();
Command Line Tool
Supports PDB, mmCIF, and XYZR input formats (auto-detected from extension or content):
# PDB / mmCIF / XYZR input
voronota-ltr structure.pdb --probe 1.4
# Save JSON output to file instead of stdout
voronota-ltr structure.pdb -o results.json
# Exclude heteroatoms (HETATM records)
voronota-ltr structure.pdb --exclude-heteroatoms
# Include hydrogen atoms (excluded by default)
voronota-ltr structure.pdb --include-hydrogens
# Custom radii file (format: residue atom radius per line)
voronota-ltr structure.pdb --radii-file custom_radii.txt
# With periodic boundary conditions
voronota-ltr structure.xyzr --periodic-box-corners 0 0 0 100 100 100
Custom selections
Group atoms using VMD-like selection syntax to filter contacts. Only inter-group contacts are computed.
# Protein-ligand interface (5IN3: galactose-1-phosphate uridylyltransferase)
voronota-ltr 5IN3.cif -s "protein" "resname G1P H2U"
# Homodimer interface
voronota-ltr 5IN3.cif -s "chain A" "chain B"
See the Selection Language section for full syntax.
Loading JSON output in Python
If using the CLI, results can be loaded from JSON:
import json
with open("results.json") as f:
data = json.load(f)
# Per-ball data (indexed by ball, None when no cell was included in the CLI result)
sas_areas = data["sas_areas"] # list of float or None
volumes = data["volumes"] # list of float or None
# Totals
total_sasa = data["total_sas_area"]
total_volume = data["total_volume"]
total_contact_area = data["total_contact_area"]
# Contact details
for contact in data["contacts"]:
print(f"Contact {contact['id_a']}-{contact['id_b']}: area={contact['area']:.2f}")
PyMOL visualization
Generate a Python script to visualize contact surfaces in PyMOL:
voronota-ltr structure.pdb --inter-chain-only --pymol contacts.py
pymol structure.pdb contacts.py
This creates three CGO objects: contacts_balls (cyan spheres), contacts_faces (yellow contact surfaces), and contacts_wireframe (red boundary lines).
Python Interface
Install from PyPI:
pip install voronota-ltr
# Optional NumPy array input
pip install "voronota-ltr[numpy]"
Alternatively, install directly from GitHub (requires a Rust toolchain):
pip install git+https://github.com/mlund/voronota-ltr.git
For local development, build and install using maturin:
pip install maturin
maturin develop --features python # Development build
maturin develop --features python --release # Optimized build
Both methods install the Python module and CLI binary.
Run tests:
python -m unittest discover -s tests -p "test_*.py"
Basic usage; input balls can be tuples, dicts, or NumPy arrays. NumPy is optional when passing ordinary Python lists.
from voronota_ltr import compute_tessellation
result = compute_tessellation(
balls=[(0, 0, 0, 1.5), (3, 0, 0, 1.5), (1.5, 2.5, 0, 1.5)],
probe=1.4,
)
print(f"Total SAS area: {result['total_sas_area']:.2f}")
print(f"Total volume: {result['total_volume']:.2f}")
# Dense per-ball output. Empty cells are zero; unavailable cells are None.
for index, (state, volume) in enumerate(zip(result["cell_states"], result["volumes"])):
print(f"Ball {index}: state={state}, volume={volume}")
for contact in result["contacts"]:
print(f"Contact {contact['id_a']}-{contact['id_b']}: area={contact['area']:.2f}")
The dense cell_states, sas_areas, and volumes lists always have num_balls entries:
cell_states[i] |
sas_areas[i] / volumes[i] |
Meaning |
|---|---|---|
"computed" |
float | A cell was computed; detached balls have their full-sphere measure. |
"empty" |
0.0 |
The weighted cell is geometrically empty. |
"not_computed" |
None |
Filtering prevented a complete cell calculation. |
The sparse cells list remains available for detailed cell records. See the
Python API guide for the complete result schema.
With periodic boundaries:
# Orthorhombic box from corner coordinates
result = compute_tessellation(
balls=balls,
probe=1.4,
periodic_box={"corners": [(0, 0, 0), (50, 50, 50)]},
)
# Triclinic cell from lattice vectors
result = compute_tessellation(
balls=balls,
probe=1.4,
periodic_box={"vectors": [(50, 0, 0), (0, 50, 0), (0, 0, 50)]},
)
With tessellation network output:
result = compute_tessellation(
balls=balls,
probe=1.4,
with_cell_vertices=True,
)
for vertex in result["cell_vertices"]:
print(f"Vertex at ({vertex['x']:.2f}, {vertex['y']:.2f}, {vertex['z']:.2f})")
print(f" On SAS: {vertex['is_on_sas']}")
From structure files
Compute tessellation directly from PDB, mmCIF, or XYZR files:
from voronota_ltr import compute_tessellation_from_file
# Basic usage
result = compute_tessellation_from_file("structure.pdb", probe=1.4)
# VMD-like selections for protein-ligand interface
result = compute_tessellation_from_file(
"complex.pdb",
probe=1.4,
group_selections=["protein", "resname LIG"],
)
# Inter-chain contacts only
result = compute_tessellation_from_file(
"dimer.cif",
probe=1.4,
group_selections=["chain A", "chain B"],
)
Solvent spheres
Generate weighted pseudo-solvent spheres on the exposed molecular surface:
from voronota_ltr import compute_solvent_spheres
spheres = compute_solvent_spheres(
balls=[(0, 0, 0, 1.5), (3, 0, 0, 1.5)],
probe=1.4,
subdivision_depth=2, # 0-4, controls sampling density (default: 2)
)
for s in spheres:
print(f"Sphere at ({s['x']:.2f}, {s['y']:.2f}, {s['z']:.2f}), "
f"weight={s['weight']:.3f}, parent={s['parent_index']}")
Selection Language
The -s/--selection flag accepts VMD-like selection syntax for defining atom groups.
Only contacts between different groups are computed, which is useful for interface analysis.
Syntax
voronota-ltr file.pdb -s "selection1" "selection2" ...
At least two selections are required. Only contacts between atoms in different groups are computed.
Keywords
| Keyword | Description | Example |
|---|---|---|
chain |
Chain identifier(s) | chain A B |
resname |
Residue name(s) | resname ALA GLY |
resid |
Residue number(s) or range | resid 1 to 100 or resid 1:100 |
name |
Atom name(s) with glob patterns | name CA or name C* |
protein |
Standard amino acids | protein |
backbone |
Protein backbone (C, CA, N, O) | backbone |
sidechain |
Protein sidechains (non-backbone) | sidechain |
nucleic |
Nucleic acid residues | nucleic |
hetatm |
HETATM records | hetatm |
hydrophobic |
Hydrophobic residues (ALA, VAL, LEU, ILE, MET, PHE, TRP, PRO, GLY) | hydrophobic |
aromatic |
Aromatic residues (PHE, TYR, TRP, HIS) | aromatic |
acidic |
Acidic residues (ASP, GLU) | acidic |
basic |
Basic residues (ARG, LYS, HIS) | basic |
polar |
Polar residues (SER, THR, ASN, GLN) | polar |
charged |
Charged residues (ASP, GLU, ARG, LYS) | charged |
all |
All atoms | all |
none |
No atoms | none |
Boolean operators
Combine selections with and, or, not, and parentheses:
# Sidechain-only dimer interface (exclude backbone)
voronota-ltr 5IN3.cif -s "chain A and sidechain" "chain B and sidechain"
# Protein-ligand contacts, excluding cryoprotectant (EDO)
voronota-ltr 5IN3.cif -s "protein and not resname EDO" "resname G1P H2U ZN"
Glob patterns
Atom and residue names support glob wildcards:
*matches any characters:name C*matches CA, CB, CG, etc.?matches single character:name ?Amatches CA, NA, etc.[abc]matches character class:name C[AG]matches CA or CG
Benchmarks
Run benchmarks with cargo bench.
Performance on Apple M4 processor (10 cores) - the speedup is relative to single threaded runs:
| Dataset | Balls | C++ (OpenMP) | Rust (Rayon) | C++ Speedup | Rust Speedup |
|---|---|---|---|---|---|
balls_cs_1x1 |
100 | 179 µs | 79 µs | 0.4x | 0.8x |
balls_2zsk |
3545 | 14 ms | 12 ms | 5.1x | 5.9x |
balls_3dlb |
9745 | 38 ms | 30 ms | 5.0x | 5.9x |
License
MIT License
Copyright (c) 2026 Kliment Olechnovic and Mikael Lund
Metadata
Release files for voronota-ltr 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| voronota_ltr-0.7.1.tar.gz | 360.1 kB | Without provenance | Details for voronota_ltr-0.7.1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| voronota_ltr-0.7.1-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details for voronota_ltr-0.7.1-cp38-abi3-win_amd64.whl |
| voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details for voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| voronota_ltr-0.7.1-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details for voronota_ltr-0.7.1-cp38-abi3-macosx_11_0_arm64.whl |
| voronota_ltr-0.7.1-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details for voronota_ltr-0.7.1-cp38-abi3-macosx_10_12_x86_64.whl |
Total release size: 2.2 MB
Release files / voronota_ltr-0.7.1.tar.gz
| Download URL | voronota_ltr-0.7.1.tar.gz |
|---|---|
| Size | 360.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0eb9f72566c93a95826fa076c1e1404f0f26129ad25680dd543c3c67939d341
|
|
BLAKE2b-256 checksum How to use checksums |
532d06c4871a38405271395968d91981c5d7e5c9fdf64ce1094c211f6f3a6e6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Release files / voronota_ltr-0.7.1-cp38-abi3-win_amd64.whl
| Download URL | voronota_ltr-0.7.1-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 11.0 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d143173232f078f17436e45bc0352ae86f191eebebee4b5e8881ad67af65a79b
|
|
BLAKE2b-256 checksum How to use checksums |
70ff33cca43d1185f201111202b79fb45c27c4cecd492ec08a57a83a629e1401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Release files / voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 461.7 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2653ed5ce2c2489372ef08139df3a669b960edcd8e27313c26e42b513cf99f86
|
|
BLAKE2b-256 checksum How to use checksums |
c412bb4bea59120459f544d419089df97bb2057d91224f773d08b445ea73c97a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Release files / voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | voronota_ltr-0.7.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 434.0 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
12036665e8e005a919560108cfa24c686babab4b1bc268764780f7d1a4cc8355
|
|
BLAKE2b-256 checksum How to use checksums |
3c4765f287dabe6610bef581423a431bd9a2a71e4f982cd1270fa370d828bbdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Release files / voronota_ltr-0.7.1-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | voronota_ltr-0.7.1-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 453.7 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b58295b3e524f780c018a42f5b9a34c1326fe1536e27141677fd90634f6adbce
|
|
BLAKE2b-256 checksum How to use checksums |
3880ba7ced6cf76dbf2aac65fe17cc3c920ed2452998108c3e608239be3fa00a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Release files / voronota_ltr-0.7.1-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | voronota_ltr-0.7.1-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 464.1 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
22a06f5c3e39f18ab4e4ac5e7e6c61b48d37f21ee32bcc969e67e278652cd351
|
|
BLAKE2b-256 checksum How to use checksums |
e25ea8e00e1f9a5a7a4b56edc7c88f67e3aacff35f056d5fcfff32353e711d9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.0
|
Security for voronota-ltr 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.