void OECreateCanSmiString(std::string &str, const OEMolBase &mol)

Creates a canonical SMILES string representing a given molecule, but without isotopic labeling or stereochemistry. This function is just a special case of the OECreateSmiString function, called with the flavor OESMILESFlag.DEFAULT.


This function produces what Daylight Chemical Information Systems term a unique SMILES.

Note that the canonical SMILES generated by this function remains dependent on the state of the molecule, especially its aromaticity state (see examples in Aromaticity Models in OEChem TK section). Thus, to generate a canonical smiles suitable for purposes such as a database key, the user must assure that the state of the molecule has been standardized. In particular, aromaticity should be perceived according to the preferred model.

In contrast, the high-level output function OEWriteMolecule, when writing the canonical SMILES format (OEFormat.CAN) does invoke OEFindRingAtomsAndBonds and OEAssignAromaticFlags.

See also


The OECreateCanSmiString is rigorously tested to ensure that it generates unique string representations of molecules. This test involves randomly reordering the atoms and bonds of molecules and confirming that this has no effect on the SMILES generated by the OECreateCanSmiString function.

Performance of OECreateCanSmiString to generate canonical SMILES
Database Size Success Rate
Wombat 53K 100.0 %
Maybridge 64K 100.0 %
MDDR 111K 100.0 %
NCI 250K 100.0 %

Running the validation test on 19M unique molecules produces only in 57 failures.