When I type an incorrect SMILES into the Molecule function, the output a large, unrelated molecule.
Molecule doing here, and is it possible for the command to return an error when passed an invalid SMILES string?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community
This is a bug, the most basic manifestation of which is
In:= CanonicalName@Interpreter["Chemical"]["[C1]CC1"] Out= "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:= Chemistry`Private`$UseInterpreter = False; In:= Molecule["[C1]CC1"] During evaluation of In:= Molecule::nintrp: Unable to interpret [C1]CC1 as a name or chemical identifier. Out= Molecule["[C1]CC1"]
In future releases,
Molecule will not call