orthonym.rules.lactones#

Note

Internal API. Names and behaviour may change between releases.

Monocyclic lactone naming using IUPAC heterocyclic replacement nomenclature.

Lactones are cyclic esters. Monocyclic lactones are named as heterocyclic ketones: the ring oxygen gives the heterocyclic parent name, and the carbonyl is expressed as a -one suffix at position 2.

Naming algorithm: 1. Detect lactone: ring contains -C(=O)-O- where both C and ester O are

in the same ring, and the exocyclic O is a double-bonded carbonyl.

  1. Determine ring size.

  2. For ring size 3-10: Get the Hantzsch-Widman heterocyclic parent name: - 3: oxirane, 4: oxetane, 5: oxolane, 6: oxane, 7: oxepane, etc.

  3. For ring size 11+: Use replacement nomenclature with chain prefix: - 11: oxacycloundecan, 13: oxacyclotridecan, 15: oxacyclopentadecan

  4. Apply vowel elision and append ‘-2-one’.

Reference: IUPAC 2013 Blue Book, (Lactones), (Replacement)

Examples

O=C1CCO1 (beta-propiolactone) -> oxetan-2-one O=C1CCCO1 (gamma-butyrolactone) -> oxolan-2-one O=C1CCCCO1 (delta-valerolactone) -> oxan-2-one O=C1CCCCCO1 (epsilon-caprolactone) -> oxepan-2-one O=C1CCCCCCCCCO1 (10-membered lactone) -> oxacycloundecan-2-one

orthonym.rules.lactones.is_monocyclic_lactone(mol)#

Detect whether a molecule is (or contains) a monocyclic lactone.

A monocyclic lactone has: - A ring containing an ester motif: -C(=O)-O- where both the carbonyl

carbon and the ester oxygen are in the same ring.

  • The carbonyl oxygen is exocyclic (double-bonded to the carbonyl C).

  • The ring is not fused with another ring (monocyclic only).

Parameters:

mol – RDKit Mol object (or None).

Returns:

Dict with detection info if lactone found – ring_atoms: tuple of atom indices in the lactone ring

carbonyl_idx: atom index of the carbonyl carbon (C=O) ester_O_idx: atom index of the ring (ester) oxygen carbonyl_O_idx: atom index of the exocyclic carbonyl oxygen ring_size: number of atoms in the ring

None if not a monocyclic lactone.

Return type:

Dict | None

orthonym.rules.lactones.name_lactone_ring(ring_size, extra_o_locant=None, chalcogen='O', ene_locants=None)#

Get the IUPAC name for a monocyclic lactone of a given ring size.

For ring sizes 3-10: uses Hantzsch-Widman heterocyclic parent naming. For ring sizes 11+: uses replacement nomenclature (oxacyclo{prefix}an-2-one).

Parameters:
  • ring_size (int) – Number of atoms in the lactone ring (3-50 supported).

  • extra_o_locant (int | None) – locant of a SECOND ring oxygen bonded to the carbonyl carbon (cyclic carbonate, (a)). When set to 3 (the only geometry this namer describes), builds the 1,3-dioxa Hantzsch-Widman parent (1,3-dioxan-2-one). Any other value returns None (fail closed).

  • ene_locants (List[int] | None) – a phase (A). Sorted list of the lower-numbered locant of each in-ring C=C, on the SAME fixed O=1/C=2 numbering this function already uses. Ring sizes 11+ ONLY (the HW range has no replacement-nomenclature ring stem to attach an ene locant to – is_monocyclic_lactone never supplies this for ring_size<=10). None/empty -> the existing saturated ...an stem (byte-identical to the pre-Phase-6 behaviour).

Returns:

IUPAC name string (e.g., ‘oxolan-2-one’), or None if ring size is not supported.

Return type:

str | None

Examples

>>> name_lactone_ring(4)
'oxetan-2-one'
>>> name_lactone_ring(5)
'oxolan-2-one'
>>> name_lactone_ring(6)
'oxan-2-one'
>>> name_lactone_ring(7)
'oxepan-2-one'
>>> name_lactone_ring(11)
'oxacycloundecan-2-one'
>>> name_lactone_ring(13)
'oxacyclotridecan-2-one'
>>> name_lactone_ring(6, extra_o_locant=3)
'1,3-dioxan-2-one'
orthonym.rules.lactones.name_monocyclic_lactone(mol)#

Generate the IUPAC name for a monocyclic lactone, including substituents.

Detects whether the molecule is a monocyclic lactone and returns its name using heterocyclic replacement nomenclature with -one suffix. Substituents on the ring are included as prefixes with locants.

Parameters:

mol – RDKit Mol object (or None).

Returns:

IUPAC name string (e.g., ‘oxolan-2-one’, ‘3-aminooxolan-2-one’), or None if the molecule is not a monocyclic lactone.

Return type:

str | None

Examples

>>> from rdkit import Chem
>>> mol = Chem.MolFromSmiles('O=C1CCCO1')
>>> name_monocyclic_lactone(mol)
'oxolan-2-one'
>>> mol = Chem.MolFromSmiles('NC1CCOC1=O')
>>> name_monocyclic_lactone(mol)
'3-aminooxolan-2-one'
orthonym.rules.lactones.another_ring_ketone_system_is_senior(mol, lactone_ring)#

True when another ring system of mol carrying a ring carbonyl (a ketone or a pseudoketone: an exocyclic =O on a ring carbon) outranks the lactone’s ring as the parent: more such carbonyl groups, or as many and senior by.

(the Blue Book): “There is no seniority order difference between

ketones and pseudoketones. When necessary, the maximum number of carbonyl groups or doubly bonded oxygen atoms, the seniority order between chains and rings, and between rings and ring systems, are considered”; ‘:29648 4-(4-oxocyclohexyl) oxolan-2-one (PIN) [… a heterocyclic ring is senior to a carbocyclic ring, see ]’. So ‘5-(4-oxo-3,4-dihydro-2H-1-benzopyran-2-yl)oxolan-2-one’ is not the PIN: 1-benzopyran has more rings (d)) and one carbonyl, as the oxolane has.

orthonym.rules.lactones.name_cyclic_polyester(mol)#

: name a cyclic di-/polyester (lactide) as a Hantzsch-Widman heterocycle whose acyl carbons are expressed with a -dione/-trione suffix:

O=C1COC(=O)CO1 (glycolide) -> 1,4-dioxane-2,5-dione (PIN)

The single-carbonyl lactone namer (name_monocyclic_lactone()) fails closed on this class because a SECOND ring oxygen is itself an ester O bearing its own ring carbonyl. Here every ring O is an ester oxygen (bonded to exactly ONE ring carbonyl C) and there are >=2 such carbonyls, so the ring is numbered with the O heteroatoms lowest (HW) and the carbonyls become a multiplied -one suffix.

Fail-closed scope (accuracy-first, never a wrong name): one saturated monocyclic ring of only C and O (ring size 3-10); >=2 ring ester carbonyls; every ring O bonded to exactly one ring carbonyl C. This DECLINES:

  • the ordinary single lactone (1 carbonyl, handled upstream),

  • the cyclic carbonate (both ring O on one carbonyl -> len(o_nbrs)!=1),

  • the cyclic anhydride (a bridging ring O bonded to TWO carbonyls),

  • any ring bearing an unnameable substituent.