Skip to main content

chematic/
lib.rs

1#![forbid(unsafe_code)]
2//! # chematic — Pure-Rust Cheminformatics
3//!
4//! **chematic** is a comprehensive cheminformatics toolkit written entirely in
5//! Rust with zero C/C++ dependencies.  It runs in browsers via WebAssembly,
6//! in serverless functions, and in native Rust applications — all from the
7//! same codebase.
8//!
9//! ## Feature highlights
10//!
11//! | Capability | Crate | Key API |
12//! |---|---|---|
13//! | SMILES parsing & writing | `smiles` | [`smiles::parse`] |
14//! | SMARTS substructure search | `smarts` | [`smarts::find_matches`] |
15//! | Maximum common substructure | `smarts` | [`smarts::find_mcs`] |
16//! | 2D SVG depiction | `depict` | [`depict::depict_svg`] |
17//! | SDF / MOL V2000 + V3000 I/O | `mol` | [`mol::parse_mol`], [`mol::parse_mol_v3000`] |
18//! | CIP stereochemistry (R/S, E/Z) | `perception` | [`perception::assign_stereo_from_2d`] |
19//! | Fingerprints (ECFP4/6, FCFP, MACCS, AtomPair) | `fp` | [`fp::ecfp4`], [`fp::maccs`] |
20//! | Tanimoto / Dice similarity | `fp` | [`fp::BitVec2048::tanimoto`] |
21//! | Molecular descriptors (LogP, TPSA, MW, …) | `chem` | [`chem::logp_crippen`], [`chem::tpsa`] |
22//! | Exact / monoisotopic mass | `chem` | [`chem::exact_mass`] |
23//! | Isotope distribution | `chem` | [`chem::isotope_distribution`] |
24//! | Bemis–Murcko scaffold | `chem` | [`chem::murcko_scaffold`] |
25//! | Structure standardization & salt stripping | `chem` | [`chem::standardize`], [`chem::largest_fragment`] |
26//! | Canonical tautomers | `chem` | [`chem::canonical_tautomer`] |
27//! | Reaction SMILES parsing | `rxn` | [`rxn::parse_reaction`] |
28//! | SMIRKS template application | `rxn` | [`rxn::run_reactants`] |
29//! | 3D coordinate generation | `threed` | [`threed::generate_coords`] |
30//! | XYZ / PDB I/O | `threed` | [`threed::parse_xyz`], [`threed::parse_pdb_atoms`] |
31//! | UFF-derived geometry minimization | `threed` | [`threed::minimize`] |
32//!
33//! ## Quick start
34//!
35//! Add to `Cargo.toml`:
36//!
37//! ```toml
38//! [dependencies]
39//! chematic = { version = "0.1", features = ["full"] }
40//! ```
41//!
42//! Parse a molecule and compute properties:
43//!
44//! ```rust,ignore
45//! use chematic::smiles;
46//! use chematic::chem;
47//! use chematic::depict;
48//!
49//! let mol = smiles::parse("CC(=O)Oc1ccccc1C(=O)O").unwrap(); // aspirin
50//! println!("MW:   {:.3}", chem::molecular_weight(&mol));
51//! println!("LogP: {:.3}", chem::logp_crippen(&mol));
52//! println!("TPSA: {:.1}", chem::tpsa(&mol));
53//! let svg = depict::depict_svg(&mol);
54//! ```
55//!
56//! ## Feature flags
57//!
58//! | Flag | Includes |
59//! |---|---|
60//! | `smiles` | SMILES parser + core molecule graph |
61//! | `perception` | Aromaticity, ring perception, stereochemistry |
62//! | `mol` | SDF / MOL V2000 + V3000 read/write |
63//! | `depict` | 2D layout + SVG rendering |
64//! | `fp` | ECFP, FCFP, MACCS, AtomPair fingerprints |
65//! | `chem` | Descriptors, LogP, TPSA, scaffolds, standardization |
66//! | `smarts` | SMARTS parser, substructure search, MCS |
67//! | `rxn` | Reaction SMILES, SMIRKS transforms |
68//! | `threed` | 3D coordinates, UFF minimization, XYZ/PDB I/O |
69//! | `full` | All of the above |
70
71#[cfg(feature = "smiles")]
72pub use chematic_core as core;
73#[cfg(feature = "smiles")]
74pub use chematic_smiles as smiles;
75#[cfg(feature = "perception")]
76pub use chematic_perception as perception;
77#[cfg(feature = "mol")]
78pub use chematic_mol as mol;
79#[cfg(feature = "depict")]
80pub use chematic_depict as depict;
81#[cfg(feature = "fp")]
82pub use chematic_fp as fp;
83#[cfg(feature = "chem")]
84pub use chematic_chem as chem;
85#[cfg(feature = "smarts")]
86pub use chematic_smarts as smarts;
87#[cfg(feature = "rxn")]
88pub use chematic_rxn as rxn;
89#[cfg(feature = "threed")]
90pub use chematic_3d as threed;
91#[cfg(feature = "iupac")]
92pub use chematic_iupac as iupac;
93
94#[cfg(test)]
95mod tests {
96    #[test]
97    fn test_crate_compiles() {
98        // Umbrella crate compiles with no features enabled.
99        assert!(true);
100    }
101}