Expand description
Organic Chemistry Engine.
Pure-Rust implementations of core organic-chemistry primitives:
- SMILES parsing & molecular graph building
- Molecular formula, exact weight, and isotope-aware mass
- Lipinski Rule-of-Five, Veber, Ghose, Egan drug-likeness filters
- LogP (Crippen–Wildman atomic contributions, 25 atom types)
- TPSA (Ertl 2000 atomic contributions)
- H-bond donors / acceptors, rotatable bonds, aromatic ring count
- Functional group detection (20 groups via SMARTS-inspired pattern matching)
- Chiral centre enumeration
- Morgan circular fingerprint generation
- Thermochemistry: Arrhenius, Gibbs–Helmholtz, van’t Hoff, Henderson–Hasselbalch
- Green chemistry: atom economy, E-factor, PMI, RME, yield-adjusted AE
- pKa estimation (functional-group based)
- SMILES structural validation
- InChI / InChIKey format validation
SHACL constraint name → function:
qualia:validateSmiles → validate_smiles()
qualia:validateInchi → validate_inchi()
qualia:computeMolecularWeight → exact_molecular_weight()
qualia:computeLogP → compute_logp()
qualia:computeTPSA → compute_tpsa()
qualia:evaluateLipinski → evaluate_lipinski()
qualia:evaluateVeber → evaluate_veber()
qualia:evaluateGhose → evaluate_ghose()
qualia:evaluateEgan → evaluate_egan()
qualia:detectFunctionalGroups → detect_functional_groups()
qualia:computePka → estimate_pka()
qualia:computeChiralCenters → count_chiral_centers()
qualia:generateCircularFingerprint → circular_fingerprint()
qualia:computeArrheniusRate → arrhenius_rate()
qualia:computeGibbsEnergy → gibbs_free_energy()
qualia:computeEquilibrium → equilibrium_constant()
qualia:computeHendersonHasselbalch → henderson_hasselbalch()
qualia:computeAtomEconomy → atom_economy()
qualia:computeEFactor → e_factor()
qualia:computeGreenMetrics → green_metrics()
Structs§
- Atom
- BbbPermeation
Result - Bond
- Egan
Result - Ghose
Result - Green
Metrics - Inchi
Validation - Isotope
Distribution - Lipinski
Result - Molecular
Descriptors - Molecule
- PkaEstimate
- Smiles
Validation - Veber
Result
Enums§
Constants§
- R_
J_ MOL_ K - Universal gas constant J / (mol·K)
Functions§
- arrhenius_
rate - Arrhenius rate constant k at temperature T (K).
k = A × exp(−Ea / (R × T))
activation_energy_j_mol: Ea in J/mol - arrhenius_
ratio - Temperature dependence of k using the Arrhenius equation. Returns (k_t1, k_t2).
- atom_
economy - Simplified atom economy (Trost): single product vs all reactants.
- catalyst_
activity - Catalyst activity at time
tunder first-order deactivation:a(t) = a₀·exp(−k_d·t). Models the degradation that limits sustained yield on small decentralized nodes. - circular_
fingerprint - Morgan algorithm: radius-
rcircular fingerprint as sorted Vecidentifiers. - compute_
descriptors - Compute all Lipinski/Veber/Ghose descriptors from a parsed molecule.
- compute_
logp - Per-atom LogP contributions mapped by (element, aromaticity, polar_neighbour). Derived from Wildman & Crippen 1999, Table 1 (25 of 68 atom types).
- compute_
tpsa - Topological polar surface area in Ų.
- conversion_
under_ variable_ temperature - Total fractional conversion of a first-order reaction under a variable temperature
profile — e.g. fluctuating off-grid power driving a fluctuating reactor temperature.
Integrates
dX/dt = k(T)·(1−X)acrosstemp_profile_k(k from the Arrhenius rate, explicit-Euler steps ofdt_s), returning the final conversionX ∈ [0,1]. Zero-heap (the profile is a caller slice). - count_
chiral_ centers - Count sp3 carbon atoms with 4 distinct substituents (simplified: sp3 C with degree 4).
- deactivated_
reaction_ rate - Effective reaction rate accounting for catalyst decay:
r_eff = r_base · a(t)/a₀. - detect_
functional_ groups - Detect functional groups in a molecule. Returns unique set.
- e_
factor - E-factor (Sheldon): waste_kg / product_kg. Fine chemicals < 50; bulk < 5; pharma 25–100.
- equilibrium_
constant - Equilibrium constant from ΔG°: K = exp(−ΔG° / (R × T))
- estimate_
pka - Estimate pKa values from functional group type (literature reference values).
- evaluate_
egan - evaluate_
ghose - evaluate_
lipinski - evaluate_
veber - exact_
molecular_ weight - Exact monoisotopic molecular weight (Da).
- formula_
string - Hill-order formula string (C first, H second, then others alphabetically).
- gibbs_
free_ energy - Gibbs free energy ΔG = ΔH − T × ΔS (all in J/mol or kJ/mol consistently).
- gibbs_
from_ equilibrium - ΔG° from equilibrium constant K: ΔG° = −R × T × ln(K)
- gibbs_
helmholtz - Gibbs–Helmholtz: ΔG(T2) from ΔG(T1).
- green_
metrics - henderson_
hasselbalch - Henderson–Hasselbalch: pH = pKa + log10([A-] / [HA])
- ionisation_
fraction - Degree of ionisation α at a given pH for a monoprotic acid.
- isotope_
mass_ distribution - Computes the theoretical M, M+1, M+2 isotopic distribution based on the number of Carbon, Nitrogen, Oxygen, Sulfur, Chlorine, and Bromine atoms.
- ligand_
efficiency - Computes Ligand Efficiency (LE): pIC50 / Heavy Atom Count (HAC). Standard target is LE >= 0.3.
- lipophilic_
ligand_ efficiency - Computes Lipophilic Ligand Efficiency (LLE): pIC50 - LogP. Standard target is LLE >= 5.0.
- molecular_
formula - Atom counts by element symbol.
- parse_
smiles - Parse a SMILES string into a
Molecule. - predict_
bbb_ permeation - Evaluates Blood-Brain Barrier (BBB) permeation probability using Clark’s rules (Molecular Weight, LogP, PSA, HBD).
- urea_
equilibrium_ extent - Equilibrium extent ξ of the Bosch–Meiser urea synthesis
2 NH₃ + CO₂ ⇌ (NH₂)₂CO + H₂O, solved from the equilibrium constant (via the caller-supplied ΔG° attemp_k) and the initial NH₃/CO₂ partial pressures, by bisection on the reaction quotientQ(ξ) = ξ² / ((p_NH₃−2ξ)²·(p_CO₂−ξ))(strictly increasing in ξ). Returns ξ in the same units as the input pressures. Simplified gas-phase model (industrial urea is liquid-phase/high-P — that shifts the numbers, not the method). Demonstrates Le Chatelier: higher reactant pressure ⇒ higher ξ. - validate_
inchi - validate_
smiles - vant_
hoff_ enthalpy - van’t Hoff enthalpy estimate from two equilibrium constants at two temperatures.