moleculekit.periodictable module#

moleculekit.periodictable.elements_from_masses(masses)#

Guess atomic elements from their masses.

Each mass is matched to the element whose standard atomic mass is closest. Atoms with a mass of exactly zero are treated as virtual sites: their guessed element is set to an empty string. Guessing for masses above 140 is unreliable and emits a warning.

Parameters:

masses (float | list) – A single atomic mass or a sequence of atomic masses.

Returns:

  • elements (str or list of str) – If a single mass is given, the guessed element symbol is returned as a string. If multiple masses are given, a list of element symbols is returned together with virtualsites (see below).

  • virtualsites (numpy.ndarray) – Only returned when multiple masses are given. A boolean array, True for atoms identified as virtual sites (mass equal to zero).