Function Repository Resource:

RingMoleculeQ

Source Notebook

Determine if a molecule has rings

Contributed by: Jason Biggs

ResourceFunction["RingMoleculeQ"][mol]

yields True if the molecule mol has rings, and returns False otherwise.

Details

A molecule contains rings if the underlying chemical graph contains at least one cycle.

Examples

Basic Examples (2) 

Test if a molecule has rings:

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/e7212512-c082-4cc6-86ce-80c10bcdcffc"]
Out[1]=

Not all molecules have rings:

In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/c1e5dcf1-f1c3-42be-a149-c95a898550a4"]
Out[2]=

Scope (2) 

Select entities from a class of chemicals which contain rings:

In[3]:=
Select[EntityClass["Chemical", "DiproticAcids"][
  "Molecule"], ResourceFunction["RingMoleculeQ"]]
Out[3]=

Since these molecules have rings, their underlying Graph representations are not acyclic:

In[4]:=
AcyclicGraphQ@*MoleculeGraph /@ %
Out[4]=

Publisher

JasonB

Version History

  • 1.0.0 – 06 April 2022

License Information