Skip to main content

embed()

A 3D geometry of the graph, in its atom order, with its charge and spin.

Usage

Source

embed(gra)

RDKit’s ETKDG embeds a Lewis structure of the graph (_lewis), with each determined Tetrahedral (lone-pair centres included) as a chiral tag and each determined PlanarBond on a double bond as cis/trans bond stereo. Every determined LS is then read back from the coordinates, so from_geometry(embed(gra)) has the same LS. An LS ETKDG can’t hold (a radical’s planar bond, a chain LS) is met by embedding again with the next random seed. Undetermined LS take whatever configuration comes out. The seeds are fixed, so the result is reproducible. The fragments of a disconnected graph are set 3 Å apart.

>>> from protomol import examples, from_geometry
>>> gra = examples.species()
>>> geo = embed(gra)
>>> geo.symbols == list(gra.symbols), geo.coordinates.shape

(True, (16, 3))

>>> from_geometry(geo) == gra

True

Raises

TypeError

For a reaction graph.

GraphError
If no Lewis structure fits the graph, or no embedding meets its LS.