orthonym.rules.isotope_scopes#

Note

Internal API. Names and behaviour may change between releases.

Isotope labels in several scopes of one name (IUPAC 2013 recommendations,.

The decorator of rules.isotopes places one descriptor per attachment atom, each found alone against a copy of the molecule that carries only that atom’s labels, and it asks for integer locants only. A molecule whose labels sit in several parts of the name then fails in three ways: labels on symmetry-equivalent atoms all choose the same locant, a label inside a multiplied substituent that holds only part of the label set has no scope of its own, and a label on a ring of an assembly or on a fusion atom needs a primed or lettered locant. The Blue Book name of such a compound is one descriptor per labelled part.

NAMES,: “The name of an isotopically substituted compound is formed by adding

or inserting the nuclide symbol(s) enclosed in parentheses, preceded by any necessary locant(s), letters, and/or numerals, before the part of the compound that is isotopically substituted… When two or more nuclide symbols appear at the same place in the name they are cited first in alphabetical order and then by their mass number, if necessary (see “; its preferred names carry several independently scoped descriptors in one name (‘1-(13C)methyl(2-13C)benzene (PIN)’) and one descriptor per unit of a multiplied group (‘1,2-di[(13C)methyl]benzene (PIN)’). Different isotopic modifications on otherwise identical substituents: “When two substituent groups are isotopically modified in different ways so that they cannot be combined together using multiplicative terms such as ‘di-’, ‘bis-’, etc., they are cited separately.”: “In a name consisting of two or more words, the isotopic descriptor is placed before the appropriate word or part of the word that includes the nuclide(s)”. ORDER OF NUCLIDE SYMBOLS, and: the symbols of one place are alphabetical, then by increasing mass number. Omission of locants,: “if isotopic modification requires a locant to specify its position, then all locants must be specified and none are omitted”;: “Locants are omitted in compounds or substituent groups in which all positions are completely isotopically substituted or modified in the same way”. Multiple types of enclosing marks, : “the parentheses used to indicate… specific isotopic substitution… are taken into consideration” in the nesting order.

The composer binds each label to a slot of the name from OPSIN’s own reading, not from a producer. OPSIN writes the atoms of one name in an order that does not depend on the isotope descriptors cited in it, so the heavy atoms of the parse of the bare skeleton are a frame every probe of that skeleton shares, and one isomorphism of that frame onto the input names each frame atom as an atom of the input. A probe, one label cited at one slot with one locant token, is parsed, and the atom it labels (one per copy, inside a multiplied group) is read in the frame: that binds the slot and the token to atoms of the input. The labelled atoms of the input are then covered by probes, innermost slot first and lowest locants first, and every cover is spelled with one descriptor per slot and read back whole through rules.isotopes._isotope_round_trips (canonical SMILES and the full InChIKey with its isotope layer). Nothing but a name that OPSIN itself reads, and reads as the input, is returned.

A unit that holds every position of its nuclide is cited without locants, ‘(2H5)phenyl’, ‘(2H9)tert-butyl’); its piece labels all the positions of the unit at once. When the skeleton as the engine names it has no cover, the same search runs on its other spellings: the multiplied groups cited once per copy; a group none of whose copies is labelled is multiplied again in the name) and ‘tert-butyl’ as ‘2-methylpropan-2-yl’.

The composer is reached only when every strategy of the decorator has declined, and only at the best-effort tier (its names are below the PIN, which every other tier declines), so no name the decorator builds is changed. Its names are labelled below the PIN: the descriptors are placed by what OPSIN reads, and a spelling the Blue Book prints for a part is not always the one built.

Bounded and deterministic: the OPSIN parses one call may spend are counted (PARSE_BUDGET), the covers it reads back are counted (COVER_CAP), and every order is fixed. The bounds are per call of the composer, which the decorator makes once for each labelled molecule or fragment it names. The clock (time.perf_counter) is read only to fill LAST_STATS, which no decision reads.

orthonym.rules.isotope_scopes.PARSE_BUDGET = 8000#

OPSIN parses the probes of one composer call may spend. Beyond it the probing stops and the composer works with what it has read (a name is still gated by its own read back).

orthonym.rules.isotope_scopes.COVER_CAP = 32#

Covers of the labelled atoms read back for one spelling of the skeleton.

orthonym.rules.isotope_scopes.LAST_STATS: Dict[str, object] = {}#

What the last call spent, and what the first calls of the process spent (measurement only; no decision reads them).

orthonym.rules.isotope_scopes.compose_scopes(skeleton, original, label_map, n_pos, budget=8000)#

A name of original: skeleton with one descriptor per labelled part, read back whole; None when no cover of the labels reads back. Never raises.

orthonym.rules.isotope_scopes.compose_last_resort(sink, original, label_map)#

The composer on the skeleton sink holds (left there by the decorator when it declined), the name labelled below the PIN.

The descriptors are placed by what OPSIN reads and not by the grammar of the name, and a spelling the Blue Book prints for a part is not always the one built, so the name is recorded as a non-PIN fragment (the default tier declines it; the best-effort tier ships it as a verified systematic name) and keeps the non-PIN record of the skeleton it is built on.