GetElements

GetElements[formula]
returns a list of the chemical elements contained in formula.

GetElements[crystal]
returns a list of all chemical elements contained in $CrystalData for crystal.

Details and OptionsDetails and Options

  • Each element will only appear once in output.
  • Options:
  • "IgnoreIonCharge"Trueignore the charge of ions
    "Tally"Falsewhether to count the number of various elements
  • If the elements of a crystal is queried, the function will first lookup the key "ChemicalFormula" in $CrystalData and execute that string. If the key is missing, a list of the atom species found in "AtomData" will be returned.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

The chemical formula can be strings with whitespace separating the elements:

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

The formulas may also be formatted strings with subscripts:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=

Parentheses and duplicate elements are handled:

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