mfsig.com
smilescanonicalisationrdkitdata-preparation4 min read

Canonical SMILES before a DFT calculation, and why it matters

Canonicalise every SMILES with one named toolkit before computing a σ-profile. It removes duplicates and keeps identity records comparable.

Updated November 28, 2026

A canonical SMILES is a single, toolkit-defined string for one molecule. Canonicalising before a DFT calculation removes duplicate entries, gives every record one stable identifier and makes sure that two orders for the same compound start from the same atom order. It takes one line of RDKit and should be the first step of any σ-profile workflow.

One molecule, many SMILES

SMILES was designed so that a chemist can write a molecule in whatever order feels natural. Ethanol can be written CCO, OCC or C(O)C. Benzene can be c1ccccc1 or C1=CC=CC=C1. All of these are correct. A parser builds the same graph from each. The strings are different, though, and a database or a spreadsheet does not know that.

Canonicalisation fixes this. The toolkit walks the graph with a deterministic ranking of atoms and writes one string. RDKit produces CCO for all three ethanol inputs. For caffeine the Kekulé form and the aromatic form give the same canonical result.

Two things to remember. The canonical string is defined by the toolkit, not by the SMILES language. RDKit, Open Babel and commercial toolkits each have their own canonical form, and the forms are not interchangeable. And a canonical SMILES is only as good as the parse that precedes it. A string with a broken ring closure or a valence error does not canonicalise, it fails, and the failure is useful.

Why this matters before a quantum calculation

Three reasons, in order of how much money they save.

First, deduplication. A screening list assembled from several sources will contain the same solvent written several ways. Canonicalising and then dropping duplicates means each molecule is computed once. The batch ordering guide explains how to build the manifest that tracks this.

Second, identity. MFsig records the SMILES exactly as written in the identity block of the .mfsig file, with the number of unassigned stereocentres and the fragments it dropped. If what you submit is already canonical, then the identifier in your database and the identifier in the file are the same string. No mapping table is needed later.

Third, geometry. MFsig builds one 3D conformer with RDKit ETKDG embedding, seed 42, then MMFF94s. A fixed seed makes the embedding deterministic for a given input, but the input includes the atom order, and two SMILES for the same molecule give different atom orders. The result can be two different low-energy conformers for what is chemically one molecule, and therefore two slightly different sigma profiles. The conformer dependence guide covers the size of such effects. Canonicalising first does not remove conformer dependence, but it makes it reproducible, since the same molecule always enters through the same string.

What canonicalisation does not do

It does not neutralise charges, pick a tautomer or strip counter-ions. A carboxylate stays a carboxylate. A sodium salt stays two fragments. 2-hydroxypyridine and 2-pyridone are different graphs and canonicalise to different strings. These are chemistry decisions, and the protonation guide and the salts guide treat them separately. Make them before canonicalising, so that the canonical string describes the species you actually want computed.

It also does not assign stereochemistry. A SMILES without @ marks stays without them. RDKit can report how many centres are unassigned, and MFsig counts them in the identity block as well.

A worked example in RDKit

from rdkit import Chem

inputs = ["CCO", "OCC", "C(O)C", "c1ccccc1", "C1=CC=CC=C1",
          "CC(=O)O", "CC(=O)[O-].[Na+]"]

seen = {}
for s in inputs:
    mol = Chem.MolFromSmiles(s)
    if mol is None:
        print(f"{s!r}: failed to parse")
        continue
    can = Chem.MolToSmiles(mol, isomericSmiles=True)
    seen.setdefault(can, []).append(s)

for can, forms in seen.items():
    print(can, "<-", forms)

Expected outcome. Ethanol collapses to one key, benzene to one key, acetic acid and sodium acetate stay separate because they are different species. The isomericSmiles flag keeps stereo and isotope marks. Switch it off only if you deliberately want to merge enantiomers, and then say so in your record.

Record the RDKit version alongside the canonical strings. The attribute rdkit.__version__ gives it. A canonical form can change between releases when the ranking algorithm is revised, and a reproducibility audit will ask.

A short checklist for the preparation step

  1. Decide protonation state, tautomer and salt form as chemistry, before touching the string.
  2. Parse every SMILES and keep the parse failures in a separate list to review.
  3. Canonicalise with one toolkit, isomeric form on, and record the toolkit and version.
  4. Deduplicate on the canonical string, keeping a map from your original identifiers.
  5. Submit the canonical string, so that the identity block of the returned file matches your key.
Canonicalisation is not a chemistry decision. It is the bookkeeping that makes your chemistry decisions visible.

Key points

  • A canonical SMILES is one string per molecule per toolkit, and toolkits differ, so name the toolkit and its version.
  • Canonicalise before submission so that your identifier and the SMILES as written in the .mfsig identity block are the same string.
  • With a fixed-seed conformer generator, the atom order affects the starting geometry, so a canonical input gives reproducible conformers.
  • Canonicalisation does not change protonation, tautomer, salt form or stereochemistry. Decide those first.
  • Deduplicate on the canonical string so that each molecule is computed and paid for once.

Questions people ask

Does canonical SMILES change the σ-profile?
Not the molecule, but possibly the starting geometry. A conformer generator with a fixed seed is deterministic for a given input string, and two strings for the same molecule order the atoms differently. Canonicalising first gives every run the same starting point.
Which canonical SMILES should I use, RDKit or another toolkit?
Any one toolkit, used consistently and recorded with its version. Canonical forms differ between toolkits, so a string canonicalised by RDKit will not always match one produced by another program. Pick one and write it in your method record.
Does MFsig canonicalise my SMILES for me?
MFsig records the SMILES exactly as written in the identity block of the .mfsig file. Canonicalisation, if you want it, happens on your side before you submit. That keeps your identifier and the recorded identifier identical.

Further reading

In practice: A .mfsig file is JSON and reads with the standard library. Ordering is done on the site or through the API described in the docs, and AI agents can read the published samples through the MCP server at /mcp.

Generate a σ-profile from your SMILES

Free converter for a profile you already have, a reference-grade DFT run with its provenance record when it has to be defensible.