Skip to content

Isotope pattern of a formula at a charge

ms_isotope_pattern

Works out the fine-structure isotope lines of a formula, with m/z and relative intensity.

Runs
On the server
Level
Checked against a reference: an exact multinomial convolution in Python decimal, with IsoSpecPy run beside it; IsoSpecPy 2.6.1 on 24 cases (24 November 2026)
Ask your assistant

What it is

Returns a formula's fine-structure isotope lines, m/z and relative intensity, at IUPAC 2009 or stated compositions. Use when the isotopologue peaks of an ion are wanted, passing the ion's own formula (a protonated ion as [M+H]). Not for the monoisotopic m/z alone: use `ms_ion_mz`; for a peptide's formula first, use `ms_peptide_mass`. Refuses lead unless its composition is stated; charge 1 to 100, polarity and a threshold above 0 and at most 1 are required.

Field: Analytical chemistry.

What it does

You give

  • formula (required): The ion's own elemental formula, adducts included (C8H11N4O2 for caffeine [M+H]+); no charge written. Leading and trailing white space is removed before the pattern is checked.
  • charge (required): Charge number, 1 to 100. Must be at least 1 and at most 100.
  • polarity (required): The sign of the charge, applied by electron loss or gain.
  • relativeThreshold (required): Lines at or above this fraction of the most intense are listed. Must be above 0 and at most 1.
  • composition (required): Stated compositions; an empty list to use the IUPAC 2009 table for every element.

No request is recorded for this tool.

Limits

  • Research arithmetic: each number follows from the formula, sequence or values you give, by the method and any constants named on the tool, and describes those inputs rather than the sample or instrument they came from.
  • It is not an identification, a validated quantification or a check of an instrument, and it is not for diagnosis or treatment decisions.
  • Fine structure only, no aggregation to a resolving power: one line per isotopologue at the IUPAC 2009 representative composition (as NIST serves it; not yet read against the 2011 paper) or a stated one; the ion's own formula is required, charge by electron loss or gain; a real sample's pattern varies with its natural composition (CIAAW 2024 ranges, stated) by more than any tolerance here; lines below the threshold are dropped, and above a few kDa many small lines sum to the peaks an instrument shows; an element whose most abundant isotope can change within CIAAW 2024 needs a stated composition; at most one hundred thousand atoms of any element, one million units of work to list configurations (for example at most one hundred and twelve sulfur atoms, or ten tin atoms, fewer when other elements share the budget) and one thousand lines; each refused, never cut short.
  • Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.

It will not answer when

  • the formula has a charge written in it: the charge is given separately.
  • a symbol that is no element, an empty formula, a zero count, a parse error.
  • an element with no representative composition (technetium and the like); a stated composition does not lift this in this version.
  • an element whose most abundant isotope can change within CIAAW 2024 (lead), not stated by the caller: its base peak is not fixed either.
Every input, with its units5 inputs
  • formula (required): The ion's own elemental formula, adducts included (C8H11N4O2 for caffeine [M+H]+); no charge written. Leading and trailing white space is removed before the pattern is checked.
  • charge (required): Charge number, 1 to 100. Must be at least 1 and at most 100.
  • polarity (required): The sign of the charge, applied by electron loss or gain.
  • relativeThreshold (required): Lines at or above this fraction of the most intense are listed. Must be above 0 and at most 1.
  • composition (required): Stated compositions; an empty list to use the IUPAC 2009 table for every element.
