wiki.crvscience.com • 1920 Articles
📡 Wiki RSS

Science Wiki

AI-assisted, human-supervised knowledge wiki spanning Earth & climate systems, genetics, molecular biophysics, vector entomology, and astrobiology.

← Wiki Index / Biochemistry & Biophysics / Simplified Molecular-Input Line-Entry System
🔬 Biochemistry & Biophysics

Simplified Molecular-Input Line-Entry System

The Simplified Molecular-Input Line-Entry System (SMILES) is a compact ASCII line notation that encodes two-dimensional chemical graphs and three-dimensional stereochemistry via depth-first spanning-tree traversal and numeric ring closures.

Simplified Molecular-Input Line-Entry System (SMILES) is a context-free ASCII line notation in chemoinformatics that represents the two-dimensional covalent connectivity and local three-dimensional stereochemistry of chemical species as compact, human-readable character strings. Unlike systematic International Union of Pure and Applied Chemistry (IUPAC) nomenclature or multi-kilobyte two-dimensional coordinate connection tables (.mol and .sdf files), a SMILES string encodes a molecule of 20 to 50 heavy atoms in 25 to 70 bytes—reducing storage requirements by 50- to 100-fold and enabling sub-millisecond parsing across repositories such as PubChem and ChEMBL and ultra-large virtual screening libraries.

SMILES was formulated between 1986 and 1988 by David Weininger at the U.S. Environmental Protection Agency (EPA) Environmental Research Laboratory in Duluth, Minnesota, and subsequently expanded with Arthur Weininger and Joseph L. Weininger at Daylight Chemical Information Systems. Designed to replace early punched-card line notations such as the Wiswesser Line Notation (1949) and the Dyson/IUPAC cipher, SMILES defines a small formal grammar of five syntactic primitives—atoms, bonds, parentheses for branches, numeric labels for ring closures, and periods for disconnected components—from which a molecular graph G = (V, E) can be reconstructed deterministically by a linear-time O(N) parser.

Formal Graph Grammar: Atoms, Bonds, Branches, and Ring Closures

Hydrogen-Suppressed Graph Construction and Atom Specification

To construct a SMILES string from a molecular structure, the molecule is first converted into a hydrogen-suppressed molecular graph by removing all normal-isotope hydrogen atoms (1H) attached to atoms in the organic subset—boron (B), carbon (C), nitrogen (N), oxygen (O), phosphorus (P), sulfur (S), fluorine (F), chlorine (Cl), bromine (Br), and iodine (I)—provided the heavy atom carries zero formal charge and satisfies its lowest normal valence state (B = 3; C = 4; N = 3, 5; O = 2; P = 3, 5; S = 2, 4, 6; halogens = 1). When a SMILES parser reads an unbracketed organic-subset symbol, it restores implicit hydrogens by subtracting the sum of explicit covalent bond orders from the lowest valid valence greater than or equal to that bond sum. For example, ` C denotes methane (CH4), CC denotes ethane (C2H6), C=O denotes formaldehyde (CH2O), and CCO ` denotes ethanol (C2H6O).

Any atom outside the organic subset, or any atom carrying a formal electric charge, a non-standard isotope mass, an explicit chiral parity token, or an unusual valence state, must be enclosed in square brackets ` [...] with its attached hydrogens and charge written explicitly. Inside brackets, syntax follows the order [isotope Symbol @chirality Hcount ±charge]: for example, heavy methane-13C is [13CH4] , the ammonium cation (NH4+) is [NH4+] , the iron(II) cation (Fe2+) is [Fe+2] or [Fe++] , and elemental sodium chloride (NaCl) is represented using the disconnection dot operator (.) as [Na+].[Cl-] `.

Spanning-Tree Traversal, Branches, and Ring-Closure Digits

Because a general molecular graph contains cycles (rings) and branches, converting it into a linear string requires two graph-theoretic operations:

  1. Cycle Breaking via Numeric Ring Closures: Every cyclic path in the graph is broken at one arbitrary bond per ring (matching the cyclomatic number or Frèrejacque number μ = |*E*| − |*V*| + |*C*|, where |*C*| is the number of connected components). The two atoms formerly joined by the broken bond are labeled with an identical digit from 1 to 9 (or a two-digit label preceded by a percent sign, %10 through %99, when more than nine rings are open simultaneously). Thus, cyclohexane (C6H12) becomes ` C1CCCCC1 , and decalin (bicyclo[4.4.0]decane, C10H18) becomes C1CCC2CCCCC2C1 `. A single atom may carry multiple ring-closure digits if it serves as a bridgehead or spiro center.
  2. Depth-First Spanning-Tree Traversal and Branching: Once all rings are opened into an acyclic spanning tree, a depth-first traversal starting at any vertex outputs atom and bond symbols sequentially along the main chain. Whenever the traversal encounters a branch point of degree ≥ 3, side chains are enclosed in parentheses ` (...) —which may be nested recursively—before continuing along the parent chain. For example, isobutane (2-methylpropane, C4H10) is written CC(C)C , and acetic acid (CH3COOH) is written CC(=O)O `.

