Skip to main content

string()

The AMChI string of a species or a transition state (TS).

Usage

Source

string(
    geometry,
    connectivity,
    candidates,
    *,
    stereo=True,
)

A TS has breaking or forming bonds in its connectivity, and its string has the k (breaking) and f (forming) layers, as read in its canonical direction, and an r layer if the given direction is the reverse of that (r1) or not (r0). With stereo=False, the candidates are ignored, and the string has no b, t, m or s layer.

Raises

UnsupportedElementError

A symbol has no element data.

IllDefinedParityError

A stereocenter’s parity is exactly zero.

ValueError
The inputs don’t fit each other: the coordinates aren’t N x 3, a bond names a missing atom, or a candidate’s neighbors aren’t the neighbors of its atom or bond (for a TS: aren’t among them, over the breaking and forming bonds too).

Examples

    >>> import amchi
    >>> from types import SimpleNamespace
    >>> water = SimpleNamespace(
    ...     symbols=["O", "H", "H"],
    ...     coordinates=[[0, 0, 0], [0.96, 0, 0], [-0.24, 0.93, 0]],
    ... )
    >>> connectivity = amchi.Connectivity(bonds=[(0, 1), (0, 2)])
    >>> amchi.string(water, connectivity, amchi.Candidates())
'AMChI=2S/H2O/h1H2'