from_smiles()
The stereo graph of a SMILES, with every atom explicit (stereomol’s index rule).
Usage
from_smiles(
smiles,
charge=None,
spin=None,
)The atoms are the SMILES atoms in SMILES order, [H] atoms included where they are written, then the implicit H in the order of the atoms they’re bonded to.
Stereo uses the low-T scheme. Sites whose two configurations give the same graph get a fixed parity. Stereo elements the SMILES leaves unspecified stay undetermined (parity None) until stereoisomers. A cumulated chain gets one LS on its ends, a PlanarBond or an AtropBond with the inner atoms as its chain. A cumulene’s / and \ are read as a double bond’s (C/C=C=C=C/C is trans); allene stereo has no RDKit reading, so it is never determined by the SMILES. A double bond or chain has stereo only if neither end is sp (linear).
>>> gra = from_smiles("[H]OC")
>>> gra.symbols(‘H’, ‘O’, ‘C’, ‘H’, ‘H’, ‘H’)
>>> gra.atom_stereo[0].parity # C2's Tetrahedral is trivial, so it's filled1
Parameters
smiles: str-
A species SMILES; may have several fragments (“CC.[OH]”).
charge: int | None = None-
Checked against the sum of formal charges; default: that sum.
spin: int | None = None- Unpaired electrons (2S); default: RDKit’s radical-electron count (maximal pairing, then Hund’s rule per atom: [CH2] and [O] → 2; O=O → 0).
Raises
GraphError- For an unparsable SMILES, a reaction SMILES (use from_reaction_smiles, or ts_graphs for unmapped sides), a charge that differs from the formal charges, or a spin of the wrong parity.