COSMolKit Tools
Loading browser workspace
PDB to SMILES converter
Convert PDB to SMILES locally in your browser with COSMolKit, Rust, and WebAssembly.
Source
263 charactersConverted output
1 atoms / 0 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 = "HETATM 1 O HOH A 1 0.000 0.000 0.000 1.00 20.00 O\nHETATM 2 H1 HOH A 1 0.957 0.000 0.000 1.00 20.00 H\nHETATM 3 H2 HOH A 1 -0.240 0.927 0.000 1.00 20.00 H\nCONECT 1 2 3\nEND\n"
mol = Molecule.from_pdb_block(source)
output = mol.to_smiles()
Path("molecule.smi").write_text(output, encoding="utf-8")COSMolKit Tools
Loading browser workspace