Skip to main content

voronota_ltr/
lib.rs

1// Copyright (c) 2026 Kliment Olechnovic and Mikael Lund
2// Part of the voronota-ltr project, licensed under the MIT License.
3// SPDX-License-Identifier: MIT
4
5#![deny(missing_docs)]
6
7//! Native rust port of [voronota-lt](https://github.com/kliment-olechnovic/voronota/tree/master/expansion_lt)
8//! for computing radical tessellation contacts and cells.
9//!
10//! This library computes the radical Voronoi tessellation of a set of spheres,
11//! providing contact areas between neighboring spheres and solvent-accessible
12//! surface (SAS) areas and volumes for each sphere.
13//!
14//! # Cell measures
15//!
16//! Detailed [`Cell`] records are sparse. The [`Results::sas_areas`] and [`Results::volumes`]
17//! methods instead return one [`CellMeasure`] per input ball. Detached balls are
18//! [`CellMeasure::Computed`] with their full-sphere measure, geometrically absent cells are
19//! [`CellMeasure::Empty`], and filtered results are [`CellMeasure::NotComputed`].
20//!
21//! # Example
22//!
23//! ```
24//! use voronota_ltr::{Ball, CellMeasure, Results, compute_tessellation};
25//!
26//! let balls = vec![
27//!     Ball::new(0.0, 0.0, 0.0, 1.5),
28//!     Ball::new(3.0, 0.0, 0.0, 1.5),
29//!     Ball::new(1.5, 2.5, 0.0, 1.5),
30//! ];
31//!
32//! let result = compute_tessellation(&balls, 1.4, None, None, false);
33//!
34//! // Per-ball measures distinguish computed, empty, and unavailable cells.
35//! let sas_areas: Vec<CellMeasure> = result.sas_areas();
36//! let volumes: Vec<CellMeasure> = result.volumes();
37//!
38//! // Total SAS area across computed cells.
39//! let total_sas: f64 = result.total_sas_area();
40//!
41//! for contact in &result.contacts {
42//!     println!("Contact {}-{}: area={:.2}", contact.id_a, contact.id_b, contact.area);
43//! }
44//! ```
45
46pub(crate) mod contact;
47pub(crate) mod geometry;
48pub(crate) mod graphics;
49/// Input file parsing (PDB, mmCIF, XYZR formats).
50pub mod input;
51#[cfg(feature = "python")]
52mod python;
53mod solvent_spheres;
54mod spheres_container;
55pub(crate) mod spheres_searcher;
56mod subdivided_icosahedron;
57mod tessellation;
58pub(crate) mod types;
59mod updateable;
60
61pub use graphics::GraphicsWriter;
62pub use input::{FileComputeError, compute_tessellation_from_file};
63pub use solvent_spheres::{SolventSphere, SolventSpheresError, compute_solvent_spheres};
64pub use subdivided_icosahedron::SubdivisionDepth;
65pub use tessellation::{compute_contacts_only, compute_tessellation};
66pub use types::{
67    Ball, Cell, CellEdge, CellMeasure, CellVertex, Contact, PeriodicBox, Results,
68    TessellationResult,
69};
70pub use updateable::{UpdateableResult, UpdateableTessellation};