Skip to content

Methods and checksMethods

How every result is reached and what it was checked against, app by app.

Methods and checks pages

Degrees of unsaturation (rings plus π bonds) of a neutral molecular formula, version 1.0.2

mol-degrees-unsaturation@1.0.2: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.

What this page can and cannot show

Level: Checked against a reference; neutral formula at the stated valences; rings and π bonds together; RDKit 2024.9.6 structure counts. Reference kind: our own exact-arithmetic script and a hand-worked case.

Not fully recorded, and not independently reviewed. Items marked "Not recorded" are missing from this project's records for the version named. Apart from any worked example shown, the cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed these methods or checks.

Every version of this method · Every method · What the levels mean

Version 1.0.2

Level: Checked against a reference; neutral formula at the stated valences; rings and π bonds together; RDKit 2024.9.6 structure counts. Reference kind: our own exact-arithmetic script and a hand-worked case. mol-degrees-unsaturation@1.0.2

Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.

Verification statement: Degrees of unsaturation, 1 + ½ Σ n_i(v_i − 2), a definition, from a neutral molecular formula at fixed valences (sulfur and phosphorus as stated); rings and π bonds counted together, not told apart. Compared with RDKit 2024.9.6 ring and π-bond counts of stated structures (29 cases) and with a second implementation in Python by a separate agent of the same model family (82 cases, 29 at the edges; 1 that program's error). Exact integers; a negative or half count is refused, never rounded.

D = 1 + ½ Σ n_i (v_i − 2) at fixed valences (H and the halogens 1; O and S 2; N, P and B 3; C and Si 4; S or P as stated). For one connected molecule this is its rings plus π bonds: B = ½ Σ n_i v_i bonds counted by order, and B − Σ n_i + 1 independent cycles. Counts only: formula-reading's guard 7 does not run here. The order of notes and flags carries no meaning.

  • How results are reported: none: an exact whole number
  • Uncertainty: Exact integer arithmetic on the formula and the stated valences; nothing is measured.
  • Every reply through it says: A ring and a π bond each count one; the count does not tell them apart.
  • Reference, as its record states it: exact arithmetic in a Python program; each structure counted in RDKit 2024.9.6; a second implementation in Python by a separate agent of the same model family
  • Computes through: formula-reading@1.0.2
  • Level confirmed by this project's ruling of 25 November 2026

What this page can and cannot show

What was checked

134 cases in 2 files, linked by this exact version.

Run through the tool at build against our own exact-arithmetic script and a hand-worked case: 97 agree within the tolerance the file states, 37 refuse as the case expects, 0 differ, 0 were not run.

  • File 1, 53 cases

    • Where the expected values came from: our own exact-arithmetic script and a hand-worked case
    • Recorded on: 2026-11-10
    • Reference: Python standard library decimal and fractions, Python 3.13.18; licence PSF-2.0
    • Tolerance as the file states it: counts exact; valences, formulas, flags, statuses and codes exact
  • File 2, 81 cases

    • Where the expected values came from: our own exact-arithmetic script and a hand-worked case
    • Recorded on: 2026-11-14
    • Reference: second implementation (Python 3.13), 2026-11-14; licence BSD-3-Clause
    • Tolerance as the file states it: counts exact; valences, formulas, flags, statuses and codes exact

Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.

What was not checked

The IUPAC terms 'degree of unsaturation' and 'index of hydrogen deficiency' (the Gold Book, not read); electron-deficient boron (B2H6 gives −1 at these valences and is refused, DOU_NEGATIVE; three-centre bonds are not counted); a disconnected species written as one formula; hypervalent halogens. A formula starting with a digit (13C6H6) is refused FORMULA_INVALID since 1.0.2, 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.

Definition or model

A closed form: the result follows from the inputs by the equations alone.

Equations

Definition: the formula's valence count of unsaturation, 1 + ½ Σ n_i(v_i − 2), at the valences stated in the reply.

D = 1 + ½ Σ_i n_i (v_i − 2)
Symbol Meaning and unit
D rings plus π bonds
n_i count of element i in the formula
v_i valence of element i: H and the halogens 1; O and S 2; N, P and B 3; C and Si 4; or a stated valence for S (2, 4, 6) or P (3, 5)

Constants

Constants: none used.

Worked example

Worked example: one case of mol-degrees-unsaturation@1.0.2, 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 = C6H6

Steps

  1. carbon = 12, from formula; by the equation above.
  2. hydrogen = -6, from formula; by the equation above.
  3. D = 4, from carbon, hydrogen; by the equation above; gives ringsPlusPiBonds.

The working, as the case writes it:

D = 1 + ½ Σ n(v − 2) on C6H6: C 6 × (4 − 2) = 12
H 6 × (1 − 2) = −6
Σ = 6
D = 1 + ½ × 6 = 4

Answer

  • ringsPlusPiBonds = 4

Where these values came from: our own exact-arithmetic script and a hand-worked case; worked by hand by Drybench (ruling, §7).

At build the tool returned this answer within the tolerance the file states: counts exact; valences, formulas, flags, statuses and codes exact.

Who worked this case: not recorded.

What it refuses, and its input ranges

  • FORMULA_CHARGED: the formula carries a charge: which atom carries it decides the count, and a formula does not say; give the neutral parent formula Next: Give the neutral parent formula.
  • FORMULA_ADDUCT: the formula is an adduct of more than one molecule (·, . or *) Next: Give one molecule's formula, without the adduct.
  • ELEMENT_NO_VALENCE: an element is outside the record's valence table (metals and every element other than H, the halogens, O, S, N, P, B, C and Si) Next: No change of input makes this computable on these data.
  • DOU_NOT_INTEGER: the count is a half at these valences: an odd-electron species, or a wrong valence; it is never reported or rounded Next: Check the formula and any valence stated for sulfur or phosphorus; a radical is not computed here.
  • FORMULA_IS_SMILES (invalid input): a formula reads as a SMILES (= # @ / \ or a lower-case letter not after an upper-case one); for a structure, molecule_descriptors
  • FORMULA_INVALID (invalid input): the formula cannot be read exactly as written: it is an electron; it writes a charge of zero; the formula-mass parser refuses it (an unknown symbol or one without a standard atomic weight, an ambiguous charge such as Fe3+, an unclosed bracket, a number before the formula such as 13CH4); it holds a count of zero; a count or the charge is above 2^53 − 1; or its molar-mass sum is too large to hold exactly (the shared routine formula-reading)
  • VALENCE_NOT_ALLOWED (invalid input): a valence is stated for an element other than S or P, at a value not offered (S 2, 4 or 6; P 3 or 5), or for an element not in the formula
  • DOU_NEGATIVE (invalid input): the count is negative at these valences, so no connected neutral molecule has the formula

Flags and notes a reply may carry

A flag says a number must be read differently:

  • LOWEST_VALENCE: Sulfur or phosphorus was counted at its lowest valence, so an S=O or P=O bond is not counted; state its valence to count it.

A note a reply may carry:

  • STATED_VALENCE: Counted at the valence stated for sulfur or phosphorus; the count holds for a structure drawn with that valence.

Changes

2026-11-25-mol-degrees-unsaturation@1.0.2-1

2026-11-25 · mol-degrees-unsaturation@1.0.2 · Corrections to our methods

  • What was wrong: A number written before the formula was read as a multiplier: benzene written 13C6H6 was read as C78H78, with 40 rings plus π bonds for 4.
  • Affected: mol_degrees_unsaturation at mol-degrees-unsaturation 1.0.1 and earlier, only where the formula starts with a digit. Every other output is unchanged.
  • What changed: In 1.0.2, through formula-mass 1.3.0, a formula starting with a digit is now refused (FORMULA_INVALID); every other output is unchanged, and every pinned output hash is the same.
  • How it was found: A review of the formula reader's grammar on 24 November 2026 found that no rule or test documented a number at the start of a formula, while the shared reader (formula-mass) applied the adduct multiplier to the first part as well; the scientific review ruled the same day that such a formula is refused. A sweep of the tools' worked examples with 13 written before each formula argument, before and after the fix, found which tools computed on it.
  • Cases added: None in the fixtures: no published case starts a formula with a digit, and every pinned output hash is unchanged. The refusal is covered by the formula reader's hand cases and unit tests; the widened sweep records each tool's reply before and after.

Tools that use it

Cite this version

Degrees of unsaturation (rings plus π bonds) of a neutral molecular formula. Drybench; mol-degrees-unsaturation@1.0.2; https://www.drybench.com/methods/m/mol-degrees-unsaturation/1.0.2 (accessed [date]).