Skip to main content

from_reaction_smiles()

The stereo reaction graph of an atom-mapped reaction SMILES (P62).

Usage

Source

from_reaction_smiles(
    smiles,
    *,
    charge=None,
    spin=None,
)

Atom k is the atom with the k-th smallest map number. Each side is perceived as from_smiles does; without_stereo gives the ReactionGraph. As a reader it also sets the ts slots by the TS-slot rules, as low_t does (P84); where they allow two (the twisted TSs of a rotation), the slot is their LS undetermined.

>>> rxn = from_reaction_smiles("[H:1][H:2].[O:3][H:4]>>[H:1].[H:2][O:3][H:4]")
>>> rxn.symbols

(‘H’, ‘H’, ‘O’, ‘H’)

>>> rxn.breaking, rxn.forming

(((0, 1),), ((1, 2),))

Parameters

smiles: str

A reaction SMILES “reactants>>products” with no agents, in which every atom, H included, is written and mapped, and both sides have the same map numbers.

charge: int | None = None

Checked against the sum of formal charges on each side; default: that sum.

spin: int | None = None
Unpaired electrons (2S); default: the lower of the two sides’ radical electron counts (from_smiles’s default).

Raises

GraphError
For a SMILES that isn’t a reaction SMILES or that RDKit can’t parse, agents, an unmapped atom or implicit H, a map number used twice on a side, sides with different map numbers, symbols or charges, or a charge or spin from_smiles rejects.