Skip to main content

twist_angle()

Find the twist about a bond that turns one direction onto another.

Usage

Source

twist_angle(
    geo,
    keys,
    vec,
    target,
    *,
    degrees=False,
)

Both directions are projected onto the plane perpendicular to the bond, and the result is the signed angle between the projections, so that twist(geo, keys, twist_angle(geo, keys, vec, target)) turns vec (as part of the moving group) to point as close as possible to target.

Parameters

geo: Geometry

Geometry.

keys: Sequence[int]

The bond, (i, j), as for twist.

vec: ArrayLike

Direction attached to the moving group, e.g. a bond direction.

target: ArrayLike

Direction to turn it toward.

degrees: bool = False
If True, return the angle in degrees instead of radians.

Returns

float
The angle, between -pi and pi (or -180 and 180 degrees).

Raises

ValueError
If vec or target is parallel to the bond.