New in 13.1: Chemical Representations and Pattern Reactions
Last year we released Version 13.0 of the Wolfram Language. Here are the updates in chemical representations and symbolic pattern reactions since then, including the latest features in 13.1.
Representing Amounts of Chemicals
Molecule lets one symbolically represent a molecule. Quantity lets one symbolically represent a quantity with units. In Version 13.1 we now have the new construct ChemicalInstance that’s in effect a merger of these, allowing one to represent a certain quantity of a certain chemical.
This gives a symbolic representation of 1 liter of acetone (by default at standard temperature and pressure):
✕
|
We can ask what the mass of this instance of this chemical is:
✕
|
ChemicalConvert lets us do a conversion returning particular units:
✕
|
Here’s instead a conversion to moles:
✕
|
This directly gives the amount of substance that 1 liter of acetone corresponds to:
✕
|
This generates a sequence of straight-chain hydrocarbons:
✕
|
Here’s the amount of substance corresponding to 1 g of each of these chemicals:
✕
|
ChemicalInstance lets you specify not just the amount of a substance, but also its state, in particular temperature and pressure. Here we’re converting 1 kg of water at 4° C to be represented in terms of volume:
✕
|
Chemistry as Rule Application: Symbolic Pattern Reactions
At the core of the Wolfram Language is the abstract idea of applying transformations to symbolic expressions. And at some level one can view chemistry and chemical reactions as a physical instantiation of this idea, where one’s not dealing with abstract symbolic constructs, but instead with actual molecules and atoms.
In Version 13.1 we’re introducing PatternReaction as a symbolic representation for classes of chemical reactions—in effect providing an analog for chemistry of Rule for general symbolic expressions.
Here’s an example of a “pattern reaction”:
✕
|
The first argument specifies a pair of “reactant” molecule patterns to be transformed into “product” molecule patterns. The second argument specifies which atoms in which reactant molecules map to which atoms in which product molecules. If you mouse over the resulting pattern reaction, you’ll see corresponding atoms “light up”:
✕
|
Given a pattern reaction, we can use ApplyReaction to apply the reaction to concrete molecules:
✕
|
Here are plots of the resulting product molecules:
✕
|
The molecule patterns in the pattern reaction are matched against subparts of the concrete molecules, then the transformation is done, leaving the other parts of the molecules unchanged. In a sense it’s the direct analog of something like
✕
|
where the b in the symbolic expression is replaced, and the result is “knitted back” to fill in where the b used to be.
You can do what amounts to various kinds of “chemical functional programming” with ApplyReaction and PatternReaction. Here’s an example where we’re essentially building up a polymer by successive nesting of a reaction:
✕
|
✕
|
It’s often convenient to build pattern reactions symbolically using Wolfram Language “chemical primitives”. But PatternReaction also lets you specify reactions as SMARTS strings:
✕
|
Comments