classes

Provides classes to model period table elements.

Classes:

Element(number, symbol, name[, group, …])

Chemical element.

Elements(*elements)

Ordered dict of Elements with lookup by number, symbol, and name.

HeavyHydrogen(number, symbol, name[, group, …])

Subclass of Element to handle the Heavy Hydrogen isotopes Deuterium and Tritium.

Isotope([mass, abundance, massnumber])

Isotope massnumber, relative atomic mass, and abundance.

Data:

IsotopeDict

Type alias for isotope dictionaries.

class Element(number, symbol, name, group=0, period=0, block='', series=0, mass=0.0, eleneg=0.0, eleaffin=0.0, covrad=0.0, atmrad=0.0, vdwrad=0.0, tboil=0.0, tmelt=0.0, density=0.0, eleconfig='', oxistates='', ionenergy=None, isotopes=None, description='')[source]

Bases: Dictable

Chemical element.

Parameters
  • number (int) – The atomic number of the element.

  • symbol (str) – The chemical symbol of the element.

  • name (str) – The name of the element in English.

  • group (int) – The number of electrons in the element. Default 0.

  • period (int) – The number of protons in the element. Default 0.

  • block (str) – The group of the element in the periodic table. Default ''.

  • series (int) – The Period of the element in the periodic table. Default 0.

  • mass (float) – The relative atomic mass. Default 0.0.

  • eleneg (float) – The Electronegativity (Pauling scale). Default 0.0.

  • eleaffin (float) – The electron affinity in eV. Default 0.0.

  • covrad (float) – The Covalent radius in Angstrom. Default 0.0.

  • atmrad (float) – The Atomic radius in Angstrom. Default 0.0.

  • vdwrad (float) – The Van der Waals radius in Angstrom. Default 0.0.

  • tboil (float) – The boiling temperature in K. Default 0.0.

  • tmelt (float) – The melting temperature in K. Default 0.0.

  • density (float) – The density at 295K in g/cm³ respectively g/L. Default 0.0.

  • eleconfig (str) – The Ground state electron configuration. Default ''.

  • oxistates (str) – The oxidation states. Default ''.

  • ionenergy (Optional[Tuple]) – The ionization energies in eV. Default None.

  • isotopes (Optional[Dict[int, Union[Isotope, Tuple[float, float]]]]) – The Isotopic composition. A mapping of isotope mass numbers to Isotope objects. Default None.

  • description (str) – A description of the element. Default ''.

Methods:

__repr__()

Return a string representation of the Element.

__str__()

Return str(self).

validate()

Check consistency of the data.

Attributes:

atmrad

The Atomic radius in Angstrom.

block

The Block of the element in the periodic table.

covrad

The Covalent radius in Angstrom.

density

The density at 295K in g/cm³ respectively g/L.

description

A description of the element.

eleaffin

The electron affinity in eV.

eleconfig

The Ground state electron configuration.

eleconfig_dict

The ground state electron configuration.

electrons

The number of electrons in the element.

eleneg

The Electronegativity (Pauling scale).

eleshells

The number of electrons per shell as tuple.

exactmass

The relative atomic mass calculated from the isotopic composition.

group

The group of the element in the periodic table.

ionenergy

The ionization energies in eV.

isotopes

The Isotopic composition.

mass

The relative atomic mass.

molecular_weight

The relative atomic mass.

name

The name of the element in English.

neutrons

The number of neutrons in the most abundant natural stable isotope.

nominalmass

The mass number of the most abundant natural stable isotope.

number

The atomic number of the element.

oxistates

The oxidation states.

period

The Period of the element in the periodic table.

protons

The number of protons in the element.

series

Index to chemical series.

symbol

The chemical symbol of the element.

tboil

The boiling temperature in K.

tmelt

The melting temperature in K.

vdwrad

The Van der Waals radius in Angstrom.

__repr__()[source]

Return a string representation of the Element.

Return type

str

__str__()[source]

Return str(self).

Return type

str

property atmrad

The Atomic radius in Angstrom.

Return type

float

property block

The Block of the element in the periodic table.

Return type

str

property covrad

The Covalent radius in Angstrom.

Return type

float

property density

The density at 295K in g/cm³ respectively g/L.

Return type

float

property description

A description of the element.

Return type

str

property eleaffin

The electron affinity in eV.

Return type

float

property eleconfig

The Ground state electron configuration.

Return type

str

property eleconfig_dict

The ground state electron configuration.

Mapping of Tuple(shell, subshell): electrons.

Return type

Dict[Tuple, int]

property electrons

The number of electrons in the element.

Return type

int

property eleneg

The Electronegativity (Pauling scale).

Return type

float

property eleshells

The number of electrons per shell as tuple.

Return type

Tuple[int, …]

property exactmass

The relative atomic mass calculated from the isotopic composition.

Return type

float

property group

The group of the element in the periodic table.

Return type

int

property ionenergy

The ionization energies in eV.

Return type

Tuple

property isotopes

The Isotopic composition.

  • keys: isotope mass number

  • values: Isotope(relative atomic mass, abundance)

Return type

Dict[int, Isotope]

property mass

The relative atomic mass.

Ratio of the average mass of atoms.

Return type

float

property molecular_weight

The relative atomic mass.

Ratio of the average mass of atoms.

Return type

float

property name

The name of the element in English.

Return type

str

property neutrons

The number of neutrons in the most abundant natural stable isotope.

Return type

int

property nominalmass

The mass number of the most abundant natural stable isotope.

Return type

int

property number

The atomic number of the element.

Return type

int

property oxistates

The oxidation states.

Return type

