orthonym.rules.amides#
Note
Internal API. Names and behaviour may change between releases.
Amide naming rules for IUPAC nomenclature.
Amide naming follows these patterns: - Primary amides: stem + ‘amide’ (acetamide, propanamide) - Secondary amides: N-substituent + stem + ‘amide’ (N-methylacetamide) - Tertiary amides: N,N-disubstituent + stem + ‘amide’ (N,N-dimethylacetamide) - Ring-attached amides: parent + ‘carboxamide’ (cyclohexanecarboxamide)
Based on IUPAC 2013 Blue Book.
- orthonym.rules.amides.get_amide_type(mol, amide_atoms)#
Determine if an amide is primary, secondary, or tertiary.
The amide nitrogen determines the type: - Primary: -C(=O)NH2 (N has 2 hydrogens) - Secondary: -C(=O)NHR (N has 1 hydrogen, 1 substituent) - Tertiary: -C(=O)NR2 (N has 0 hydrogens, 2 substituents)
- Parameters:
mol – RDKit Mol object
amide_atoms (tuple) – Atom indices from amide SMARTS match
- Returns:
“primary”, “secondary”, or “tertiary”
- Return type:
str
- orthonym.rules.amides.get_n_substituents(mol, amide_atoms)#
Get substituents attached to the amide nitrogen.
For secondary/tertiary amides, find the carbon substituents attached to nitrogen (not the carbonyl carbon).
- Parameters:
mol – RDKit Mol object
amide_atoms (tuple) – Atom indices from amide SMARTS match
- Returns:
List of dicts – [{“atoms”: [atom_indices], “name”: “methyl”},…]
- Return type:
List[Dict]
- orthonym.rules.amides.format_n_substitution(substituents)#
Format N-substituents as IUPAC prefix.
Rules: - Single substituent: “N-methyl” - Two identical: “N,N-dimethyl” - Two different: “N-ethyl-N-methyl” (alphabetized)
- Parameters:
substituents (List[Dict]) – List of dicts from get_n_substituents
- Returns:
Formatted N-substitution prefix (e.g., “N-methyl”, “N,N-dimethyl”), or
Noneif any substituent name is a refusal sentinel (M2 Task 3 splice guard, below) – never a string containing the sentinel.- Return type:
str | None
- orthonym.rules.amides.is_ring_attached_amide(mol, amide_atoms)#
Check if an amide is attached to a ring.
A ring-attached amide has its carbonyl carbon directly bonded to a ring carbon. These use -carboxamide suffix.
- Parameters:
mol – RDKit Mol object
amide_atoms (tuple) – Atom indices from amide SMARTS match
- Returns:
True if the amide is ring-attached
- Return type:
bool
- orthonym.rules.amides.get_amide_chain_length(mol, amide_atoms)#
Get the chain length for an amide (including carbonyl carbon).
Works for regular amides (=O) and a phase chalcogen amides (=S thioamide / =Se selenoamide / =Te telluroamide) per +.
The chain length determines the parent name: - 1: formamide / methanethioamide / methaneselenoamide - 2: acetamide / ethanethioamide / ethaneselenoamide - 3: propanamide / propanethioamide / propaneselenoamide etc.
- Parameters:
mol – RDKit Mol object
amide_atoms (tuple) – Atom indices from amide SMARTS match
- Returns:
Chain length (number of carbons in parent chain)
- Return type:
int
- orthonym.rules.amides.get_amide_parent_name(chain_length, is_ring=False, suffix_form='amide')#
Get the parent amide name based on chain length and suffix form.
- Parameters:
chain_length (int) – Number of carbons in parent chain
is_ring (bool) – If True, use -carboxamide form
suffix_form (str) –
- One of “amide”, “thioamide”, “selenoamide”, “telluroamide”
functional replacement). For chalcogen forms
the IUPAC PIN preserves the parent-stem terminal ‘e’ (e.g., ‘propanethioamide’) because the suffix starts with a consonant.
- Returns:
Parent amide name (e.g., “formamide”, “acetamide”, “propanamide”, “ethanethioamide”, “propaneselenoamide”).
- Return type:
str
- class orthonym.rules.amides.RingAmideParts(ring_hydride, suffix, retained, n_substituents)#
Bases:
objectThe structural parts of a ring carboxamide name (branch review fixes).
ring_hydride(‘cyclohexane’) andsuffix(‘carboxamide’, ‘carbothioamide’) for a saturated cycloalkane, or the retainedbenzamide;n_substituentsasget_n_substituentsreturns them (empty for a primary amide). A composer assembles the name from these parts – never by cutting an emitted name apart.- ring_hydride#
- suffix#
- retained#
- n_substituents#
- parent_word(suffix_locant=False)#
The parent word.
suffix_locant: a ring prefix is cited as well, so the suffix keeps its locant, the Blue Book “… then all locants must be cited”): ‘cyclohexane-1-carboxamide’; alone it is omitted(c),:2891): ‘cyclohexanecarboxamide’. The retained ‘benzamide’
numbers its carbonyl-bearing carbon 1 and cites no suffix locant.
- orthonym.rules.amides.ring_amide_parts(mol, amide_atoms, suffix_form='amide')#
RingAmidePartsfor a ring-attached amidename_amidecan spell, else None (seename_amide).
- orthonym.rules.amides.name_amide(mol, amide_atoms, suffix_form='amide')#
Generate IUPAC name for an amide compound.
Handles: - Primary amides: acetamide - Secondary amides: N-methylacetamide - Tertiary amides: N,N-dimethylacetamide; dimethylformamide (a formamide with the same group on both N-H cites no N locants) - Ring-attached amides: cyclohexanecarboxamide - a phase chalcogen amides (suffix_form=”thioamide”/”selenoamide”/”telluroamide”):
ethanethioamide, N-methylpropaneselenoamide, etc.
- Parameters:
mol – RDKit Mol object
amide_atoms (tuple) – Atom indices from amide SMARTS match
suffix_form (str) – PIN suffix variant — “amide” (default) or chalcogen analog (“thioamide” / “selenoamide” / “telluroamide”, per.
- Returns:
IUPAC name for the amide
- Return type:
str | None
- orthonym.rules.amides.name_chain_diamide(mol, all_amide_matches, chain, atom_to_locant)#
Name an acyclic chain diamide with optional N-substituents (D3).
Handles the mixed primary + N-substituted (and symmetric primary / symmetric secondary) acyclic diamide class per BB (parent =
{stem}anediamide) and (N-substituents cited asN{locant}prefixes where the locant is the chain-carbon locant of the amide carbonyl; identical substituents on both ends give theN1,N4-di...form).Fail-closed: returns
None(so the caller falls through to the existing polyfunctional / general_acyclic path unchanged) whenever any precondition is not met, or any N-substituent cannot be named.- Parameters:
mol – RDKit Mol object.
all_amide_matches (List[tuple]) – list of amide SMARTS match tuples (primary and/or secondary), carbonyl carbon at tuple index 0.
chain (List[int]) – the principal chain atom-index list (the diamide backbone).
atom_to_locant (Dict[int, int]) – mapping from chain atom index -> locant.
- Returns:
The PIN name string, or
None(fail-closed).- Return type:
str | None