coord_to_fraction
#
- biotite.structure.coord_to_fraction(coord, box)[source]#
Transform coordinates to fractions of box vectors.
- Parameters:
- coordndarray, dtype=float, shape=(n,3) or shape=(m,n,3)
The coordinates for one or multiple models.
- boxndarray, dtype=float, shape=(3,3) or shape=(m,3,3)
The box(es) for one or multiple models. When coord is given for multiple models,
box
must be given for multiple models as well.
- Returns:
- fractionndarray, dtype=float, shape=(n,3) or shape=(m,n,3)
The fractions of the box vectors.
See also
Examples
>>> box = np.array([[5,0,0], [0,5,0], [0,5,5]], dtype=float) >>> coord = np.array( ... [[1,1,1], [10,0,0], [0,0,10], [-5,2,1]], ... dtype=float ... ) >>> print(coord) [[ 1. 1. 1.] [10. 0. 0.] [ 0. 0. 10.] [-5. 2. 1.]] >>> fractions = coord_to_fraction(coord, box) >>> print(fractions) [[ 0.2 0.0 0.2] [ 2.0 0.0 0.0] [ 0.0 -2.0 2.0] [-1.0 0.2 0.2]]