8
$\begingroup$

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?

$\endgroup$
8
  • 5
    $\begingroup$ I’m voting to close this question because this is a bug report, not a question, and therefore off-topic. This site is not affiliated with Wolfram Research. Bug reports should be addressed to Wolfram Research directly. $\endgroup$
    – Szabolcs
    Nov 20, 2020 at 12:31
  • 3
    $\begingroup$ @Szabolcs but looks like more and more wolfram research developers and internal team members are now roaming around on this site. So this place has become a way to interact with developers, get interim solutions & workarounds, and insights into the decisions which led to those bugs while they are fixed in future versions. $\endgroup$
    – user13892
    Nov 20, 2020 at 12:47
  • 4
    $\begingroup$ @user13892 1. That still doesn't make a difference to the fact that this is not a discussion forum, but a QA site, and this is clearly not a question. Should one particular SE community try to turn it into a discussion site, SE Inc would step in and shut that down 2. There is no guarantee that any Wolfram develop will see it. OP is doing a disfavour to the community by not reporting the bug through official channels, and thus guaranteeing that it will be seen. $\endgroup$
    – Szabolcs
    Nov 20, 2020 at 12:49
  • 4
    $\begingroup$ @Szabolcs after having read the answer to this unasked question, would it make sense to edit the OPs submission so that it is better suited for a Q&A site? e.g. "What causes the erroneous behavior of Molecule in this instance?" $\endgroup$ Nov 20, 2020 at 13:00
  • 2
    $\begingroup$ @user13892 it isn't really that WRI developers visit this site and interact with the users here. There are some developers that do visit, but it's hit or miss. In this case you have a SE user that later became a WRI developer, who is still in the habit of regularly checking SE for interesting questions to answer. This question doesn't meet SE standards, the bug should be reported to WRI instead of here, nonetheless I couldn't resist answering a post titled "BUG in Molecule" $\endgroup$
    – Jason B.
    Nov 20, 2020 at 15:14

1 Answer 1

15
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.