Chemical Entities
Chemical Entities
Out[]=
A central feature of the Wolfram Language is that it’s got real-world data built right in. It’s got data on elements, isotopes and even molecules. It gets all of this from the Wolfram Knowledgebase, which is being updated all the time and is what powers WolframAlpha.
Creation
Creation
So how can you talk about a molecule in the Wolfram Language? The easiest way is by pressing + = .
Enter in plain English such as “water”:
As soon as you press or click away, the Wolfram Language will try to interpret what you typed. Assuming it succeeds, it’ll display a little yellow box representing a Wolfram Language . In this case, it’s the entity corresponding to water.
Press the check mark to confirm that’s what you want:
Values
Values
Now you can ask for lots of properties for this entity such as the molecule plot, which is rotatable.
Ask for the molecule plot property of water:
Out[]=
The result you get is something you can do computations with - such as image processing.
Color-negate the molecule plot of water:
ColorNegate
Out[]=
If all you want to do is visualize the molecule of water, you can just ask for it in English.
Out[]=
Use EntityValue to get the molecule plot of water:
EntityValue,"MoleculePlot"
Out[]=
Get molecule plots for a list of molecules:
EntityValue,,,"MoleculePlot"
Out[]=
,,
The Wolfram Language has deep knowledge about molecules, as about many other things.
Find out how many atoms there are in the list of molecules:
EntityValue,,,"AtomCount"
Out[]=
{,,}
Make a pie chart of the results:
PieChartEntityValue,,,"AtomCount"
Out[]=
Find the elements contained in sucrose:
Out[]=
,,
Find their known isotopes:
EntityValue["ElementTypes"],"KnownIsotopes"
Out[]=
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Sometimes you’ll want to talk about a class of entities such as strong acids.
Ask for strong acids and get the class of entities corresponding to strong acids.
You can get a list of all entities in a class using .
Get the list of strong acids:
Get the chemical formula for all of the strong acids:
Get the number of atoms in each of the strong acids and make a bar chart of them:
It’s very convenient to use plain English to describe things. A downside is that it can be ambiguous. If you say “mercury”, do you mean the planet Mercury or the element mercury or something else called “mercury”? When you use + =, it’ll make an initial choice. If you press the you can change to another choice. Press the check mark ✓ to accept a choice.
See the internal form of the entity representing uranium:
See the internal form of the entity representing water:
Properties
Properties
Possible properties for elements, isotopes and chemicals:
In practice, though, a good approach is to ask in plain English for a property of some entity, then to look at the interpretation that’s found, and re-use the property from it.
Ask for the atomic mass of tritium:
Re-use the “AtomicMass” property, applied to the aluminum:
Different types of entities have different properties. One common property for many types of entities is “Image”.
Get images of various entities: