orthonym.validation.hydrogen_word_read_back#

Note

Internal API. Names and behaviour may change between releases.

Read back an adduct name with a hydrogen component that OPSIN does not read.

“Names for hydrogen atoms and ions”, Table 8.1 (the Blue Book) names the hydrogen cation ‘hydron’

(natural composition), ‘proton’ (1H), ‘deuteron’ (2H) and ‘triton’ (3H), and the anion ‘hydride’, ‘protide’, ‘deuteride’ and ‘tritide’. The isotopically modified dihydrogens take the nuclide descriptors of (“nuclide descriptors”, ‘dichloro(2H2)methane (PIN)’,:43728) on ‘dihydrogen’: ‘(2H1)dihydrogen’, ‘(2H2)dihydrogen’ (the book gives no name of its own for them). OPSIN reads none of these words, and a dihydrogen beside a radical component makes it read the whole adduct as one component.

A adduct name (“Organic adducts”,:3765) is the names of its individual compounds joined by em dashes, with the proportions after them. Its structure is the structure of each component, so the reader here reads each component on its own: a hydrogen word from:data:HYDROGEN_WORDS, every other component by OPSIN (the radical setting on, as the validity gate reads). The name ships through this reader only when it reproduces the drawn structure exactly, every hydrogen an atom (hydrogen_word_round_trip()): a standard InChIKey does not see a hydron (it goes into the protonation layer: ‘acetate—hydron (1/1)’ and acetic acid share one key).

orthonym.validation.hydrogen_word_read_back.HYDROGEN_WORDS = {'(2H1)dihydrogen': '[2H][H]', '(2H1,3H1)dihydrogen': '[2H][3H]', '(2H2)dihydrogen': '[2H][2H]', '(3H1)dihydrogen': '[3H][H]', '(3H2)dihydrogen': '[3H][3H]', 'deuteride': '[2H-]', 'deuteron': '[2H+]', 'dihydrogen': '[H][H]', 'hydride': '[H-]', 'hydron': '[H+]', 'protide': '[1H-]', 'proton': '[1H+]', 'tritide': '[3H-]', 'triton': '[3H+]'}#

the hydrogen words a component of an adduct name may be, with their structure

orthonym.validation.hydrogen_word_read_back.HYDROGEN_WORDS_RULE = 'hydrogen_words'#

the rule id of a read through this reader (metrics.provenance.reconstructed_outcome)

orthonym.validation.hydrogen_word_read_back.read_back_with_hydrogen_words(name)#

The SMILES of the adduct name as OPSIN would read it if it read the hydrogen words, every hydrogen an explicit atom; None when name is not an adduct name with a hydrogen word, or a component does not read.

OPSIN reads an adduct name as a whole and balances its charges (StructureBuilder.balanceChargeIfPossible): an element word without a charge or an oxidation number takes its typical charge (‘ethane—yttrium’ beside a carbanion reads as Y+), and in a negative mixture of several components the acid atoms of the suffixes are neutralised (‘acetate—dihydrogen (1/1)’ reads as acetic acid in an OPSIN that reads ‘dihydrogen’); it also reads some words otherwise inside an adduct (‘ethanol—dioxygen (1/1)’ is [O].[O]). So the name is read by OPSIN as a whole with each unread hydrogen word replaced by a word of the same charge that takes no part in that balance (_STAND_IN), and the hydrogens put in place of the stand-ins. OPSIN 2.9.0 reads many adduct names in one component order only (‘ethanol—acetaldehyde (1/1)’ fails, ‘acetaldehyde—ethanol (1/1)’ reads); where it reads none, the components are read one by one and the reading is refused where the balance could change it: a bare element word beside unbalanced ions, a negative mixture with an acid anion named by its suffix, or a multiplied element word.

orthonym.validation.hydrogen_word_read_back.hydrogen_word_round_trip(name, smiles)#

HYDROGEN_WORDS_RULE when OPSIN does not read name and:func:read_back_with_hydrogen_words gives exactly the drawn structure smiles (the same graph with every hydrogen an atom: the same atoms, charges, isotopes, radical electrons and component counts); else None.