Wolfram Research

Function Repository Resource:

NameToSMILES

Source Notebook

Convert a chemical name into a SMILES identifier string

Contributed by: Wolfram Chemistry Team

ResourceFunction["NameToSMILES"]["name"]

returns a SMILES string corresponding to the given chemical name.

Details and Options

NameToSMILES uses the Open Parser for Systematic IUPAC Nomenclature to create a chemical graph from a given name, which is then converted to a SMILES string.
The input for NameToSMILES must be a string. The return value will be a SMILES string or Failure object.
NameToSMILES has the following options:
"AllowRadicals" True whether to return a SMILES string for fragments
"AddDummyAtoms" False whether to add wildcard atoms to fragments
"Canonicalize" True whether to canonicalize the SMILES string
"FailOnBadStereochemistry" True whether to return a Failure for inputs with bad stereochemistry

Examples

Basic Examples

Find the SMILES string from a chemical name:

In[1]:=
ResourceFunction[
 "NameToSMILES"]["2-amino-14,16-dimethyloctadecan-3-ol"]
Out[1]=

Use a chemical name with defined stereochemistry:

In[2]:=
ResourceFunction[
 "NameToSMILES"]["(2R,3S,4S,5R)-3-(dimethylamino)-2,4,5-\
trihydroxyhexanal"]
Out[2]=

Scope

When given an invalid chemical name, NameToSMILES will return a Failure identifying the uninterpretable portion of the name:

In[3]:=
ResourceFunction[
 "NameToSMILES"]["3,6-Dideoxy-3-(dimethylamina)-D-glucose"]
Out[3]=

Fixing the typographical error allows the name to be parsed:

In[4]:=
ResourceFunction[
 "NameToSMILES"]["3,6-Dideoxy-3-(dimethylamino)-D-glucose"]
Out[4]=

Options

By default, NameToSMILES will parse fragment names such as “oxo” and “keto” as radicals with unpaired electrons. Use the option "AllowRadicals" to disable this behavior:

In[5]:=
ResourceFunction["NameToSMILES"]["carboxyl", "AllowRadicals" -> #] & /@ {True, False}
Out[5]=

When parsing a chemical substituent, it is possible to add dummy atoms at the relevant attachment points:

In[6]:=
ResourceFunction["NameToSMILES"]["carboxyl", "AddDummyAtoms" -> #] & /@ {True, False}
Out[6]=

Requirements

Wolfram Language 12.0 (April 2019) or above

Resource History

Source Metadata

License Information