TECHNOLOGY

Canonical SMILES order is not a molecule atom-annotation index map

In this article
THE QUICK TAKE

RDKit MolToSmiles exposes canonical writing and other traversal controls. The inspected writing implementation maintains traversal-to-source atom associations while producing text; the generated traversal is not a blanket instruction to reinterpret existing annotation arrays in that order. Canonical ranking, atom index and serialized position have different roles, especially with branches, fragments and symmetric atoms. A canonical text representation can preserve molecular structure while s.

A canonical SMILES string gives a reproducible textual traversal under a selected writing policy, not a universal atom-annotation index map. Re-reading that string can produce an atom order different from the original molecule’s order. A molecular AI exporter that carries per-atom labels forward by position can silently attach valid labels to the wrong atoms.

The scientific interface

RDKit MolToSmiles exposes canonical writing and other traversal controls. The inspected writing implementation maintains traversal-to-source atom associations while producing text; the generated traversal is not a blanket instruction to reinterpret existing annotation arrays in that order. Canonical ranking, atom index and serialized position have different roles, especially with branches, fragments and symmetric atoms. A canonical text representation can preserve molecular structure while still requiring an explicit mapping for external atom-specific data. Structure equivalence does not automatically provide a unique semantic identity for every equivalent atom.

Implementation details

Keep source atom identities and external annotations together before serialization. Choose a reviewed mapping mechanism, such as explicitly preserved atom-map information or a validated correspondence appropriate to the task, and record its scope. Do not infer the mapping from canonical string character positions or from the mere equality of molecular atom counts. If symmetry leaves an association unresolved, preserve that uncertainty or use a scientifically justified invariant target. Version writing options and any implementation-dependent traversal metadata instead of treating a private property as an eternal cross-version contract.

A constructed validation case

Construct a molecule with distinguishable atom-specific fixture labels and a source ordering that differs from the selected canonical traversal. Serialize, reload and validate label correspondence using the declared mapping. Add position-only transfer as a negative control and a symmetric case with an explicit ambiguity policy. Acceptance requires preserved atom-label meaning, not just successful SMILES parsing or equality of a canonical structure string. Keep original and reloaded graphs plus mapping evidence so future writer changes can be tested without assigning labels by whichever order happens to appear first.

Numerical and data limits

A correct mapping does not establish that the atom labels are scientifically accurate. It establishes where they belong. Keep graph equivalence and annotation correspondence separate so molecular AI quality is evaluated against the intended targets rather than a permutation introduced during a convenient canonical export.

Primary references

RDKit Chem rdmolfiles API; RDKit SMILES writing and atom traversal implementation.

This is a proposed scientific-interface validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the accuracy or performance of a scientific model.

ChemBERTa masked SMILES predictions still need molecular parsing; SPICE: atomic numbers alone do not identify a charged molecular state.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles