Skip to main content

geom.dihedrals()

List dihedral angles.

Usage

Source

geom.dihedrals(
    geo,
    amat,
)

Parameters

geo: Geometry

Geometry.

amat: ArrayLike
Adjacency matrix.

Returns

np.ndarray

Sorted rows [z1, z2, z3, z4, phi] with phi in radians, shape

(ndihedrals, 5). Each row is oriented so that

(z1, z2, z3, z4) <= (z4, z3, z2, z1), which leaves phi unchanged.

Examples

    >>> geo = Geometry(
    ...     symbols=["H", "O", "O", "H"],
    ...     coordinates=[[0, 0, 1], [0, 0, 0], [0, 1, 0], [1, 1, 0]],
    ...     charge=0,
    ...     spin=0,
    ... )
    >>> amat = np.array(
    ...     [[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]
    ... )
    >>> d = dihedrals(geo, amat)
    >>> d.shape
(1, 5)
    >>> [float(x) for x in d[0][:4]]
[1.0, 8.0, 8.0, 1.0]
    >>> round(float(d[0][-1]), 6)
1.570796