tetrahedral_basis()

Get the four bond directions of a tetrahedral grid.

Usage

Source

tetrahedral_basis(
    up=(0.0, 0.0, 1.0),
    left=(-1.0, 0.0, 0.0),
)

Direction 0 points along up. Direction 1 lies in the plane of up and left, on the side of left. Directions 2 and 3 follow by rotating direction 1 about up by 120 and 240 degrees (counterclockwise, looking down from the tip of up).

Parameters

up: ArrayLike = (0.0, 0.0, 1.0)

Direction 0.

left: ArrayLike = (-1.0, 0.0, 0.0)
Direction in the plane of directions 0 and 1. Only its component perpendicular to up matters.

Returns

np.ndarray

Unit vectors, one per row, shape (4, 3). Each pair makes the

tetrahedral angle.

Raises

ValueError
If up is zero or left is parallel to up.

Examples

    >>> basis = tetrahedral_basis()
    >>> basis.round(6).tolist()[:2]
[[0.0, 0.0, 1.0], [-0.942809, 0.0, -0.333333]]