orthonym.rules.adducts#

Note

Internal API. Names and behaviour may change between releases.

Adduct / solvate / hydrate nomenclature — Blue Book (Wave-2 P0A).

: “Names are formed by citing the names of individual compounds in the order of the formula connected by long (em) dashes (—). The proportions of components are indicated after the name by an arabic number separated by a solidus from other numbers; arabic numbers and the solidus are placed in parentheses, separated from the name by a space.”

: “organic components in order as described in, inorganic components…; water (if present), is cited last.” General nomenclature: “hydrates may be named by adding the word ‘hydrate’ to the name preceded by an appropriate numerical prefix… Terms such as ‘hemi’ and ‘sesqui’ are also used.”

Fail-closed: name_adduct returns None unless EVERY component fragment is fully nameable and every single-heavy-atom fragment is a recognized inorganic component. Scope: ALL-NEUTRAL fragment sets only — charged multi-fragment input is owned by the salt/ion routing (dispatch priority < 800) and never reaches this module.

Breadth Job 2 (best-effort tier only): a disconnected drawing with a metal in it (‘CC(N)C(=O)O.CC(N)C(=O)O.[Ni]’, six ‘[C-]#N’ with ‘[Fe+2]’) is named as a mixed organic - inorganic adduct of its components – a metal atom by its element name, a metal cation with its charge number, a metal halide or oxide by an additive name – and ships only when OPSIN reads the name back to exactly the drawn structure. Such a name is never a PIN (the Blue Book).

orthonym.rules.adducts.HYDROGEN_COMPONENT_NAMES: Dict[str, str] = {'N': 'ammonia', '[H-]': 'hydride', '[HH]': 'dihydrogen'}#

Beside a metal, ammonia is cited by the AMMINE mechanism of data/metal_scope.py (metal_atoms.ammine_component_names) and the hydride ion as that of a hydride salt (CARBANION_SALTS): those two are taken from this table only when every true metal of the assembly is admitted to that mechanism (_hydrogen_components).

orthonym.rules.adducts.HYDROGEN_ION_AND_ISOTOPE_NAMES: Dict[str, str] = {'[1H+]': 'proton', '[1H-]': 'protide', '[2H+]': 'deuteron', '[2H-]': 'deuteride', '[2HH]': '(2H1)dihydrogen', '[2H][2H]': '(2H2)dihydrogen', '[2H][3H]': '(2H1,3H1)dihydrogen', '[3H+]': 'triton', '[3H-]': 'tritide', '[3HH]': '(3H1)dihydrogen', '[3H][3H]': '(3H2)dihydrogen', '[H+]': 'hydron', '[H][2H]': '(2H1)dihydrogen', '[H][3H]': '(3H1)dihydrogen'}#

The hydrogen ions and the isotopically modified dihydrogens “Names for hydrogen atoms and ions”, Table 8.1, the Blue Book; nuclide descriptors,:43728). OPSIN reads none of these words: an adduct name with one ships through validation.hydrogen_word_read_back only when it reproduces the drawn structure exactly. Keys are RDKit’s canonical SMILES of the fragment.

orthonym.rules.adducts.LABELLED_PARTS_ALONE: ContextVar = <ContextVar name='labelled_parts_alone' default=False>#

a component that carries a nuclide is named as a compound alone (_name_component_in_fresh_frame()), where the isotope decorator of Orthonym.name runs (it runs at the top level only), so the part keeps its label. A fresh frame runs in an empty context, so the parts of that part are named as before. Set, it holds a list: the shareable memo entries of the parts named so far, then per labelled part whether its name is free of a non-PIN record (_noting_pin_record()).

Type:

set while rules.isotope_components.labelled_parts_adduct_name names an isotope-labelled mixture

orthonym.rules.adducts.in_component_adduct_scope()#

True while the last-resort component producer names the components of a mixture.

orthonym.rules.adducts.split_components(mol)#

Split a multi-fragment mol into deduped (canonical_smiles, count).

