9
$\begingroup$

I'm using the next Mathematica command in order to plot molecules:

ChemicalData["name", "MoleculePlot"]

But I'm not sure if the Mathematica database of molecules is complete.

I'm trying to plot lactic acid.

The problem is that it doesn't seem to exist a name of the molecule that makes the command work

ChemicalData["Lactic acid", "MoleculePlot"]

or

ChemicalData["2-Hydroxypropanoic acid", "MoleculePlot"]

So, I want to know if anyone has any suggestions about what to do in these cases.

$\endgroup$
  • $\begingroup$ No database of molecules is complete. $\endgroup$ – user28174 Dec 9 '18 at 9:14
  • 2
    $\begingroup$ Yes .. But that one is an important molecule $\endgroup$ – DieDauphin Dec 9 '18 at 19:38
16
$\begingroup$

I've struggled with How Mathematica expects the end-user to interact with knowledge databases for quite some time. While this solution is likely not universal, it has been reasonably successful for many of my searches.

Using CTRL= to perform a free-form Wolfram Language input followed by using CanonicalName typically provides the appropriate string to conduct additional property searches:

enter image description here

Jason B. notes in the comments that one can obtain the same information programmatically through Interpreter["Chemical"]["lactic acid"]. I've included it in the answer in case the comments get removed in the future.

$\endgroup$
  • 4
    $\begingroup$ For a programmatic way to get the entity, you can use Interpreter["Chemical"]["lactic acid"]. $\endgroup$ – Jason B. Dec 8 '18 at 16:48
  • 4
    $\begingroup$ Thankfully, one is not forced to refer to citric acid as LemonAcid. $\endgroup$ – David Richerby Dec 8 '18 at 22:24
  • $\begingroup$ @DavidRicherby Seriously! $\endgroup$ – bobthechemist Dec 8 '18 at 22:53
  • $\begingroup$ Actually, in Swedish, lactic acid is called mjölksyra (milk acid). $\endgroup$ – Andreas Rejbrand Dec 8 '18 at 23:33
  • 1
    $\begingroup$ @JackLaVigne I use LiceCAP on Windows. I have not tried to do screen capture on Linux devices, although a google ssearch reveals a couple of free options. No clue about MacOS. $\endgroup$ – bobthechemist Dec 18 '18 at 13:22
5
$\begingroup$
ChemicalData[Entity["Chemical", "MilkAcid"], "MoleculePlot"]

or

Entity["Chemical", "MilkAcid"];

ChemicalData[%,"MolecularPlot"]

lactic acid

$\endgroup$
  • 1
    $\begingroup$ But if you already know the correct name (in this case, "MilkAcid"), why not instead just use ChemicalData["MilkAcid", "MoleculePlot"]? $\endgroup$ – theorist Dec 19 '18 at 22:46
3
$\begingroup$

What has been missed in previous answers is that one should have tried entering the name of the chemical under consideration in camel case:

ChemicalData["LacticAcid"]
   {Entity["Chemical", "MilkAcid"], Entity["Chemical", "LPlusLacticAcid"], 
    Entity["Chemical", "DLLacticAcid"], Entity["Chemical", "PolyDLLactide"],
    Entity["Chemical", "PolyLLactide"]}

which returns a bunch of matches. Note that the first entry corresponds to the "milk acid" entity featured in bob's answer. The next two entries correspond to the natural enantiomer of lactic acid and the racemic form, which may also be of interest.

Similarly, evaluating ChemicalData["LacticAcid", "MoleculePlot"] will show the expected plots, at least for the first three entries:

ChemicalData["LacticAcid", "MoleculePlot"] // GraphicsRow

lactic acid molecules

The OP almost got it by trying out the IUPAC name, what was not done was to write the name in the expected camel case:

ChemicalData["2HydroxypropanoicAcid"]
   {Entity["Chemical", "MilkAcid"], Entity["Chemical", "DLLacticAcid"],
    Entity["Chemical", "PolyDLLactide"]}
$\endgroup$
  • $\begingroup$ As an instructor, I wonder if Mathematica 'students' would benefit from documentation that describes the use of camel case or if this is a situation where one has to simply learn it on her/his own. $\endgroup$ – bobthechemist Mar 17 at 12:25
  • $\begingroup$ @bob, I personally think the docs could stand to be more explicit; unless you're already "used to" how Mathematica does things, you wouldn't readily think about trying camel case. $\endgroup$ – J. M. will be back soon Mar 17 at 12:27

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