COSMolKit Tools
Loading browser workspace
SMILES to SDF converter
Convert SMILES to SDF locally in your browser with COSMolKit, Rust, and WebAssembly.
Source
21 charactersConverted output
13 atoms / 13 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 = "CC(=O)Oc1ccccc1C(=O)O"
mol = Molecule.from_smiles(source)
try:
mol_2d = mol.with_2d_coordinates()
except (ValueError, NotImplementedError):
mol_2d = Molecule.from_smiles(mol.to_smiles()).with_2d_coordinates()
output = mol_2d.to_2d_sdf_string(format="v2000")
Path("molecule.sdf").write_text(output, encoding="utf-8")COSMolKit Tools
Loading browser workspace