orthonym.assembly.book_prefixes#

Note

Internal API. Names and behaviour may change between releases.

Shared spellings for the best-effort writers: the book’s form of a substituent prefix.

The last-resort writers (rules/terminal_fragment, the floor in assembly/universal_substituent) assemble names mechanically. The helpers here give them the Blue Book’s spelling of the same group, built from the parts the writer has already named; they never read or rewrite an emitted name.

Locants (roadmap N5f):

  • (a) (the Blue Book-2893, heading ‘ The locant ‘1’ is omitted:’): “(a) in substituted mononuclear parent hydrides” – a methyl group cites no locant on its prefixes (‘chloromethyl’, the Blue Book; ‘2-(hydroxymethyl) benzene-1,4-diol (PIN)’,:6802), and (:7272) encloses the second and further substituents of a mononuclear parent (‘chloro(methyl)silane (PIN)’).

  • (:3007): “All locants are omitted in compounds or substituent groups in which all substitutable positions are completely substituted or modified… in the same way” (‘1-chloro-2-(pentafluoroethyl)benzene (PIN)’,:3023); “In case of partial substitution or modification, all numerical prefixes must be indicated” (:3009).

  • (1) (:15813): “The atom with the free valence terminates a chain and always has the locant ‘1’, which is omitted from the name” – ‘ethyl’, ‘2-chloroethyl’, not ‘ethan-1-yl’; ‘methyl (preferred prefix) methanyl’ (:15864).

Acyl groups (roadmap N5e):

  • (2) (:29451): “carbonyl groups in position 1 of a side chain, i.e., -CO-R, are described by the appropriate acyl group name”; (3) (:29452) ‘formyl’.

  • (:32922-:32928): -CO-NH2 on a ring, a heterogeneous chain or a nonterminal carbon is ‘carbamoyl’, “substituted in the normal way” (‘3-(dimethylcarbamoyl)pentanedioic acid (PIN)’,:32934); never ‘amino… oxomethyl’.

  • (:30624): the acid suffix ‘carboxylic acid’ gives the acyl suffix ‘carbonyl’ (‘pyrrolidine-1-carboxylic acid (PIN)’,:29892 -> ‘pyrrolidine-1-carbonyl’).

  • (:31698): an ester group -CO-OR’ cited as a prefix is ‘alkoxycarbonyl’ (‘3-(ethoxycarbonyl)phenoxy’,:31813).

  • (:30446): ‘benzoyl (preferred prefix) benzenecarbonyl oxo(phenyl)methyl’ – the enclosed ‘R(oxo)methyl’ is the general spelling when no acyl name is built;

    (:30851): a monovalent group concatenated with ‘carbonyl’,

    ‘(azetidin-1-yl)carbonyl’, when the acid name of a ring-N carbonyl is not built.

orthonym.assembly.book_prefixes.A_CHAIN_ENDS = frozenset({'Al', 'As', 'B', 'Bi', 'C', 'Ga', 'Ge', 'In', 'P', 'Pb', 'Sb', 'Si', 'Sn', 'Tl'})#

(the Blue Book, ‘Skeletal replacement (‘a’) nomenclature for acyclic parent hydrides’): “The chain must be terminated by a C atom or one of the following heteroatoms: P, As, Sb, Bi, Si, Ge, Sn, Pb, B, Al, Ga, In, or Tl.”,:23430)

orthonym.assembly.book_prefixes.CHALCOGEN_HEAD = {'O': 'oxy', 'S': 'sulfanyl', 'Se': 'selanyl', 'Te': 'tellanyl'}#

27649) ‘(R)sulfanyl’, ‘(R)selanyl’, ‘(R)tellanyl’

Type:

(

Type:
  1. ‘R-oxy’; (

orthonym.assembly.book_prefixes.HETERO_ROOT_VALENCE = {'As': 3, 'B': 3, 'Ge': 4, 'N': 3, 'O': 2, 'P': 3, 'Pb': 4, 'S': 2, 'Se': 2, 'Si': 4, 'Sn': 4, 'Te': 2}#

the heteroatom roots a writer composes as a substituent prefix (‘methoxy’, ‘(R)sulfanyl’, ‘(R)amino’, ‘trimethylsilyl’), with their standard bonding number

orthonym.assembly.book_prefixes.METHYL_HEADS = {0: 'methane', 1: 'methyl', 2: 'methylidene', 3: 'methylidyne'}#

the mononuclear carbon parent and its substituent prefixes by free-valence bond order

orthonym.assembly.book_prefixes.MONONUCLEAR_HEAD = {'As': 'arsanyl', 'B': 'boranyl', 'Ge': 'germyl', 'P': 'phosphanyl', 'Pb': 'plumbyl', 'Si': 'silyl', 'Sn': 'stannyl'}#

‘silyl’, ‘phosphanyl’, ‘boranyl’,…

Type:

substituent prefixes of the mononuclear parent hydrides,

orthonym.assembly.book_prefixes.a_chain_licensed(mol, path)#

True when the atom path is a carbon chain, or an ‘a’ chain the book allows: four or more heterounits, at least one carbon atom, both ends C or an A_CHAIN_ENDS element the Blue Book,:6465). A heterounit “is a set of heteroatoms having a name of its own such as, -SS-, disulfanediyl”:23350), counted by the strict path’s own rule (skeletal_replacement._count_chain_heterounits: -SS-, -OO-, -SiH2-O-SiH2- are one unit each); a run that rule cannot count (a trisulfane,:23385) licenses no ‘a’ chain.

