When I type an incorrect SMILES into the Molecule function, the output a large, unrelated molecule.
What is Molecule
doing here, and is it possible for the command to return an error when passed an invalid SMILES string?
When I type an incorrect SMILES into the Molecule function, the output a large, unrelated molecule.
What is Molecule
doing here, and is it possible for the command to return an error when passed an invalid SMILES string?
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.
Molecule
in this instance?" $\endgroup$