Function Repository Resource:

ChemicalElementComposition

Source Notebook

Compute the elemental composition of a chemical entity

Contributed by: Wolfram Chemistry Team

ResourceFunction["ChemicalElementComposition"][quantity,entity]

computes the complete elemental composition of a specified quantity of the chemical entity.

ResourceFunction["ChemicalElementComposition"][quantity,"name"]

computes the complete elemental composition of a specified quantity of the chemical "name".

ResourceFunction["ChemicalElementComposition"][quantity,entity,{elem1,}]

computes the elemental composition corresponding to the elements elemi.

Details and Options

Elements can be specified as strings or Entity objects.
ResourceFunction["ChemicalElementComposition"] accepts a TargetUnits option, which specifies the units to use in the output.

Examples

Basic Examples (2) 

Calculate the mass of each element present in 200 mg of the drug acetaminophen:

In[1]:=
ResourceFunction["ChemicalElementComposition"][
 Quantity[200, "Milligrams"], Entity["Chemical", "Acetaminophen"]]
Out[1]=

Calculate the mass of only carbon and nitrogen:

In[2]:=
ResourceFunction["ChemicalElementComposition"][
 Quantity[200, "Milligrams"], Entity["Chemical", "Acetaminophen"], {Entity["Element", "Carbon"], Entity["Element", "Nitrogen"]}]
Out[2]=

Scope (2) 

Compute the mass of a single element:

In[3]:=
ResourceFunction["ChemicalElementComposition"][Quantity[10, "Ounces"],
  Entity["Chemical", "LLysine"], Entity["Element", "Oxygen"]]
Out[3]=

Use strings:

In[4]:=
ResourceFunction["ChemicalElementComposition"][
 Quantity[100, "Grams"], "SquaricAcid", {"Oxygen", "Carbon"}]
Out[4]=
In[5]:=
ResourceFunction["ChemicalElementComposition"][
 Quantity[50, "Milligrams"], "ChloramineT", {"Na", "Cl"}]
Out[5]=

Options (1) 

TargetUnits (1) 

Use TargetUnits to specify the units to use in the result:

In[6]:=
ResourceFunction["ChemicalElementComposition"][Quantity[15, "Grams"], Entity["Chemical", "Deltamethrin"], TargetUnits -> "Moles"]
Out[6]=
In[7]:=
ResourceFunction["ChemicalElementComposition"][Quantity[15, "Grams"], Entity["Chemical", "Deltamethrin"], {Entity["Element", "Oxygen"], Entity["Element", "Nitrogen"]}, TargetUnits -> "Atoms"]
Out[7]=

Version History

  • 1.0.0 – 07 July 2021

Related Resources

License Information