## grid


[grid](grid.md#tetramol.grid)


Usage


The tetrahedral grid: ideal bond directions, angles, and lengths.


## Attributes

| Name | Description |
|----|----|
| [TETRAHEDRAL_ANGLE](#TETRAHEDRAL_ANGLE) | The ideal tetrahedral angle, arccos(-1/3) (about 109.47 degrees), in radians. |
| [XH_LENGTH](#XH_LENGTH) | Ideal bond length to hydrogen, in Angstroms. |
| [XY_LENGTH](#XY_LENGTH) | Ideal bond length between heavy atoms, in Angstroms. |

------------------------------------------------------------------------


#### TETRAHEDRAL_ANGLE


The ideal tetrahedral angle, arccos(-1/3) (about 109.47 degrees), in radians.


`TETRAHEDRAL_ANGLE=float(np.arccos(-1 / 3))`


------------------------------------------------------------------------


#### XH_LENGTH


Ideal bond length to hydrogen, in Angstroms.


`XH_LENGTH=``1.1`


------------------------------------------------------------------------


#### XY_LENGTH


Ideal bond length between heavy atoms, in Angstroms.


`XY_LENGTH=``1.5`


## Functions

| Name | Description |
|----|----|
| [tetrahedral_basis()](#tetrahedral_basis) | Get the four bond directions of a tetrahedral grid. |

------------------------------------------------------------------------


#### tetrahedral_basis()


Get the four bond directions of a tetrahedral grid.


Usage

``` python
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.

tetrahedral angle.


##### Raises


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


## Examples

``` python
    >>> basis = tetrahedral_basis()
    >>> basis.round(6).tolist()[:2]
```

    [[0.0, 0.0, 1.0], [-0.942809, 0.0, -0.333333]]
