This computational essay overrides the author’s previous post about the computation of information entropy of linear alkanes with graph vertex coloring. In this contribution, a simpler but far more flexible computational method with a broader range of applicability will be outlined on the basis of symmetry group theory. From a coder’s point of view, GraphAutomorphismGroup and GroupOrbits are the key built-in Wolfram Language functions necessary for obtaining the correct vertex partioning schemes for all the organic molecule classes shown in Ref. [1] and the related numerical value of the information entropy content h. By analyzing the computed values of h for a few molecules belonging to a given organic compound class (i.e. alkanes, alcohols, carboxylic acids..) alongside the mean value of the C atom oxidation state, it is possible to devise a quantitative classification scheme for chemical species based on fully computable descriptors. This procedure can be helpful for building up a machine learning based classification of molecules to assess their similarity within compound classes.

Definition of Information Entropy Content from the molecule graph of a chemical structure

As detailed in Ref. [1], there are two main routes for computing the information entropy content h of a molecule: a) graph vertex coloring (see link to my old post for alkanes) b) determination of the orbits of the automorphism group of the molecule graph G where two vertices belonging to the same orbit are considered equivalent. The focus of the current essay will be on the computational development of a generic function for the latter point b) with the help of the above mentioned Mathematica functions. Let’s recall that the basic principle behind the definition for the structural information content of a molecular graph is the selection and enumeration of inequivalent structural primitives (atoms and bonds); as a matter of fact, graph vertices corresponding to atom of different elements can be considered inequivalent as well as atoms belonging to same element but occupying different symmetry positions in the graph. This process produces a partitioning of the molecular graph vertices into discrete subsets with their own cardinalities. Since atomic positions are uniquely identified, criteria based on partitioning atom vertices are generally considered to be stricter than those based on graph edges as the concept of chemical bond is more vague from a physicist’s point of view. Therefore, a vertex partitioning scheme applied to the formula of the molecular information content can be considered a reliable route for the computation of the molecular information entropy. According to Ref. [1], the structural information content of a molecular graph can be expressed by
I(G,α)=-
n
∑
i=1

X
i

X
log
2

X
i

X
, where α is the equivalence criterion chosen and applied to the set of the graph elements X. The chosen criterion α produces a partitioning of X into n subsets with corresponding cardinality

X
i

. This equation applied to graph vertices (see Refs. [40-46] in Ref.[1]) can be rewritten in terms of the information content
h=
log
2
N-
n
∑
i=1
N
i
N
log
2
N
i
, where N is the total number of atoms in the molecule. The unit measure of h is bits/atom whereas the total information content in the molecule is
Nh=N
log
2
N-
n
∑
i=1
N
i
log
2
N
i
. As pointed out in Ref. [1], a reliable partitioning should reflect correctly the chemical inequivalence and should be independent of the chosen mathematical protocol. As main guidelines, atoms of different elements are attributed to different atom types, whereas atoms belonging to the same elements but occupying different positions in the graph because of connectivity reasons can be attributed to different subsets as well.

A general procedure to determine atom partitions with Mathematica Group Theory Functions

Since symmetry group theory is a very abstract field and often not prone to visualization, a couple of practical examples will be presented in the following for determining the partitioning scheme of two simple molecules. Thanks to the computer algebra functionalities of Mathematica, the procedure takes into account all their symmetry elements which are incorporated into the molecule graph and is, therefore, of general applicability even to complex organic molecules. For a summary of the related theory, the reader can consult the Wolfram Documentation alongside a standard group theory manual for molecular physical chemistry.

Example 1, water molecule

