Skip to content

SMILES and structure descriptions

Molkit converts a SMILES string into a drawing and a drawing back into a SMILES string. For example, CC(=O)O imports as acetic acid. Molkit reads and writes SMILES with RDKit.js, a chemistry library it loads when the page opens. The results are canonical and include stereochemistry. If the library cannot load, for example when you are offline, a simpler reader is used; see When you are offline.

Insert > Insert by Name or SMILES… opens the window that turns a SMILES string, or a compound’s name, into a drawing, and Structure > Copy as SMILES copies the selection. Both are also in the command palette (Ctrl+K; search for “SMILES”, “name” or “PubChem”). To import a structure file, see Import MOL and SDF files. You can also paste a SMILES string or an InChI on the canvas with Ctrl+V, and Molkit draws it; see Pasting from other apps.

The window has one box. It takes a SMILES string or the name of a compound.

To insert from a SMILES string, for example benzoic acid:

  1. Select Insert > Insert by Name or SMILES….
  2. Type c1ccccc1C(=O)O in the box.
  3. Press Enter or click Insert. (Esc cancels.)

The structure is placed at the center of your view and stays selected, so you can move it. The whole insert is one undo step.

To insert by name:

  1. Type the name, for example acetone. A list of matching names that Molkit knows appears under the box; pick one with the arrow keys and Enter, or by clicking it.
  2. Or press Enter (or click Look up) to look up exactly what you typed.
  3. The box now holds the compound’s SMILES, and the line under it names what was found, with its formula, molar mass, and where it came from (built in, or a link to its PubChem page). A picture shows the structure as it will be drawn.
  4. Press Enter again, or click Insert.

A lookup never inserts by itself, so you always see the SMILES first, and you can edit it. If you change the SMILES, what was looked up no longer applies: the structure is inserted exactly as written, without the name.

Molkit looks a name up in this order:

  1. Its own built-in species and the names and abbreviations of the template library (DCM, EtOAc, ATP). These work offline.
  2. A formula, such as H2O, NO2, or CO, is found among the built-in species only. PubChem reads a formula as a name and gives an element (CO would be cobalt), so a formula Molkit does not know is never sent there; type its name or its SMILES instead.
  3. Otherwise, the name, or a CAS number such as 67-64-1, is looked up on PubChem.

If nothing is found, the line says so, keeps what you typed, and suggests similar names. While a PubChem lookup runs, Insert is unavailable; Esc stops the lookup, and a second Esc closes the window.

  • A formula typed as SMILES. CO is also a valid SMILES string (methanol). Typed and inserted, it is methanol; the line says that Look up reads it as a formula (carbon monoxide).
  • A brand name. Looked up on PubChem, a brand name shows the compound it stands for (“tylenol = acetaminophen on PubChem”).
  • The major resonance form. A charged species that PubChem (or another source) gives as a minor resonance form is drawn as its major form, and the line says so; the picture shows it. Edit the SMILES to insert it as written. A neutral species drawn with charges, such as carbon monoxide or ozone, is drawn as given.
  • Salts, hydrates, and metal compounds. A salt is drawn as separate ions, and a hydrate with its waters as separate molecules. PubChem stores metal compounds without their metal bonds (cisplatin, ferrocene), so the line warns that the drawing is not the textbook structure.
  • Large molecules. Over 60 atoms besides hydrogen, the line warns that the drawing will be large. Over 150 (a protein such as insulin), it asks first: the button reads Insert anyway.

The inserted structure keeps the name you chose. It is the structure’s name in Molkit Script, so the Layers panel and a recording use it: a recording writes draw acetone smiles: "CC(C)=O", which redraws the same structure offline.

Names you look up on PubChem are sent to pubchem.ncbi.nlm.nih.gov in the request; see PubChem names.

To draw a SMILES string or an InChI that you copied from another program, paste it on the canvas (Ctrl+V). The structure appears at the center of the view, and Ctrl+Z removes it. An InChI is looked up on PubChem; when PubChem cannot be reached or has no match, the InChI is pasted as text and a message says why.

A pasted string that does not look like SMILES, such as CO or Cl, stays text. To count as SMILES, the string has no spaces and has a ring digit, =, #, parentheses, or brackets, or is three or more atoms joined by hyphens. A formula such as H2O stays text, and so does a SMILES string pasted while the chemistry library is not loaded (in the first seconds after the page opens, or when you are offline). To insert such a string as a structure, use Insert > Insert by Name or SMILES….

An imported structure has a 2D layout based on the chemistry, Kekulé structures for aromatic rings, and solid and hashed wedges placed correctly on stereocenters. Copy as SMILES gives canonical SMILES.