Every refusal, with its code11 refusals
CodeWhen
CHARGED_FORMULAthe formula has a charge written in it: the charge is given separately.
FORMULA_UNREADABLEa symbol that is no element, an empty formula, a zero count, a parse error.
ELEMENT_NOT_IN_TABLEan element with no representative composition (technetium and the like); a stated composition does not lift this in this version.
MONOISOTOPE_NOT_FIXEDan element whose most abundant isotope can change within CIAAW 2024 (lead), not stated by the caller: its base peak is not fixed either.
COMPOSITION_DOES_NOT_SUM_TO_ONEa stated composition whose fractions do not sum to one.
COMPOSITION_FOR_ABSENT_ELEMENTa stated composition for an element the formula lacks.
NUCLIDE_NOT_IN_TABLEa stated isotope AME2020 does not tabulate.
ESTIMATED_MASSa stated isotope whose AME2020 mass is marked estimated (#).
TOO_MANY_ATOMSmore than one hundred thousand atoms of one element.
TOO_MANY_CONFIGURATIONSmore than one million units of work to list the configurations: summed over elements, the isotopes of non-zero fraction times the ways of placing the element's atoms on them.
TOO_MANY_LINESmore than one thousand lines at or above relativeThreshold.

The calculation

The method's equations, constants and worked example.

Isotope pattern of a formula at a chargeisotope-pattern@3.0.0

Equation 1

P(element configuration) = n! / prod(c_j!) x prod(p_j ^ c_j), Valkenborg et al. 2012's Eq. 3

P(isotopologue) = the product over elements of their configurations' probabilities, as the paper states on p. 99. An explanation, not the source, in two steps: (1) each of an element's n atoms takes isotope j with probability p_j, independently (independent is this record's word

the paper's premise is that molecules incorporate elemental isotopes according to their natural abundances, p. 97), so one assignment of isotopes to the n atoms with c_j atoms at isotope j has probability prod(p_j ^ c_j)

(2) the assignments with those counts number n! / prod(c_j!), the multinomial coefficient, so the configuration's probability is their product. The Python oracle evaluates this closed form, the coefficient as a product of exact integer binomials, and does not convolve single-atom distributions, so it checks the arithmetic, not the closed form

IsoSpecPy also evaluates the multinomial

SymbolMeaning
natoms of the element
c_jatoms at isotope j
p_jamount fraction of isotope j
Pprobability of a configuration or isotopologue

Source 1.

Equation 2

m/z = (sum of the line's nuclide masses - q x m(e)) / z, with q = +z for a positive ion and -z for a negative one: m/z is the ion's mass over the unified atomic mass unit divided by its charge number (IUPAC 2013, entry 356)

the ion's mass as the sum of its nuclide masses less q electrons is Drybench's construction, binding energies not modelled. The reply's unit Th is the thomson, which entry 356's Note 3 deprecates

it is kept as the label of that dimensionless quotient

SymbolMeaning
m(nuclide)AME2020 atomic mass, Da
m(e)electron mass, Da
qsigned charge
zcharge number
m/zm/z, the dimensionless quotient of IUPAC 2013 entry 356 (the name 'mass-to-charge ratio' is deprecated there), Th

Source 2.

Equation 3

bound = sum over atoms of count x u(nuclide), summed linearly, plus z x u(m(e)), over z, rounded up to two significant figures

a line is kept when P / Pmax >= relativeThreshold (inclusive)

lines in ascending m/z

coverage = the sum of the kept lines' probabilities

a label names every isotope other than each element's most abundant one in the composition in use (the table's, or the stated one

of two equally abundant, the lighter), as mass number, symbol and count (the count always written), isotopes in ascending mass number and elements in alphabetical order, separated by spaces, or none for the line in which every element is at its most abundant isotope alone, so a line lighter than that one is labelled too (74Se1, 10B1)

naturalRange lists the CIAAW 2024 entries of each element in the formula whose composition is not stated, by symbol and then mass number, and lists no stated element

SymbolMeaning
P, Pmaxprobability of a line, and of the most probable line
u(nuclide)AME2020 uncertainty, Da
u(m(e))standard uncertainty of the electron mass, Da

Source 3.

ConstantValueFrom
IUPAC 2009 representative isotopic compositions (as NIST serves them), or the caller's stated composition p_ja table of values, part of the methodSource 3
the natural range stated in the reply, and the check on each element's most abundant isotope CIAAW 2024 rangesa table of values, part of the methodSource 4
AME2020 atomic masses and uncertainties, tabulated in units of 1e-12 u (the file prints micro-u; divide by one million) m(nuclide)a table of values, part of the methodSource 5
electron mass m(e)0.0005485799090441 DaSource 6

A definition, not a model: the equation states what the quantity means. A different convention gives a different number.

Worked example

Worked example: one case of isotope-pattern@3.0.0, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

Inputs

  • formula = CH2Cl2
  • charge = 1
  • polarity = positive
  • relativeThreshold = 0.000001

Steps

  1. pC = 0.9893, from formula; by equation 1.
  2. pH2 = 0.99977001, from formula; by equation 1.
  3. pCl2 = 0.57395776, from formula; by equation 1.
  4. P = 0.56768582, from pC, pH2, pCl2; by equation 1; gives peaks[0].probability.
  5. pCl35Cl37 = 0.36728448, from formula; by equation 1.
  6. ratio = 0.63991552, from pCl35Cl37, pCl2; by equation 1; gives peaks[3].relativeIntensity.
  7. mass = 83.953355 Da, from formula; by equation 2.
  8. mz = 83.952807 Th, from mass, charge; by equation 2; gives peaks[0].mz.

The working, as the case writes it:

Cl2 alone: 0.7576^2 = 0.57395776, 2 x 0.7576 x 0.2424 = 0.36728448, 0.2424^2 = 0.05875776

relative to the first, 1 : 0.639916 : 0.102373. The all-12C, all-1H peaks with 35Cl2, 35Cl37Cl and 37Cl2 keep exactly these ratios, since the C and H factors are common to all three

the 13C and 2H satellites are separate fine-structure peaks

Answer

peaks[0].probability = 0.56768582

peaks[3].relativeIntensity = 0.63991552

peaks[0].mz = 83.952807 Th

Where these values came from: our own exact-arithmetic script and a hand-worked case; exact multinomial convolution in Python decimal, by stored reference values.

At build the tool returned this answer within the tolerance the file states: peak m/z equal at the reported decimals (absolute 1e-9 Th on the rounded values); probabilities, relative intensities and coverage absolute 1e-12; bounds, ranges, labels, counts, formulas, statuses and codes exact.

Sources

  1. Valkenborg D, Mertens I, Lemière F, Witters E, Burzykowski T. The isotopic distribution conundrum. Mass Spectrometry Reviews 2012;31:96–109

    Used for: Isotope pattern of a formula at a charge. At: equation 3, with the worked term Pr(12C110 13C2) = 112!/(110! 2!) Pr(12C)^110 Pr(13C)^2, p. 99 (worked terms continue on 100), section II.B, The Multinomial Expansion: 'The probability of occurrence of an isotopic variant of the entire biomolecule is calculated as the product of the probabilities for the corresponding element-specific isotopic variants.'.

    Read in full, 25 November 2026
  2. Murray KK, Boyd RK, Eberlin MN, Langley GJ, Li L, Naito Y. Definitions of terms relating to mass spectrometry (IUPAC Recommendations 2013). Pure Appl Chem 2013;85:1515-1609

    Used for: Isotope pattern of a formula at a charge. At: p. 1570-1571, section entry 356, m/z: the ion's mass over the unified atomic mass unit, divided by its charge number (regardless of sign); Note 3, the thomson (Th) deprecated.

    Read in full, 14 November 2026
  3. Coursey JS, Schwab DJ, Tsai JJ, Dragoset RA. Atomic Weights and Isotopic Compositions (NIST), whose compositions are Berglund M, Wieser ME, Isotopic compositions of the elements 2009, Pure Appl Chem 2011;83:397-410, as NIST states

    Used for: Isotope pattern of a formula at a charge. At: table Isotopic Composition column, every element.

    Read in full, 10 November 2026
  4. CIAAW (IUPAC Commission on Isotopic Abundances and Atomic Weights), Isotopic Compositions of the Elements

    Used for: Isotope pattern of a formula at a charge. At: table Representative isotopic composition, every element.

    Read in full, 10 November 2026
  5. Wang M, Huang WJ, Kondev FG, Audi G, Naimi S. The AME 2020 atomic mass evaluation (II). Tables, graphs and references. Chin Phys C 2021;45:030003

    Used for: Isotope pattern of a formula at a charge. At: table mass_1.mas20.txt, column ATOMIC MASS (micro-u) and its uncertainty, every nuclide.

    Read in full, 10 November 2026
  6. Mohr PJ, Newell DB, Taylor BN, Tiesinga E. CODATA recommended values of the fundamental physical constants: 2022 (NIST web table), electron mass in u

    Used for: Isotope pattern of a formula at a charge. At: table electron mass in u, value and standard uncertainty.

    Read in full, 11 November 2026

How it is checked

Level

Checked against a reference.

Checked against

Our own exact-arithmetic script and a hand-worked case.

Cases

No case set is linked to this version.

Not checked

Valkenborg et al. 2012 states the multinomial and the product over elements but not that atoms are independent, which is this record's explanation; two fresh agents' second implementations, of the same model family, are stored reference values and stored reference values (127 cases; one left out, a threshold within a few ulps of a line's ratio; 12 schema declines), and the edge cases are a separate agent's of 14 November 2026; Math.log and Math.exp remain the host's (REL-1539), which at 100,000 atoms leaves up to about 4.4e-13 relative on every line, of one sign across a pattern (C99000H2000, against 60 digits); the ratio P / Pmax that decides a line is computed in doubles, within about 1e-15 relative of the exact ratio, so a threshold within a few ulps of a line's exact ratio may keep or drop that line (the line-2 comparison's fresh#lines-threshold-at-1000th-ratio, whose threshold is the double just below the 1000th line's exact ratio: the tool drops that line); no aggregation to a resolving power; no measured spectrum compared; which uncertainty CIAAW prints in its value(u) entries is not stated on its page; one session wrote the script and the engine.; the line limit is applied during enumeration with the pruning bound's relative slack of one part in a billion: a pattern of one thousand lines or fewer whose extra candidates lie within that margin of the threshold may be refused, no pattern of more than one thousand lines is ever returned, and no returned line is affected; a formula starting with a digit (13CH2Cl2) is refused FORMULA_UNREADABLE since 2.0.1, through formula-mass 1.3.0, with no case in this method's fixtures; the refusal is covered by stored reference values and unit tests only.

Changes to its methods2 changes
  • 25 November 2026, isotope-pattern@3.0.0: In 3.0.0 each fraction's logarithm is the logarithm of its double plus the exact correction to the decimal it is written as (the table's text, or a stated fraction's shortest round-trip decimal), and the count times that logarithm enters the compensated sum as two exact products. Against 60-digit values the coverage at H100000 is now 2.6e-15 off and at C99000H2000 1.2e-13; the largest line difference over 139 cases is 5.1e-15. Every computed output can move in its last bits; 26 of the 63 recorded cases did.
  • 25 November 2026, isotope-pattern@3.0.0: In 3.0.0 the text states the rule the replies follow: a label names every isotope other than each element's most abundant one in the composition in use (of two equally abundant, the lighter), and none is the line in which every element is at its most abundant isotope.