orthonym.rules.nitriles#
Note
Internal API. Names and behaviour may change between releases.
Nitrile naming rules for IUPAC nomenclature.
Nitrile naming follows these patterns: - Chain-terminal nitriles: stem + ‘nitrile’ (acetonitrile, propanenitrile) - Ring-attached nitriles: parent + ‘carbonitrile’ (cyclohexanecarbonitrile)
The nitrile carbon (C of -C#N) IS counted in the chain length.
Based on IUPAC 2013 Blue Book.
- orthonym.rules.nitriles.is_ring_attached_nitrile(mol, nitrile_atoms)#
Check if a nitrile group is directly attached to a ring.
A ring-attached nitrile is one where the nitrile carbon (C of -C#N) is directly bonded to a ring carbon. These use the -carbonitrile suffix.
- Parameters:
mol – RDKit Mol object
nitrile_atoms (tuple) – Atom indices from nitrile SMARTS match [CX2]#[NX1] where index 0 is the carbon
- Returns:
True if the nitrile carbon is attached to a ring atom
- Return type:
bool
- orthonym.rules.nitriles.get_nitrile_parent_chain(mol, nitrile_atoms, principal_chain=None)#
Get the parent chain for a chain-terminal nitrile.
For chain-terminal nitriles, the chain includes the nitrile carbon. The nitrile carbon is ALWAYS position 1 (terminal).
- Parameters:
mol – RDKit Mol object
nitrile_atoms (tuple) – Atom indices from nitrile SMARTS match
principal_chain (List[int] | None) – Optional pre-computed principal chain
- Returns:
List of atom indices representing the parent chain The nitrile carbon will be at index 0 (position 1 in naming)
- Return type:
List[int]
- orthonym.rules.nitriles.get_ring_parent_name(mol, ring_atoms)#
Get the parent name for a ring attached to a nitrile.
- Parameters:
mol – RDKit Mol object
ring_atoms (tuple) – Atom indices of the ring
- Returns:
Ring parent name (e.g., “cyclohexane”, “cyclopentane”)
- Return type:
str
- orthonym.rules.nitriles.name_nitrile(mol, nitrile_atoms, parent_name=None, chain_length=None, is_ring=None)#
Generate IUPAC name for a nitrile compound.
- Parameters:
mol – RDKit Mol object
nitrile_atoms (tuple) – Atom indices from nitrile SMARTS match
parent_name (str | None) – Optional ring parent name (e.g., “cyclohexane”)
chain_length (int | None) – Optional chain length (if known)
is_ring (bool | None) – Optional flag if nitrile is ring-attached
- Returns:
IUPAC name for the nitrile (e.g., “propanenitrile”, “cyclohexanecarbonitrile”)
- Return type:
str
- orthonym.rules.nitriles.get_nitrile_locant(nitrile_atoms, atom_to_locant)#
Get the locant for a nitrile group.
For chain-terminal nitriles, the locant is always 1 (implicit). For nitriles as prefixes (cyano-), we need the chain position.
- Parameters:
nitrile_atoms (tuple) – Atom indices from nitrile SMARTS match
atom_to_locant (dict) – Mapping from atom index to chain locant
- Returns:
Locant position or None if not on chain
- Return type:
int | None