Something or other, whatever!

Christian Lawson-Perfect's homepage

Chemistry extension for Numbas

Chemistry extension for Numbas

Provides data and functions to make calculations in chemistry easier.

Functions and data are being added as needed.

This has been written by a non-chemist, in collaboration with some non-coding chemists.

JME functions

atom(symbol, [mass number]) or atom(atomic number, [mass number])

Construct an atom of the element with the given symbol or atomic number. Give mass number to specify a particular isotope.

Example:

name(atom)

The IUPAC name of the atom, with the mass number appended if it's a particular isotope.

Examples:

symbol(atom)

The symbol of the atom.

Example:

string(atom)

A plaintext string representation of the atom. For isotopes, the mass number is shown in superscript.

Example:

atom[property]

Get the given property of the atom, from the periodic_table_data or isotope_data dictionaries.

Examples:

atomic_number(atom)

The atomic number of the atom.

Example:

mass_number(atom)

The mass number of the given atom. If no isotope is specified, the most abundant isotope is used.

Example:

neutrons(atom)

The number of neutrons in the atom Equivalent to mass_number(atom) - atomic_number(atom).

Example:

relative_mass(atom)

The relative atomic mass of the atom. If no isotope is specified, the standard atomic weight is used.

Example:

isotopes(atom)

List the mass number of known isotopes of the element.

Example:

abundance(atom)

Abundance of the given isotope. If no isotope specified, returns 1.

Example:

formula(string)

Construct a compound from the given formula.

Examples:

string(formula)

A plain text display representation of the given formula.

Example:

plain_string(formula)

A plain text display representation of the given formula.

Example:

atom_counts(formula)

Returns a dictionary containing the number of atoms of each element present in the compound.

Example:

mass(formula)

The relative atomic mass of the compound specified by the formula.

Example:

thermodynamic_data(name,state)

Returns data from the thermodynamic_data dictionary for the chemical with the given name or symbol, in the given state. Common values of state are "g" (gas), "l" (liquid), "c" (crystalline), or "amorphous". Some other states are also listed; see thermodynamic_data.

Data

Some data sets are available as variables.

periodic_table

Based on https://github.com/andrejewski/periodic-table, which is itself based on https://web.archive.org/web/20161203095654/http://php.scripts.psu.edu/djh300/cmpsc221/p3s11-pt-data.htm.

A list of dictionaries providing data on elements in the periodic table. periodic_table[n] give data for the element with atomic number n.

Each dictionary has the following keys:

isotope_data

Based on https://www.nist.gov/pml/atomic-weights-and-isotopic-compositions-relative-atomic-masses

Data on properties of isotopes. A dictionary of the form {atomic_number: {mass_number: data}}.

Each dictionary has the following keys:

thermodynamic_data

Based on Newcastle University's thermodynamic data card.

Data on thermodynamic properties of some chemicals in different states. Most easily accessed with thermodynamic_data(name,state).

A list of dictionaries with the following keys: