MoleculeQ

MoleculeQ[mol]

returns True if mol is a valid Molecule expression, and False otherwise.

Examples

Basic Examples  (3)

Test whether an expression is a valid Molecule expression:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

A molecule with improper valence will issue a message, but is still MoleculeQ:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Adding a positive charge to the oxygen atom will fix the message:

In[3]:=
Click for copyable input
Out[3]=

Using an invalid bond type will not be MoleculeQ:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2019
(12.0)