Wolfram Research

Function Repository Resource:

ChemicalNameToSMILES (1.0.0) current version: 1.0.1 »

Source Notebook

Convert a chemical name into a SMILES identifier string

Contributed by: Wolfram Chemistry Team

ResourceFunction["ChemicalNameToSMILES"]["name"]

returns a SMILES string corresponding to the given chemical name.

Details and Options

ResourceFunction["ChemicalNameToSMILES"] 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 ResourceFunction["ChemicalNameToSMILES"] must be a string. The return value will be a SMILES string or Failure object.
ResourceFunction["ChemicalNameToSMILES"] has the following options:
"AllowRadicals"Truewhether to return a SMILES string for fragments
"AddDummyAtoms"Falsewhether to add wildcard atoms to fragments
"Canonicalize"Truewhether to canonicalize the SMILES string
"FailOnBadStereochemistry"Truewhether to return a Failure for inputs with bad stereochemistry

Examples

Basic Examples (2) 

Find the SMILES string from a chemical name:

In[1]:=
ResourceFunction["ChemicalNameToSMILES", ResourceVersion->"1.0.0"]["2-amino-14,16-dimethyloctadecan-3-ol"]
Out[1]=

Use a chemical name with defined stereochemistry:

In[2]:=
ResourceFunction["ChemicalNameToSMILES", ResourceVersion->"1.0.0"]["(2R,3S,4S,5R)-3-(dimethylamino)-2,4,5-trihydroxyhexanal"]
Out[2]=

Scope (2) 

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

In[3]:=
ResourceFunction["ChemicalNameToSMILES", ResourceVersion->"1.0.0"]["3,6-Dideoxy-3-(dimethylamina)-D-glucose"]
Out[3]=

Fixing the typographical error allows the name to be parsed:

In[4]:=
ResourceFunction["ChemicalNameToSMILES", ResourceVersion->"1.0.0"]["3,6-Dideoxy-3-(dimethylamino)-D-glucose"]
Out[4]=

Options (2) 

By default, ChemicalNameToSMILES 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["ChemicalNameToSMILES"]["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["ChemicalNameToSMILES"]["carboxyl", "AddDummyAtoms" -> #] & /@ {True, False}
Out[6]=

Version History

  • 1.0.1 – 17 March 2023
  • 1.0.0 – 27 September 2019

Source Metadata

Related Resources

License Information