COSMolKit Tools
Loading browser workspace
SDF to SMILES converter
Convert SDF to SMILES locally in your browser with COSMolKit, Rust, and WebAssembly.
Source
315 charactersConverted output
3 atoms / 2 bondsFormats available in this converter
COSMolKit reads and writes the molecular graph locally. Coordinate-dependent exports use the coordinates available in the source or generated by the selected workflow.
Input formats
SMILES; MOL or SDF V2000/V3000; Tripos MOL2; PDB; PDBx/mmCIF; XYZ.
Output formats
SMILES; MOL V2000/V3000; SDF V2000/V3000; PDB; SVG depiction.
Common molecular file conversions
Convert files to SMILES: SDF to SMILES, MOL to SMILES, MOL2 to SMILES, PDB to SMILES, mmCIF to SMILES, and XYZ to SMILES.
Export from SMILES: SMILES to SDF V2000/V3000, SMILES to MOL V2000/V3000, SMILES to PDB, and SMILES to SVG.
Convert molecular structure files: MOL2 to SDF, MOL2 to PDB, SDF to MOL, SDF to PDB, PDB to SDF, mmCIF to PDB, and XYZ to SDF.
Create a 2D structure image: Render SMILES, MOL, SDF, MOL2, PDB, mmCIF, or XYZ input as a scalable SVG molecular depiction.
Run the same conversion with COSMolKit
The example tracks the formats and source currently selected above.
pip install cosmolkit==0.3.0Python 3.9+ / Rust-native wheel
from pathlib import Path
from cosmolkit import Molecule
source = "\n COSMolKit 2D\n\n 3 2 0 0 0 0 0 0 0 0999 V2000\n -1.2990 -0.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.2990 -0.2500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0\n 2 3 1 0\nM END\n\n$$$$\n"
mol = Molecule.read_mol_from_str(source)
output = mol.to_smiles()
Path("molecule.smi").write_text(output, encoding="utf-8")COSMolKit Tools
Loading browser workspace