An imported drawing also follows these conventions:

  • A double bond in a chain to an end atom is centered when the atom at its other end carries two other groups, as in a ketone’s C=O, so both lines meet the two bonds evenly. When that atom carries only one other group, as in an aldehyde’s C=O or the =CH2 of acrylic acid, the second line is offset to the inside of the bend. A double bond between two carbons that both carry groups is offset to one side: toward the groups when they are on the same side, and toward the larger group for a trans double bond, as in cinnamaldehyde, where the second line faces the ring. A double bond in a ring is offset toward the inside of the ring (IUPAC 2008, GR-1.10.2). A bond you make double by clicking it follows the same rules.
  • Oxygens double-bonded to chlorine, bromine, or iodine are drawn as you wrote them: OCl(=O)(=O)=O (perchloric acid) gives a neutral chlorine with three Cl=O bonds. A halogen whose charge the string writes, as in [I+], keeps that charge. Copy as SMILES writes the double bonds back, so a copied structure comes back as drawn.
  • The hydrogens written in a bracket on an element that Molkit does not fill in itself, such as [SiH], [SeH], [AlH], or [SnH], are kept on the atom, so triethylsilane draws as Et3SiH.
  • An isotope shows its mass number as a superscript before the symbol, as in 13C or 15NH2, and an isotopic carbon always shows its label. Deuterium and tritium are written D and T.
  • Hydrogens written as [H] are kept, and wedges and E/Z geometry are still drawn correctly.

Molkit loads its chemistry library, RDKit.js, from the internet when the page opens. If it cannot load (you are offline, or a network filter blocks it), Molkit still reads and writes SMILES, with these differences:

  • An imported structure has a simpler layout: rings are regular polygons and chains run at about 120°.
  • Copy as SMILES writes valid SMILES that is not canonical and has no stereochemistry: wedges and E/Z are left out.
  • Some strings are refused, for example a ring left open, an atom with more bonds than it can have, or an unbracketed metal. Write metals in brackets: [Na]OC(=O)C, not NaOC(=O)C.

Some hypervalent molecules, such as FCl(F)F (ClF3), O=[Cl]=O, and diborane, are always read the simpler way, online too.

Cinnamaldehyde drawn from the SMILES O=C/C=C/c1ccccc1: a benzene ring, a trans C=C double bond, and an aldehyde.
Cinnamaldehyde from its SMILES: the C=C drawn trans, as the two slashes write it.

Structure > 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. Hydrogens drawn as atoms are written the usual way, so a Lewis water copies as O, not [H]O[H]; isotope and stereo hydrogens are kept. With nothing selected, nothing is copied and a message asks you to select the atoms first.

Only bonds with both ends selected are included, so a partial selection exports a fragment.

Case Online Offline
Import, tetrahedral centers (@ and @@) Solid and hashed wedges placed correctly One bond on the stereocenter becomes a solid or hashed wedge to mark it; the direction is a guess, not a CIP-correct assignment
Import, double bonds (/ and \) Cis and trans geometry recognized Cis and trans recognized; an E or Z label is attached to the double bond, and the geometry stays as laid out. The label ranks the atoms bonded directly to each end; when two of them are the same element, no label is attached
Export Stereochemistry encoded in the string Wedges and E/Z ignored

Dot-separated SMILES ([Na+].[Cl-]) imports as separate fragments, and exporting a selection that spans several disconnected molecules gives a dot-separated string. Offline, separate fragments may be laid out on top of each other; drag them apart with the Select tool.

Structure > Copy Structure Description copies a short plain-text summary of the drawing, for pasting into an email, a document, or alt text. It describes the selected atoms, or the whole canvas when nothing is selected. After copying, Molkit shows “Structure description copied”.

For acetic acid drawn in bond-line form, alone on the canvas, the text is as follows. Only drawn atoms are counted, so the implicit hydrogens appear in the formula but not in the atom count.

1 molecule, 4 atoms, 3 bonds
Molecular formula: C2H4O2
SMILES: CC(=O)O
IUPAC name: acetic acid

The lines are:

  1. Counts of molecules, atoms, and bonds, with the prefix “Selected:” when you copy a selection.
  2. “Molecular formula:” and “SMILES:”.
  3. “IUPAC name:”, the systematic name from PubChem. This line is included only for a single molecule, and only after Molkit has fetched the name in the background, shortly after you stop editing. Copying does not wait for the lookup.

The formula and SMILES lines are left out, and a line explains why, in these cases: reaction arrows are on the canvas (whole-canvas copy only), there are more than 10 separate fragments, or the chemistry library has not loaded (for example, when you are offline). An empty canvas gives “No molecular structure on the canvas.”

Screen readers read the same text as the description of the canvas, and it updates as you draw.

For the stereodescriptors R, S, E, and Z drawn on the canvas, see Stereo labels.