SMILES Import & Export
Molkit converts structures to and from SMILES notation in both directions. Paste a string like c1ccccc1 or CC(=O)O and Molkit draws it with a 2D layout; select atoms on the canvas and copy them back out as a SMILES string. When RDKit.js is available, both directions use it and produce canonical, stereochemistry-aware results. Without it, a built-in fallback parser keeps the feature working with some limitations.
Where to find it
Both commands live in the Structure menu:
- Structure → Import SMILES… opens the import dialog.
- Structure → Copy as SMILES copies the current selection to the clipboard.
Both are also available from the command palette (Ctrl+K, search for “SMILES”).
Importing a SMILES string
- Open Structure → Import SMILES…
- Type or paste a SMILES string into the input field.
- Press
Enteror click Import. PressEscapeto cancel.
The structure is placed at the center of your current view and left selected, so you can move it immediately. The whole import is a single undo step.
If the string cannot be parsed, the dialog stays open and the input turns red with an “Invalid SMILES string” message. Fix the string and try again.
Note that pasting a SMILES string directly onto the canvas (Ctrl+V) creates a plain text annotation, not a structure; go through Structure → Import SMILES… to parse it.
RDKit.js and the fallback parser
Molkit loads RDKit.js from the unpkg CDN at startup, so it needs an internet connection the first time the page loads. If the library fails to load (offline use, blocked CDN), SMILES still works through a built-in fallback parser, but the results differ:
- With RDKit: import gets a chemistry-aware 2D layout, kekulized aromatic rings, and correct wedge/dash placement for stereocenters. Export produces canonical SMILES.
- Fallback: import uses a simpler geometric layout (regular polygons for rings, roughly 120-degree chains). Aromatic input written in lowercase, such as
c1ccccc1, comes in as a ring of single bonds drawn in the aromatic style rather than alternating double bonds. Export walks the structure directly and is valid SMILES but not canonical, and it does not encode stereochemistry.
One special case runs the fallback even when RDKit is loaded: strings with explicit [H] atoms. RDKit drops those hydrogens during conversion, so Molkit detects the loss and reparses with the fallback to keep them.
Exporting to SMILES
Copy as SMILES works on the current selection only. Select the atoms you want (or press Ctrl+A to select everything), then run the command. The status bar shows “SMILES copied!” for a moment. With nothing selected, the command does nothing.
Only bonds whose both endpoints are selected are included, so a partial selection exports a fragment.
Stereochemistry
- Import, tetrahedral centers (
@/@@): with RDKit, wedge and dash bonds are placed correctly. With the fallback, Molkit marks one bond on the stereocenter as a wedge or dash to flag it as a stereocenter, but the direction is a heuristic, not a CIP-correct assignment. - Import, double bonds (
/and\markers): both paths recognize cis/trans information. The fallback attaches anEorZlabel to the double bond rather than adjusting geometry. - Export: RDKit encodes stereochemistry in the output string. The fallback exporter ignores wedges and E/Z entirely.
Multiple molecules
Dot-separated SMILES ([Na+].[Cl-]) imports as separate fragments, and exporting a selection that spans several disconnected molecules produces a dot-separated string. With the fallback parser, separate fragments may be laid out on top of each other after import; drag them apart with the select tool.