assembly_theory/
lib.rs

1//! `assembly_theory` is an open-source, high-performance library for computing
2//! *assembly indices* of molecular structures (see, e.g.,
3//! [Sharma et al., 2023](https://doi.org/10.1038/s41586-023-06600-9);
4//! [Walker et al., 2024](https://doi.org/10.1098/rsif.2024.0367)).
5//!
6//! This crate is specific to the Rust library; see the
7//! [GitHub repository](https://github.com/DaymudeLab/assembly-theory) for ways
8//! to use `assembly_theory` as a standalone executable or as a Python package.
9//!
10//! # Example
11//!
12//! Install the crate as usual:
13//! ```shell
14//! cargo add assembly-theory
15//! ```
16//!
17//! Load a molecule from a `.mol` file and calculate its assembly index:
18//! ```
19//! # use std::{fs, path::PathBuf};
20//! use assembly_theory::{
21//!     assembly::index,
22//!     loader::parse_molfile_str
23//! };
24//!
25//! # fn main() -> Result<(), std::io::Error> {
26//! // Load a molecule from a `.mol` file.
27//! let path = PathBuf::from(format!("./data/checks/anthracene.mol"));
28//! let molfile = fs::read_to_string(path)?;
29//! let anthracene = parse_molfile_str(&molfile).expect("Parsing failure.");
30//!
31//! // Compute the molecule's assembly index using an efficient algorithm.
32//! assert_eq!(index(&anthracene), 6);
33//! # Ok(())
34//! # }
35//! ```
36//!
37//! See [`assembly`] for more usage examples.
38
39// TODO: Cite ORCA JOSS paper when it's out.
40
41// Graph-theoretic utility functions.
42mod utils;
43
44// Graph representations of molecules and associated parsing.
45pub mod loader;
46pub mod molecule;
47
48// Assembly index calculation and supporting functions.
49pub mod assembly;
50pub mod bounds;
51pub mod canonize;
52pub mod enumerate;
53pub mod kernels;
54pub mod memoize;
55mod nauty;
56mod vf3;
57
58// Python wrapper.
59#[cfg(feature = "python")]
60pub mod python;