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//! | InChI / InChIKey generation | `inchi` | [`inchi::inchi`], [`inchi::inchi_key`] |
30//! | 3D coordinate generation | `threed` | [`threed::generate_coords`] |
31//! | XYZ / PDB I/O | `threed` | [`threed::parse_xyz`], [`threed::parse_pdb_atoms`] |
32//! | UFF-derived geometry minimization | `threed` | [`threed::minimize`] |
33//!
34//! ## Quick start
35//!
36//! Add to `Cargo.toml`:
37//!
38//! ```toml
39//! [dependencies]
40//! chematic = { version = "0.1", features = ["full"] }
41//! ```
42//!
43//! Parse a molecule and compute properties:
44//!
45//! ```rust,ignore
46//! use chematic::smiles;
47//! use chematic::chem;
48//! use chematic::depict;
49//!
50//! let mol = smiles::parse("CC(=O)Oc1ccccc1C(=O)O").unwrap(); // aspirin
51//! println!("MW: {:.3}", chem::molecular_weight(&mol));
52//! println!("LogP: {:.3}", chem::logp_crippen(&mol));
53//! println!("TPSA: {:.1}", chem::tpsa(&mol));
54//! let svg = depict::depict_svg(&mol);
55//! ```
56//!
57//! ## Feature flags
58//!
59//! | Flag | Includes |
60//! |---|---|
61//! | `smiles` | SMILES parser + core molecule graph |
62//! | `perception` | Aromaticity, ring perception, stereochemistry |
63//! | `mol` | SDF / MOL V2000 + V3000 read/write |
64//! | `depict` | 2D layout + SVG rendering |
65//! | `fp` | ECFP, FCFP, MACCS, AtomPair fingerprints |
66//! | `chem` | Descriptors, LogP, TPSA, scaffolds, standardization |
67//! | `smarts` | SMARTS parser, substructure search, MCS |
68//! | `rxn` | Reaction SMILES, SMIRKS transforms |
69//! | `inchi` | InChI and InChIKey generation |
70//! | `threed` | 3D coordinates, UFF minimization, XYZ/PDB I/O |
71//! | `iupac` | IUPAC nomenclature for simple molecules |
72//! | `full` | All of the above |
73
74#[cfg(feature = "threed")]
75pub use chematic_3d as threed;
76#[cfg(feature = "chem")]
77pub use chematic_chem as chem;
78#[cfg(feature = "smiles")]
79pub use chematic_core as core;
80#[cfg(feature = "depict")]
81pub use chematic_depict as depict;
82#[cfg(feature = "fp")]
83pub use chematic_fp as fp;
84#[cfg(feature = "inchi")]
85pub use chematic_inchi as inchi;
86#[cfg(feature = "iupac")]
87pub use chematic_iupac as iupac;
88#[cfg(feature = "mol")]
89pub use chematic_mol as mol;
90#[cfg(feature = "perception")]
91pub use chematic_perception as perception;
92#[cfg(feature = "rxn")]
93pub use chematic_rxn as rxn;
94#[cfg(feature = "smarts")]
95pub use chematic_smarts as smarts;
96#[cfg(feature = "smiles")]
97pub use chematic_smiles as smiles;
98
99#[cfg(test)]
100mod tests {
101 #[test]
102 fn test_crate_compiles() {
103 // Umbrella crate compiles with no features enabled.
104 }
105}