TransWikia.com

Why does `Molecule` return a molecule for an incorrect SMILES string?

Mathematica Asked by LJFan on April 11, 2021

When I type an incorrect SMILES into the Molecule function, the output a large, unrelated molecule.

Molecule bug

What is Molecule doing here, and is it possible for the command to return an error when passed an invalid SMILES string?

One Answer

This is a bug, the most basic manifestation of which is

In[7]:= CanonicalName@Interpreter["Chemical"]["[C1]CC1"]

Out[7]= "UDPNAcetylmuramoylLAlanylDGlutamylLLysylDAlanylDAlanine"

The fact that "[C1]CC1" parses to this gigantic molecule is also a bug, which I have filed internally.

In version 12.1 when Molecule is given a string argument which doesn't parse locally (via SMILES, InChI, or systematic chemical name), it will call Interpreter. This was after a suggestion that things like Molecule["H2SO4"] should just work.

To disable this behavior set the following internal variable:

In[5]:= Chemistry`Private`$UseInterpreter = False;

In[6]:= Molecule["[C1]CC1"]

During evaluation of In[6]:= Molecule::nintrp: Unable to interpret [C1]CC1 as a name or chemical identifier.

Out[6]= Molecule["[C1]CC1"]

In future releases, Molecule will not call Interpreter automatically.

Correct answer by Jason B. on April 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP