SMILES & MDL Molfile Molecular Graphs (.smi, .smarts, .mol, .sdf)
@modelscript/smiles (languages/smiles) provides zero-regex native WebAssembly GLR parsing, organic valence and Hückel DAEBuilder lowering, and Aspen Plus / Modelica projections for OpenSMILES, SMARTS, and MDL Molfile V2000 / Structure-Data File (.sdf) molecular specifications.
Supported Extensions & Standards
| Extension | Format | Description |
|---|---|---|
.smi, .smiles | OpenSMILES | Line notation encoding molecular graphs, ring closures, branches, stereochemistry (@/@@), and aromatic atoms |
.smarts | SMARTS | Substructure query patterns for functional-group matching |
.mol, .sdf | MDL V2000 / SDF | 2D/3D atomic coordinate tables, bond orders, and associated structure-data property tags (> <Property>) |
Key Capabilities
1. Molecular Graph Topology & Valence Verification
- Constructs typed molecular graphs with implicit/explicit hydrogen counting, ring-closure matching (including
%nntwo-digit rings), disconnected salts/mixtures (.), formal charges, isotopes, and Kekulé/aromatic conjugation.
2. Joback & Reid Group-Contribution Property Estimator
- Automatically decomposes molecular graphs into functional groups (
-CH3,-CH2-,>C=O,-OH,-COOH,-NH2, aromatic ring carbons, halogens) to estimate pure-component physical properties:- Normal boiling point
and freezing point ( ) - Critical temperature
( ), critical pressure ( ), and critical molar volume ( ) - Standard enthalpy of formation
and Gibbs energy of formation ( ) - Ideal-gas heat capacity polynomial
and Lee-Kesler acentric factor .
- Normal boiling point
3. Aspen Plus, Modelica & DAE Lowering
- Projects estimated critical and thermochemical parameters directly into Aspen Plus pure-component property cards (
smilesToAspen), Modelica media records (smilesToModelica), and@modelscript/runtime'sDAEBuilder.
Pre-Flight Diagnostics
10 rules9 error1 warning
| Code | Rule | Severity | Message |
|---|---|---|---|
M9301 | unclosed-ring-digit | error | Ring closure digit '<ringId>' in '<moleculeName>' has no matching closing bond. |
M9302 | unbalanced-branch-parenthesis | error | Branch parenthesis in '<moleculeName>' is unbalanced. |
M9303 | valence-exceeded | error | Atom '<element>' (index '<atomIndex>') in '<moleculeName>' has bond order sum '<actualValence>' exceeding maximum allowed valence '<maxValence>'. |
M9304 | invalid-aromatic-kekule-ring | error | Aromatic ring in '<moleculeName>' violates Hückel's 4n+2 pi-electron rule or cannot be Kekulized. |
M9305 | unknown-chemical-element | error | Atomic symbol '<symbol>' in '<moleculeName>' is not a valid IUPAC element. |
M9306 | conflicting-ring-bond-order | error | Ring closure '<ringId>' in '<moleculeName>' specifies conflicting bond orders at opening and closing atoms. |
M9307 | self-loop-bond | error | Bond in '<moleculeName>' connects atom '<atomIndex>' to itself. |
M9308 | duplicate-atom-bond | error | Multiple bonds declared between identical atom pair ('<atomA>', '<atomB>') in '<moleculeName>'. |
M9309 | invalid-tetrahedral-chirality | warning | Chiral center '<atomIndex>' in '<moleculeName>' has fewer than 4 distinct substituents. |
M9310 | empty-molecular-graph | error | Molecule entry '<moleculeName>' contains zero atoms. |
Generated from languages/smiles/src/errors.ts. All languages →
CLI Usage
bash
# Validate ring closures, atomic valences, and Hückel aromaticity
msx lint DrugLibrary.smi
# Parse SMILES or SDF molecular structure files
msx parse Aspirin.smi