In[]:=
m=Molecule[Entity["Chemical","Water"]];​​MoleculePlot[m,IncludeHydrogens->All]
Out[]=
In[]:=
m["PointGroupDisplay"]
Out[]=
C
2v
In[]:=
CountsBy[m["SymmetryElements"],#Name&]
Out[]=

C
2
1,σ2
In[]:=
symmetryPlanes=Lookup[m["SymmetryElements"],"SymmetryPlane",Nothing];​​Show[MoleculePlot3D[m,ViewPoint->Front],Graphics3D[{Opacity[.4],symmetryPlanes}]]
Out[]=
In[]:=
gm=MoleculeGraph[m,PlotTheme"IndexLabeled"]
Out[]=
In[]:=
GraphAutomorphismGroup[MoleculeGraph[m,PlotTheme"IndexLabeled"]]
Out[]=
PermutationGroup[{Cycles[{{2,3}}]}]
In[]:=
(*findorbitswithcorrespondingatomelements*)
In[]:=
goels=Map[Level[AtomList[m,#],{2}]&,GroupOrbits[GraphAutomorphismGroup[MoleculeGraph[m,PlotTheme"IndexLabeled"]],Range[1,AtomCount[m]]]]
Out[]=
{{O},{H,H}}
In[]:=
(*partitioning*)
In[]:=
atsym=First/@goels
Out[]=
{O,H}
In[]:=
parts=Map[Length,goels]
Out[]=
{1,2}
In[]:=
nTot=AtomCount[m];​​nH=AtomCount[m,"H"];​​nO=AtomCount[m,"O"];​​Hpart=Extract[parts,Position[atsym,"H"]];​​Opart=Extract[parts,Position[atsym,"O"]];
The information content entropy h for the obtained partitioning schemes for O and H atoms can be computed with the following expression
In[]:=
(*informationentropyh:O,H*)​​N@(Log[2,nTot]-Apply[Plus,Map[#/(nO+nH)*Log[2,#]&,Opart]]-Apply[Plus,Map[#/(nO+nH)*Log[2,#]&,Hpart]])
Out[]=
0.918296
which matches the result reported in Table 1 in Ref. [1] and which of course can also be derived by pencil and paper inspection.

Example 2: ethanol molecule

A more general and compact computational procedure can be implemented for molecules with 3 or a higher number of atomic species, such as most organic compounds like alcohols, ketones or ethers comprising C, H and O in their structure which also exhibit more complex symmetry features.
In[]:=
(*forCHO-typemolecules*)​​m=Molecule[Entity["Chemical","Ethanol"]]
Out[]=
Molecule
Formula:
C
2
H
6
O
Atoms: 9 Bonds: 8

In[]:=
MoleculePlot[m,IncludeHydrogens->All]
Out[]=
In[]:=
m["PointGroupDisplay"]
Out[]=
C
s
In[]:=
CountsBy[m["SymmetryElements"],#Name&]
Out[]=
σ1
In[]:=
gm=MoleculeGraph[m,PlotTheme"IndexLabeled"]
Out[]=
In[]:=
GraphAutomorphismGroup[MoleculeGraph[m,PlotTheme"IndexLabeled"]]
Out[]=
PermutationGroup[{Cycles[{{4,5}}],Cycles[{{7,8}}],Cycles[{{6,7}}]}]
In[]:=
goels=Map[Level[AtomList[m,#],{2}]&,GroupOrbits[GraphAutomorphismGroup[MoleculeGraph[m,PlotTheme"IndexLabeled"]],Range[1,AtomCount[m]]]]

Final module and relationship with partial ordering plots of alkane isomers

For commodity, the above outlined procedure for the computation of h has been encapsulated into a module of general applicability to any molecule
which allows to check quickly the results for the two pentane isomers reported in Fig. 1 of Ref. [1]
Below, the computational version of Tables 1 and 2 of Ref. [1]. are reported where the function hchempartition for the atom partition has been separated from hchementropy for data clarity and reproducibility
Below, a computational version of Table 1 in Ref. [1] is reported for all the corresponding molecule classes with a few examples. The reader is invited to add or change example species accordingly to check that the h value does not change
The computational version of Table 2 in Ref. [1] follows below

h-based classification plots of organic molecules

Inspired by the outline of Fig. 5 in Ref.[1], taken by a seminal 1979 review in Russian language from Y.A. Zhdanov, one can grasp quickly with the chemical resources of Wolfram knowledge base at hand, the regimes of h-values (normalized on the number of C atoms in each organic compound) over the mean oxidation states for the C atoms in the molecule skeleton. This can highlight the path for the introduction of a quantitative way of classifying organic compounds beyond the standard nomenclature habit of referring to the functionalization groups and the presence of single, double or triple C-C bonds.
In addition to the module for h hchementropy, the mean oxidation state for all C atoms belonging to a chosen molecule or a list of molecules is needed as follows

h-based classification plot of C,H-hydrocarbons (alkanes, alkenes, alkynes and arenes)

Here a selection of organic compounds with only C and H atoms in their molecular structure is provided. It is interesting to note the different distribution of data points for alkanes, alkenes, alkynes and benzene derivatives (arenes). Obviously, the main difference relies in the diverse mean C oxidation state which is related to the different electronic structure (single, double, triple or hybrid resonance C-C chemical bond) of each class of compounds.

Machine learning classification prediction of organic compounds

Let’s suppose one has very scarce knowledge or reminiscence of organic chemistry nomenclature for compound classification or would like to assess similarity between classes of compounds. This may also be the case if a complex molecule is obtained with more than one functional groups or comprises diverse bond typologies so that it cannot be ascribed uniquely to a certain compound class. Machine learning classifiers trained on the above obtained datasets can be useful for accomplishing this task.

Example 4: Solanine

Another interesting molecule is solanine, which is a toxic alkaloid found in Solanaceae plant family (tomatoes, potatoes, eggplants, ... ). Again, it does not belong to the training datasets of natural compounds used by compoundclassnatural defined below. It is however correctly classified as being more similar to steroids than other compound classes, since they share the same basic four-ring carbon framework and even show biological activities that overlap with steroidal compounds (see picture below).

Summary

A general and flexible computational method based on symmetry group orbits has been outlined for the prediction of the information entropy content of any molecule and tested against some simple test examples reported in recent literature. This allows for a novel and easily scriptable computer-based classification of complex organic chemical species on the basis of quantitative descriptors such as information entropy and mean oxidation state of their carbon atoms. This could trace the path to create a sort of quantitative phylogenetics of organic compounds.

References

[1] Denis Sh. Sabirov and Igor S. Shepelevich, “Information Entropy in Chemistry”, Entropy, 2021, no. 23, 1240, 2023. https://doi.org/10.3390/e23101240

CITE THIS NOTEBOOK

A general method for computing information entropy of molecules with symmetry group theory orbits​
By Jessica Alfonsi​
Wolfram Community, STAFF PICKS, August 24, 2026
​https://community.wolfram.com/groups/-/m/t/3787334