orthonym.assembly.book_prefixes.acyl_derivation(mol, carbonyl_c, acyl_atoms)#

How the prefix of the acyl group R-CO- is built, from its atoms:

  • substituted (c),:7035): R carries an atom outside the acid’s parent – the unbranched carbon chain that ends at the carbonyl carbon (‘acetyl’, the alkanoyls;:30442,:30608) or the ring system / ring assembly the carbonyl carbon is bonded to:30624);

  • enclosed,:7232): a substituted acyl; an acyl named by the suffix ‘carbonyl’ on a ring (‘4-(cyclohexanecarbonyl)benzene-1-carbothioic acid (PIN)’, :7322; ‘3-[(pyridine-3-carbonyl)oxy]propanoic acid (PIN)’,:31723); not the retained ‘benzoyl’ (‘3-(benzoyloxy)propanoic acid (PIN)’,:31711) nor a saturated alkanoyl; None (main’s predicates decide) for an unsaturated alkanoyl.

orthonym.assembly.book_prefixes.acyl_group_prefix(mol, carbonyl_c, parent_idx, acyl_atoms, name_part)#

The book’s prefix of an acyl group (_acyl_group_prefix), recorded with note_book_form when one is given.

orthonym.assembly.book_prefixes.acyl_side_atoms(mol, carbonyl_c, exclude)#

The atoms of the acyl group R-CO- that hold carbonyl_c: everything reachable from it without passing through exclude (the atom the group is attached to).

orthonym.assembly.book_prefixes.book_forms_enabled()#
orthonym.assembly.book_prefixes.RETRY_KEEP_ORDER = (frozenset({'ring'}), frozenset({'chain'}))#

The keep-forms rungs of the retry ladder, in order. The ladder is book -> these rungs -> mechanical: one failing spelling of a kind that is not kept does not take the kept kinds’ names with it. U2 adds {‘chain’} (the N/O group prefixes and ‘cyano’, hetero_group_prefixes). The P and S groups (‘ps’) have a drop rung only: a failing P/S group costs only the P/S kind, and a keep rung of {‘ps’} would repeat it.

orthonym.assembly.book_prefixes.forms_enabled(kind)#

The writers of one kind of book spelling (‘ring’) give it: always when book_forms_enabled, and inside mechanical_forms(keep_forms=...) naming the kind; never inside book_forms_minus(...) naming it.

orthonym.assembly.book_prefixes.ring_forms_enabled()#

The writers of single rings spell the book’s form (forms_enabled('ring')).

orthonym.assembly.book_prefixes.retry_keeps(fired_kinds)#

The rungs of RETRY_KEEP_ORDER worth running after a run that gave the kinds fired_kinds: every kept kind was given, and some other kind was too (when only the kept kinds were given, the rung repeats the run).

orthonym.assembly.book_prefixes.retry_rungs(fired_kinds)#

The rungs between the book run and the mechanical one, in order, as (how, kinds): first ('drop', kinds) for every kind of RETRY_DROP_ORDER that was given together with another kind (a drop of the only kind given is the mechanical rung): “every book spelling except this kind” is the spelling before that lane’s forms, so a name a lane’s forms cost is never worse than it was; then the keep rungs of retry_keeps (('keep', kinds)). Run each under retry_spelling(rung).

orthonym.assembly.book_prefixes.retry_spelling(rung)#

The spelling of one rung of retry_rungs: ('keep', kinds) is mechanical_forms(keep_forms=kinds), ('drop', kinds) is book_forms_minus(kinds).

orthonym.assembly.book_prefixes.book_forms_minus(drop_forms)#

Inside the block every writer gives its book spelling EXCEPT the kinds named in drop_forms (‘chain’, ‘ps’,…), which give their mechanical one (forms_enabled): the rung that returns the spelling before one lane’s kind while every other kind stays.

orthonym.assembly.book_prefixes.RETRY_DROP_ORDER = (frozenset({'chain'}), frozenset({'ps'}))#

after the keep rungs and before the mechanical one, “every book spelling except this kind”. One kind per rung; a lane adds its kind here (‘chain’: item 12a; ‘ps’: the P and S oxoacid groups, item 12b).

Type:

The drop rungs of the retry ladder, in order

orthonym.assembly.book_prefixes.hetero_roots_composable(mol, path, group_leaves=True, ps_groups=False)#