Single (-) and aromatic (:) bond symbols are omitted by default between adjacent atoms, whereas double bonds (=), triple bonds (#), and quadruple bonds ($) are written explicitly (for example, hydrogen cyanide HCN is ` C#N and carbon dioxide CO2 is O=C=O ). Rings satisfying Hückel's (4*n* + 2) π-electron aromaticity criterion are denoted by writing their constituent sp2 ring atoms in lowercase (b, c, n, o, p, s): benzene (C6H6) is c1ccccc1 , pyridine (C5H5N) is n1ccccc1 , and pyrrole (C4H5N, where the ring nitrogen bears an explicit hydrogen to contribute its lone pair to the π sextet) is [nH]1cccc1 `.

Syntactic FeatureSMILES Token / SymbolChemical InterpretationRepresentative CompoundEncoded SMILES String
Organic Subset & Single BondsC, N, O, S, P, F, Cl, Br, IImplicitly hydrogenated neutral atomsEthanol (C2H6O)` CCO `
Multiple Covalent Bonds= (double), # (triple), $ (quadruple)Unsaturated π bonds along main or branch chainAcetonitrile (CH3CN)` CC#N `
Branching Parentheses(...) (nestable)Side-chain subtree off the preceding atomAcetone (C3H6O)` CC(=O)C `
Ring-Closure Digits & Aromaticity1–9, %10–%99; lowercase c, n, o, sCycle opening/closing; Hückel aromatic ringAspirin (C9H8O4)` CC(=O)Oc1ccccc1C(=O)O `
Disconnected Ions / Salts. (period separator)Non-covalently bonded ions or solvatesSodium acetate (CH3COONa)` CC(=O)[O-].[Na+] `
Tetrahedral Chirality@ (anticlockwise), @@ (clockwise)Local sp3 stereocenter parity along traversalL-Alanine ((2*S*)-alanine)` NC@@HC(=O)O `
Alkene Geometric Isomerism/ (up bond) and \ (down bond)Relative E (trans) or Z (cis) double-bond configuration(E)-But-2-ene (C4H8)` C/C=C/C `

Isomeric SMILES, Canonicalization, SMARTS, and Deep-Learning Extensions

Isomeric SMILES: Encoding Tetrahedral and Geometric Stereochemistry

Unlike Cahn–Ingold–Prelog (R/S and E/Z) stereodescriptors, which require evaluating global atomic-number priority trees across the whole molecule, Isomeric SMILES encodes stereochemistry via local graph-traversal geometry. At a tetrahedral sp3 stereocenter, looking down the bond from the preceding neighbor atom toward the chiral atom, the symbol @ indicates that the remaining three substituents—listed in the exact order they appear in the SMILES string—are arranged anticlockwise, whereas @@ indicates they are arranged clockwise. When an implicit hydrogen is one of the three substituents inside the chiral bracket (as in ` [C@H] or [C@@H] ), the hydrogen is treated as the first of the three remaining neighbors. Thus, natural L-alanine is NC@@HC(=O)O and D-alanine is NC@HC(=O)O . For disubstituted alkenes, directional single-bond slashes / and \ placed adjacent to each sp2 carbon define whether substituents lie on the same side (*Z* / *cis*, F/C=C\F ) or opposite sides (*E* / *trans*, F/C=C/F `) of the double bond plane.

Canonical SMILES vs. IUPAC InChI

Because a depth-first traversal can start at any atom and follow branches in any order, a single molecule of N atoms possesses dozens or hundreds of valid generic SMILES strings (for instance, ethanol is equally represented by ` CCO , OCC , and C(O)C `). In 1989, David, Arthur, and Joseph Weininger introduced the CANGEN algorithm to produce a unique Canonical SMILES string for any molecular graph:

  1. CANON Stage: Each atom is assigned an initial tuple of six graph invariants (number of connections, number of non-hydrogen bonds, atomic number, sign of charge, absolute charge, and number of attached hydrogens). Inspired by H. L. Morgan's 1965 extended-connectivity algorithm, these invariants are iteratively replaced by the sorted product of neighboring primes until symmetry classes stabilize, assigning every atom a canonical rank.
  2. GENES Stage: The molecular graph is traversed starting at the lowest-ranked atom and prioritizing lowest-ranked neighbors at every branch and ring closure.

Because different software toolkits (Daylight, RDKit, OpenEye OEChem, and Open Babel) implement slightly different aromaticity perception rules (kekulization vs. Hückel rules for tautomeric heterocycles) and tie-breaking invariants, Canonical SMILES is unique within a single toolkit version, whereas cross-platform deduplication utilizes the IUPAC International Chemical Identifier (InChI).

SMARTS Substructure Queries and Generative Grammar Alternatives (SELFIES)

Weininger extended SMILES into two related formal languages: SMARTS (SMILES Arbitrary Target Specification) for subgraph isomorphism queries (allowing atomic wildcards such as [#6] for any carbon, [R] for ring atoms, and logical combinations to define molecular fingerprints and PAINS filters), and SMIRKS for encoding atom-mapped chemical reaction transforms. In generative artificial intelligence and de novo drug design, autoregressive recurrent neural networks and transformers trained directly on SMILES frequently output syntactically invalid strings due to unmatched parentheses or unclosed ring digits; to overcome this limitation, DeepSMILES (Noel O'Boyle and Andrew Dalke, 2018) and SELFIES (Mario Krenn et al., 2020) reformulate branch lengths and ring closures so that every generated token sequence decodes to a valid valence graph.

Frequently Asked Questions

Why can two different chemoinformatics programs generate different "Canonical SMILES" for the same molecule?

Generating a Canonical SMILES requires two independent steps: perceiving aromaticity (converting Kekulé alternating single and double bonds into lowercase aromatic atoms) and computing canonical atom ranks to order the depth-first traversal. Different toolkits—such as RDKit, Open Babel, CDK, and OpenEye—apply distinct aromaticity models (strict Hückel 4*n* + 2 rules on individual rings versus fused-ring electronic systems) and distinct symmetry tie-breaking heuristics. Consequently, a Canonical SMILES string is guaranteed to be identical only when generated by the same software toolkit and version; for universal cross-database indexing, chemists use the IUPAC International Chemical Identifier (InChI and InChIKey).

How do @ and @@ in Isomeric SMILES differ from Cahn–Ingold–Prelog (R)/(S) stereochemical labels?

Cahn–Ingold–Prelog (R) and (S) descriptors are global properties: assigning (R) or (S) requires ranking the four substituents around a chiral center by atomic number outward through the entire covalent graph, meaning a remote isotopic or functional modification five bonds away can flip a stereocenter from (R) to (S) without altering its 3D geometry. In contrast, SMILES @ (anticlockwise) and @@ (clockwise) are local topological tokens defined strictly by the order in which the four neighbor atoms are visited in that specific SMILES string; if the string traversal order changes, the canonicalizer automatically inverts @ to @@ to preserve the identical 3D configuration.

Why did generative deep-learning models motivate the invention of DeepSMILES and SELFIES?

In standard SMILES, branches require matched opening and closing parentheses ` (...) and rings require matched pairs of numeric closure symbols (1...1`), which may be separated by dozens of characters. When variational autoencoders (VAEs), recurrent neural networks, or transformers sample character tokens probabilistically to design novel molecules in chemical space, a single mismatched parenthesis, unclosed ring digit, or pentavalent carbon causes the string to fail parsing. SELFIES (Self-Referencing Embedded Strings) enforces valence constraints and encodes branch/ring lengths as relative state tokens, ensuring 100% syntactic and semantic validity for any random string.

References

  1. Weininger, D. (1988). SMILES, a chemical language and information system. 1. Introduction to methodology and encoding rules. Journal of Chemical Information and Computer Sciences, 28(1), 31–36. https://doi.org/10.1021/ci00057a005
  2. Weininger, D., Weininger, A., & Weininger, J. L. (1989). SMILES. 2. Algorithm for generation of unique SMILES notation. Journal of Chemical Information and Computer Sciences, 29(2), 97–101. https://doi.org/10.1021/ci00062a008
  3. O'Boyle, N. M. (2012). Towards a Universal SMILES representation—A standard method to generate canonical SMILES based on the InChI. Journal of Cheminformatics, 4(1), 22. https://doi.org/10.1186/1758-2946-4-22
  4. Krenn, M., Häse, F., Nigam, A., Friederich, P., & Aspuru-Guzik, A. (2020). Self-referencing embedded strings (SELFIES): A 100% robust molecular string representation. Machine Learning: Science and Technology, 1(4), 045024. https://doi.org/10.1088/2632-2153/aba947
🧬 Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
💡 Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision