New Developments in Wolfram Chemistry

(RowDefault[, (Spacer1), , (Spacer1), ])  #WolframTechConf

A Brief Overview of Wolfram Language Chemistry

The continually growing Wolfram Knowledgebase is the world’s most advanced repository of reliable, contextualized and factual data, tightly integrated with tens of thousands of algorithms.

{EntityType["Chemical"],EntityType["Element"],EntityType["Isotope"]}

Starting in Version 12.0 we have new data structures to represent arbitrary chemical objects

Molecule - an arbitrary chemical structure composed of atoms and bonds, with or without specified coordinates or stereochemistry

MoleculePattern - a pattern for a molecule substructure, can be written as SMARTS or using Atom and Bond primitives

BioSequence - a representation of a bio molecular sequence (“DNA”, “RNA”, “Peptide”, etc)

ChemicalReaction - represents a single elementary reaction

PatternReaction - a template reaction composed of molecule patterns

ChemicalFormula - sometimes all you have is the formula, without structural information

ChemicalInstance - an instance of a chemical - “5 grams HCl”, “2 moles of nitrogen at 77K”

BioSequence["Peptide","T"]

Molecule@%

ToEntity@%

ChemicalFormula@%

MoleculeMatchQ[BioSequence[],(RowDefault[(Subscript["C", 4]), (Subscript["H", 9]), "N", (Subscript["O", 3])])]

A couple of in-development extensions to System chemistry functionality:

CrystalStructure["/Users/jasonb/Documents/Wolfram/Minerals/Andalusite/00999.cif"]

%["Properties"]

ProteinStructure["/Users/jasonb/Documents/Wolfram/CrystalStructures/1av1.cif.gz"]

WolframChemistry paclets

MoleculeFingerprints - compute and compare molecule fingerprints.

IsomerGeneration - Generate Isomers from Chemical Formulas

Selfies - SELF-referencIng Embedded Strings

ProteinVisualization - Functions for protein visualizations

(DateObject["Minute: ""Fri 3 Nov 2023 01:30""GMT"-5, DateObject[{2023,11,3,1,30},"Minute","Gregorian",-5.`]])

ChemistryFunctions - General Interest Chemistry Functions

programming utilities

unique visualization functions

functions geared towards education

niche functions that do not fit into the System context

“Will we still want MoleculeFingerprint as a symbol in 100 years?”

testing ground for future System functionality

EmpiricalFormula

ChemistryFunctions paclet 1.0

Needs["WolframChemistry`ChemistryFunctions`"]

EmpiricalFormula returns a ChemicalFormula object with the simplest whole-number ratio of atoms for a given chemical compound.

A major textile dye manufacturer developed a new yellow dye. The dye has a percent composition of 75.95% C, 17.72% N, and 6.33% H by mass with a molar mass of about 240 g/mol. Determine the molecular formula of the dye.

EmpiricalFormula@\[LeftAssociation]"C"->(QuantityPostfix[75.95`, "%", percent, "Percent"]),"N"->(QuantityPostfix[17.72`, "%", percent, "Percent"]),"H"->(QuantityPostfix[6.33`, "%", percent, "Percent"])\[RightAssociation]

The sample has a molar mass of (Quantity[240, "g""/""mol", grams per mole, (("Grams")/("Moles"))]), find the chemical formula

EmpiricalFormula[\[LeftAssociation]"C"->(QuantityPostfix[75.95`, "%", percent, "Percent"]),"N"->(QuantityPostfix[17.72`, "%", percent, "Percent"]),"H"->(QuantityPostfix[6.33`, "%", percent, "Percent"])\[RightAssociation],(Quantity[240, "g""/""mol", grams per mole, (("Grams")/("Moles"))])]

FormatMoleculesAsGraphics

ChemistryFunctions paclet 1.0

After evaluating, all molecule objects will display as a 2D graphics in the same way that Graph does.

Output is interpretable, can be used as input

FormatMoleculesAsGraphics[]

Molecule["water"]

AtomCount@

RandomMolecule

ChemistryFunctions paclet 1.0

RandomMolecule selects molecules from a predefined list of 100,000 SMILES strings taken from publicly available datasets.

The molecules in the list have between 1 and 70 heavy atoms.

No ions or salts are returned

FeatureSpacePlot[
RandomMolecule[200],
FeatureExtractor->"MoleculeExtendedConnectivity",
LabelingFunction->None
]

MoleculePlotOptions

ChemistryFunctions paclet 1.1

customize a molecule plot, including undocumented options

undocumented options might change in future versions of the WL

use SetOptions on the resulting configuration to change the defaults

SeedRandom[22];
MoleculePlotOptions[RandomMolecule[],RingPattern[5]]

SetOptions[MoleculePlot,];
FormatMoleculesAsGraphics[]
RandomMolecule[]

AtomCount@%

FormatMoleculesAsGraphics[False]

Predicate functions

The ChemistryFunctions paclet contains a number of predicate functions which are useful when writing functions

Names["WolframChemistry`ChemistryFunctions`*Q"]//WordCloud

Test whether an object is a valid ChemicalFormula object:

ChemicalFormulaQ/@{ChemicalFormula["(\[FormalX]^22)+(Subscript[\[FormalXi], 9])"],ChemicalFormula["FC6H3(CF3)CH2OH"]}

EmptyMoleculeQ[m] returns True if m is an empty Molecule and False otherwise.

EmptyMoleculeQ[MoleculeModify[Molecule["oxygen"],{"DeleteAtom",{1,2}}]]

EmbeddedMoleculeQ: A molecule is considered to be embedded if the coordinates are specified as an option in the Molecule expression. 2- and 3-dimensional coordinates are specified via the AtomDiagramCoordinates and AtomCoordinates options, respectively.

EmbeddedMoleculeQ[Import["ExampleData/caffeine.xyz"]]

EmbeddedMoleculeQ[Import[ "ExampleData/fluoxetine.mol"]]

RingMoleculeQ - test whether a molecule is cyclic or not:

Select[RandomMolecule[200],Not@*RingMoleculeQ]

StereoisomersQ[Molecule["L-alanine"],Molecule["D-alanine"]]

EnantiomersQ[Molecule["L-alanine"],Molecule["D-alanine"]]

DiastereomersQ[Molecule["L-alanine"],Molecule["D-alanine"]]

BohrModelPlot

ChemistryFunctions paclet 1.0

Simple function, presents a visualization of the electron filling in atomic shells

Manipulate[BohrModelPlot[n,ImageSize->300],{{n,43},1,118,1}]

See also: PeriodicTablePlot

SmilesPlot

ChemistryFunctions paclet 1.0

?SmilesPlot

SmilesPlot["CCCC(CC)C(C)C"]

SmilesPlot["c1ccc(cc1)/C(=N/Nc1nc2c(s1)cccc2)/c1ccccn1"]

SmilesPlot@"O=N(=O)c1ccc2c3c1ccc1c3c(cc2)c2c(c1)cccc2"

MoleculeJoin

ChemistryFunctions paclet 1.0

?MoleculeJoin

Bonds should be entered as Bond[{{(Subscript[m, i]),(Subscript[a, j])},{(Subscript[m, k]),(Subscript[a, l])}},"type"] where {(Subscript[m, i]),(Subscript[a, j])} is the atom with index (Subscript[a, j]) in the molecule with index (Subscript[m, i]).

MoleculeJoin[{Molecule[],Molecule[]}]

MoleculeJoin[ConstantArray[Molecule["Tyrosine"],5],{Bond[{{1,8},{2,1}},"Single"],Bond[{{2,8},{3,1}},"Single"],Bond[{{3,8},{4,1}},"Single"],Bond[{{4,8},{5,1}},"Single"]}]

MoleculePlot3D@MoleculeJoin[
ConstantArray[Molecule["naphthalene"],10],Bond[{{#1,1},{#2,6}},"Single"]&@@@Partition[Range[10],2,1,1]
]

MoleculeManipulate3D

ChemistryFunctions paclet 1.0

Allows editing molecular geometry interactively

When two bonded atoms, (Subscript[a, i]) and (Subscript[a, j]), are selected a slider will appear that will change the given bond length. All atoms attached to atom (Subscript[a, j]) are moved. If the bond is part of a ring system the slider will not be enabled.

When three atoms, {(Subscript[a, i]),(Subscript[a, j]),(Subscript[a, k])} are selected a slider will appear which allows changing the given bond angle. All atoms attached to atom (Subscript[a, k]) are moved. If both bonds are part of a ring system the slider will not be enabled.

When four atoms, {(Subscript[a, i]),(Subscript[a, j]),(Subscript[a, k]),(Subscript[a, l])} are selected a slider will appear which allows changing the signed torsion angle between the plane made by the first three atoms and the plane made by the last three atoms. All atoms attached to atom (Subscript[a, l]) are moved. If the bond between atoms (Subscript[a, j]) and (Subscript[a, k]) is part of a ring system the slider will not be enabled.

MoleculeManipulate3D[Molecule["3-cyclohexyldecan-8-ol"]]

MoleculeManipulate

ChemistryFunctions paclet 1.1

This is a version of MoleculeDraw that lives in your notebook and can bind dynamically to a variable.

Not as responsive as MoleculeDraw, still needs work

MoleculeManipulate[]

Row[{MoleculeManipulate[Dynamic[m]],Dynamic@MoleculePlot3D[m]}]

MoleculeGridPlot

ChemistryFunctions paclet 1.0

A simple utility to display molecule plots as in a grid

returns a single Graphics object, with all molecules drawn to the same scale

MoleculeGridPlot[{
{Molecule["cyclohexane"],Molecule["benzene"]},{Molecule["hexane"],Molecule["(3Z)-hexa-1,3,5-triene"]}
}]

MoleculeGridPlot[{{Molecule["Cn1cnc2c(N)nc[n+](C)c21"],Molecule["O=c1c2[nH]cnc2[nH]c2nccn12"]},{Molecule["BrCc1ncnc2nc[nH]c12"],Molecule["Cc1nc(N)c2ncn([C@H]3O[C@@H](CO)[C@H](O)[C@@H]3O)c2n1"]}},MoleculePattern[]]

MoleculeScaffold

ChemistryFunctions paclet 1.0

Also known as a Murcko scaffold or molecular framework

All terminal atoms are iteratively removed, leaving only the ring systems and the bonds that connect them

scaffold=MoleculeScaffold[Molecule[],"GenericMoleculePattern"]

(* Evaluate me *)
SeedRandom[22];
Select[RandomMolecule[200],MoleculeScaffold[#,"GenericMoleculePattern"]===scaffold&]

MoleculePlot[#,scaffold]&/@%

ImportComputationalChemistryData

ChemistryFunctions paclet 1.1

Reads computational chemistry result files from ADF, DALTON, GAMESS (US), GAMESS-UK, Gaussian, Jaguar, Molcas, Molpro, MOPAC, NBO, NWChem, ORCA, Psi4, Q-Chem, and Turbomole.

Uses the cclib python library to read in the data

Should just work for MacOS and Linux, on Windows may require user to install python

Available through the Import format “ComputationalChemistryOutput”

suggest catchier names in the comments

Very new in development, more interesting examples are currently being written

Import["https://raw.githubusercontent.com/cclib/cclib/master/data/NWChem/basicNWChem6.5/dvb_gopt_hf.out",{"ComputationalChemistry","Elements"}]

Import["https://raw.githubusercontent.com/cclib/cclib/master/data/NWChem/basicNWChem6.8/dvb_dispersion_bp86_d3zero.out",{"ComputationalChemistry","Elements"}]

Import["https://raw.githubusercontent.com/cclib/cclib/master/data/QChem/basicQChem5.4/dvb_sp_un.out",{"ComputationalChemistry","Elements"}]

Import["https://raw.githubusercontent.com/cclib/cclib/master/data/NWChem/basicNWChem6.8/dvb_dispersion_bp86_d3zero.out","ComputationalChemistry"]

ListPlot[Import["ExampleData/bisCWdhpe2Cl_13benz_c1_freq.log",{"ComputationalChemistry",{"VibrationalFrequencies","IRIntensities"}}]//Transpose//QuantityMagnitude,Filling->0,]

The Last Slide

Other talks:

What’s New in Chemical Education? - (DateObject["Minute: ""Wed 1 Nov 2023 11:30""GMT"-5, DateObject[{2023,11,1,11,30},"Minute","Gregorian",-5.`]])

Chemistry Office Hour - (DateObject["Minute: ""Thu 2 Nov 2023 12:00""GMT"-5, DateObject[{2023,11,2,12,0},"Minute","Gregorian",-5.`]])

Protein Visualization in Wolfram Language  - (DateObject["Minute: ""Fri 3 Nov 2023 01:30""GMT"-5, DateObject[{2023,11,3,1,30},"Minute","Gregorian",-5.`]])

The Wolfram Chemistry Team

ImageCollage[RandomSample@{,,,,,,,},Background->None]