Returns None for single-fragment input or when RDKit cannot split / sanitize the fragments (fail-closed).

orthonym.rules.adducts.component_sort_key(frag_smi)#

Deterministic citation order for one component.

(bucket, seniority index, -number of principal groups, parent key, -heavy_atoms, canonical_smiles): organic components ordered by the seniority of the class of their principal characteristic group: “cited in the order of seniority of classes (see “); within a class the component with more principal groups and then the senior parent ring system (_principal_group_parent_key()) comes first, which is how ‘benzene-1,2,3-triol—quinolin-8-ol (1/2)’ and ‘1H-indole-2-carboxylic acid—3,5-dinitrobenzoic acid (1/1)’ are cited (:3769, “in the order of seniority of classes”); components without a suffix-capable PCG (hydrocarbons, N-heterocycles-as-π-bases) rank after all PCG-bearing organics, ties by descending size then canonical SMILES – reproduces every Blue Book example (coronene—trinitrobenzene big-first; benzene—pyridine resolved form).

orthonym.rules.adducts.isotopes_only_in_hydrogen_components(mol)#

True when every isotope label of the multi-component mol sits in a hydrogen-only component that HYDROGEN_ION_AND_ISOTOPE_NAMES names (‘[2H][2H]’ -> ‘(2H2)dihydrogen’, ‘[2H+]’ -> ‘deuteron’): the adduct name carries the label in that component’s word, so the isotope decorator (rules.isotopes), which writes descriptors into the name of the unlabelled skeleton, has nothing to place.

orthonym.rules.adducts.name_adduct(mol, canonical_smiles=None, style='pin', *, general_fallback=False, allow_aromatic_general=False, general_fallback_unverified=False)#

_name_adduct_body(); when it names nothing, a drawing of one-atom components with at least one bare atom is named as an element set at the best-effort tier (_element_set_name: ‘iron—nickel (1/1)’, ‘alumane—iron (1/1)’). After the body, so that no adduct it names changes (‘zinc—water (1/1)’). The name ships in the order of its components that OPSIN reads (readable_component_order()).

orthonym.rules.adducts.readable_component_order(name, mol)#

name, or a spelling of the same components that OPSIN reads when OPSIN rejects name.

  1. A hydrogen deuteride or tritide component takes its binary name (‘hydrogen deuteride’, from the anion names ‘deuteride’ and ‘tritide’ of “Names for hydrogen atoms and ions”, Table 8.1, the Blue Book) in place of its nuclide name ‘(2H1)dihydrogen’,:43728), which no OPSIN reads; OPSIN 2.9.0 and main read the binary name in any position. Carbon-free, so no PIN either way.

  2. OPSIN reads a radical component of an adduct name (‘-yl’, ‘-ylidene’, ‘nitroso’, and ‘dihydrogen’ as well) only as the LAST component; anywhere else it reads it as a prefix of the next one (“believes there to be 1 components but 2 ratios were given”: ‘stannylidene—tin (1/1)’ fails, ‘tin—stannylidene (1/1)’ reads). Such a name passes the gates today through its order twin (validation.twin_spellings.component_order_twins) and shipped in the class order no reader reads “Organic adducts”,:3765, cites the components “in the order of seniority of classes”, radicals first). An adduct name is no PIN “General organic method for naming Lewis adducts”,:37556, “these ‘adduct names’ are not PINs”;,:4667), and the order of its components carries no structure, so the name may ship with one component moved to the end: the first such move, in component order. The class order (and water cited last,:4665) is kept whenever OPSIN reads it. Only where the OPSIN in use reads adducts with a radical component (opsin_capabilities.radical_adduct_enabled; OPSIN 2.9.0 reads none in any order).

A spelling ships only when OPSIN reads it, it reproduces the drawn structure (_parse_reproduces_depiction) and the round-trip compare of the shipped name accepts it (Orthonym._rt_match); else name ships as before. The label records of name carry over to the shipped spelling.