str

property period

The Period of the element in the periodic table.

Return type

int

property protons

The number of protons in the element.

Return type

int

property series

Index to chemical series.

Return type

int

property symbol

The chemical symbol of the element.

Return type

str

property tboil

The boiling temperature in K.

Return type

float

property tmelt

The melting temperature in K.

Return type

float

validate()[source]

Check consistency of the data.

Raises

ValueError – If there are any validation issues.

property vdwrad

The Van der Waals radius in Angstrom.

Return type

float

class Elements(*elements)[source]

Bases: Iterable[Element]

Ordered dict of Elements with lookup by number, symbol, and name.

Parameters

*elements (Element) – The elements to add to the dictionary.

Methods:

__contains__(item)

Return key in self.

__getitem__(key)

Return self[key].

__iter__()

Returns an iterator over the elements, in order.

__len__()

Returns the number of elements.

__repr__()

Return a string representation of the Elements.

__str__()

Return str(self).

add_alternate_spelling(element, spelling)

Adds an alternate spelling for an element.

split_isotope(string)

Returns the symbol and mass number for the isotope represented by string.

Attributes:

lower_names

The names of the elements, all in lowercase.

names

The names of the elements.

symbols

The symbols of the elements.

__contains__(item)[source]

Return key in self.

Return type

bool

__getitem__(key)[source]

Return self[key].

Parameters

key – If a string, return the Element with that name or symbol. If a number, return the element with that atomic number.

Overloads
__iter__()[source]

Returns an iterator over the elements, in order.

Return type

Iterator[Element]

__len__()[source]

Returns the number of elements.

Return type

int

__repr__()[source]

Return a string representation of the Elements.

Return type

str

__str__()[source]

Return str(self).

Return type

str

add_alternate_spelling(element, spelling)[source]

Adds an alternate spelling for an element.

Parameters
property lower_names

The names of the elements, all in lowercase.

Return type

List[str]

property names

The names of the elements.

Return type

List[str]

split_isotope(string)[source]

Returns the symbol and mass number for the isotope represented by string.

Valid isotopes include '[C12]', 'C[12]' and '[12C]'.

Parameters

string (str)

Return type

Tuple[str, int]

Returns

Tuple representing the element and the isotope number.

property symbols

The symbols of the elements.

Return type

List[str]

class HeavyHydrogen(number, symbol, name, group=0, period=0, block='', series=0, mass=0.0, eleneg=0.0, eleaffin=0.0, covrad=0.0, atmrad=0.0, vdwrad=0.0, tboil=0.0, tmelt=0.0, density=0.0, eleconfig='', oxistates='', ionenergy=None, isotopes=None, description='')[source]

Bases: Element

Subclass of Element to handle the Heavy Hydrogen isotopes Deuterium and Tritium.

Chemical element.

Parameters
  • number (int) – The atomic number of the element.

  • symbol (str) – The chemical symbol of the element.

  • name (str) – The name of the element in English.

  • group (int) – The number of electrons in the element. Default 0.

  • period (int) – The number of protons in the element. Default 0.

  • block (str) – The group of the element in the periodic table. Default ''.

  • series (int) – The Period of the element in the periodic table. Default 0.

  • mass (float) – The relative atomic mass. Default 0.0.

  • eleneg (float) – The Electronegativity (Pauling scale). Default 0.0.

  • eleaffin (float) – The electron affinity in eV. Default 0.0.

  • covrad (float) – The Covalent radius in Angstrom. Default 0.0.

  • atmrad (float) – The Atomic radius in Angstrom. Default 0.0.

  • vdwrad (float) – The Van der Waals radius in Angstrom. Default 0.0.

  • tboil (float) – The boiling temperature in K. Default 0.0.

  • tmelt (float) – The melting temperature in K. Default 0.0.

  • density (float) – The density at 295K in g/cm³ respectively g/L. Default 0.0.

  • eleconfig (str) – The Ground state electron configuration. Default ''.

  • oxistates (str) – The oxidation states. Default ''.

  • ionenergy (Optional[Tuple]) – The ionization energies in eV. Default None.

  • isotopes (Optional[Dict[int, Union[Isotope, Tuple[float, float]]]]) – The Isotopic composition. A mapping of isotope mass numbers to Isotope objects. Default None.

  • description (str) – A description of the element. Default ''.

Attributes:

as_isotope

Return the isotope in H[X] format.

nominalmass

Return mass number of most abundant natural stable isotope.

property as_isotope

Return the isotope in H[X] format.

Return type

str

property nominalmass

Return mass number of most abundant natural stable isotope.

Return type

int

class Isotope(mass=0.0, abundance=1.0, massnumber=0)[source]

Bases: Dictable

Isotope massnumber, relative atomic mass, and abundance.

Parameters
  • mass (float) – The mass of the isotope. Default 0.0.

  • abundance (float) – The natural abundance of the isotope. Default 1.0.

  • massnumber (int) – The mass number of the isotope. Default 0.

Methods:

__repr__()

Return a string representation of the Isotope.

__str__()

Return str(self).

Attributes:

abundance

The natural abundance of the isotope.

mass

The mass of the isotope.

massnumber

The mass number of the isotope.

__repr__()[source]

Return a string representation of the Isotope.

Return type

str

__str__()[source]

Return str(self).

Return type

str

property abundance

The natural abundance of the isotope.

Return type

float

property mass

The mass of the isotope.

Return type

float

property massnumber

The mass number of the isotope.

Return type

int

IsotopeDict

Type alias for isotope dictionaries.

Alias of Dict[int, Union[Isotope, Tuple[float, float]]]