Skip to main content

Infinite molecules

2 symbols · #0 of 240

Exact: each molecule appears once

Loading RDKit…

Numbering chemical space

SELFIES write a molecule as a string of symbols such as [C], [=O], [Branch1] or [Ring1], and the grammar is built so that any string decodes to a valid molecule. So with an alphabet of N symbols, every number names a molecule: write it in base N and read off the symbols. The strings are shuffled with an invertible permutation (the same trick as everyuuid.com), so neighbours look unrelated and any molecule's address can be worked out backwards.

The catch is that most strings are the same molecule written differently, or have symbols that do nothing. With all 69 symbols, about 95% of 3-symbol strings are repeats. So the page only shows a string if it is the one SELFIES that RDKit's canonical SMILES encodes to, which makes every molecule appear exactly once without ever listing them all.

That gets sparse quickly (around 1 string in 1,000 at 6 symbols), so past the cap the page stops checking and grows each molecule from its address instead: one atom, ring or branch at a time, keeping only steps that change the molecule. Those can be as long as you like. Repeats are possible in principle; I haven't seen one.