True when every heteroatom of the atom path can root a composed substituent prefix (‘methoxy’, ‘(R)amino’, ‘azaniumyl’, ‘trimethylsilyl’): an element of HETERO_ROOT_VALENCE at its standard bonding number with no charge and no isotope label, or an ammonium nitrogen (four bonds, +1). A charged or hypervalent heteroatom (the S+ of a sulfoxide written as S+-O-, the N+ of a nitrone, a sulfate sulfur) has no composed prefix here, so a writer keeps its chain spelling for such a path rather than cut the chain into a branch it can only spell as another ‘a’ chain. An -OO- link is cut at its first oxygen (group_leaves; without it the chain stays): that oxygen roots the group ‘(R)peroxy’ / ‘hydroperoxy’ (hetero_group_prefixes; the Blue Book “‘R′-peroxy’ (not R′-dioxy)”, ‘(methylperoxy)ethane (PIN)’,:27870;:27944). (An -SS- link is cut: ‘[(R)sulfanyl]sulfanyl’ reads back, the book’s ‘R-disulfanyl’ of the same rule is not built either; residual.) With ps_groups the centre of a phosphorus or sulfur oxoacid group and the O or NH that links one to the path root a prefix of their own (rules.oxoacid_group_prefix: ‘sulfamoyl’, ‘(methoxysulfonyl)’, ‘sulfooxy’), as the standard-valence heteroatoms do.

orthonym.assembly.book_prefixes.mechanical_forms(keep_forms=())#

Inside the block every writer gives its mechanical spelling (the spelling before roadmap N5); the kinds named in keep_forms (‘ring’: the single-ring names of rules.monocycle_forms) stay the book’s (forms_enabled).

orthonym.assembly.book_prefixes.methyl_group_name(branch_names, bond_order=1)#

‘trifluoromethyl’, ‘(4-chlorophenyl)methyl’, ‘chlorodi(fluoro)methyl’, ‘hydroxy(phenyl)methyl’, ‘trichloromethane’ (bond_order 0) – a one-carbon parent with its prefixes, no locants (a)), the second and further prefixes enclosed. branch_names holds one bare prefix name per substituent (a name repeated k times is cited once with its multiplier). None when a name has no multiplier or marks the shared assembler accepts.

orthonym.assembly.book_prefixes.note_book_form(kind='other')#

A writer records that it gave a book spelling in place of its mechanical one (read by watch_book_forms; a no-op outside one). kind: ‘ring’ for a single ring’s name (rules.monocycle_forms), the kind the keep-forms retry keeps; ‘other’ for every other spelling. A lane that adds a kept kind (a chain, a phosphorus or sulfur group) names it here and in RETRY_KEEP_ORDER.

orthonym.assembly.book_prefixes.positions_alike_prefix(mol, spine_atoms, branch_names, *, unit_cites_locant)#

The prefix block without locants when every substitutable position of the spine carries the same prefix:3007): ‘pentafluoro’ for -CF2-CF3, ‘pentachloro’ for C6Cl5-. None when the substitution is partial (a hydrogen is left on a spine atom) or when two kinds of prefix are present (:3009, all locants are then cited).

unit_cites_locant is the writer’s fact that the unit the block is cited on (the parent, the substituent prefix) cites a locant, not read from its text. (the Blue Book): “if any locants are essential for defining the structure of the parent structure or of a unit of structure… then all locants must be cited for the parent structure or that structural unit” – a unit that cites a locant (‘propan-2-yl’, ‘1,3,4-oxadiazol-2-yl’, ‘1H-imidazole’) keeps every locant (‘(1,1,1,3,3,3-hexafluoropropan-2-yl)oxy’,:46359), so None.

orthonym.assembly.book_prefixes.retained_group_prefix(mol, group_atoms, attach_idx, bond_order)#

The retained preferred prefix of an UNSUBSTITUTED benzyl or tert-butyl group, decided from its atoms, or None.

  • (the Blue Book) ‘-C(CH3)3 tert-butyl (preferred prefix) 1,1-dimethylethyl’; (:24414-:24418) ‘benzyl’, ‘benzylidene’, ‘benzylidyne’.

  • (:16272) “… retained preferred prefixes, but are not to be substituted”: any other heavy neighbour on the group, an isotope label (also on a hydrogen), a charge or a radical makes it another group (‘(4-chlorophenyl)methyl’).

group_atoms is every heavy atom of the group, attach_idx its free-valence atom, bond_order the order of the bond to the parent. A radical centre is not a group on a parent (1),:40376); the radical writer never calls this.

orthonym.assembly.book_prefixes.watch_book_forms()#

with watch_book_forms as fired: – fired[0] is True after the block when a writer inside it gave a book spelling, fired[1] is the set of the kinds of the spellings given (‘ring’, ‘other’). The public naming calls use it to decide whether a molecule the book spellings left without a verified name is named again, the rungs of retry_keeps(fired[1]) first and mechanical_forms last (namer.Orthonym.name / name_tiered).