COSMolKit Tools
Loading browser workspace
Back to tools
COSMolKit 0.2.12 / Rust / WASMSMILES canonicalizer
Normalize SMILES serialization and inspect stereochemistry, aromatic bond form, hydrogens, and charge.
Normalized outputs
3 graph atoms / 6 total hydrogensCanonical SMILES
CCOIsomeric SMILES
CCOKekulized SMILES
CCOH COUNT6
FORMAL CHARGE0
Convert equivalent SMILES to a consistent representation
COSMolKit parses the molecular graph and writes canonical SMILES, stereochemistry-aware isomeric SMILES, and an explicit kekulized aromatic representation. Hydrogen count and total formal charge are derived from the same graph locally in WebAssembly.
PYTHON BACKEND
COSMolKit Python 0.2.12Canonicalize SMILES in Python
Use the COSMolKit Python bindings to generate the same canonical, isomeric, and kekulized outputs.
canonicalize_smiles.py
from cosmolkit import Molecule
mol = Molecule.from_smiles("OCC")
result = {
"canonical_smiles": mol.to_smiles(
isomeric_smiles=False, canonical=True
),
"isomeric_smiles": mol.to_smiles(
isomeric_smiles=True, canonical=True
),
"kekulized_smiles": mol.to_smiles(canonical=True, kekule=True),
"hydrogen_count": sum(
a.atomic_num() == 1 for a in mol.with_hydrogens().atoms()
),
"formal_charge": sum(a.formal_charge() for a in mol.atoms()),
}
print(result)COSMolKit Tools
Loading browser workspace