molgri.space.rotations
Conversions rotations <-> grid points.
Functions
|
Returns a (N, d, d) array in which each 'row' is an identity matrix. |
|
See grid2rotation; this function only reformats the output as a (N, 4) array of quaternions. |
|
Re-create a rotational object by using the (saved) grid_x, grid_y and grid_z projections. We are looking for an array of rotational matrices R that achieve R[i] (1, 0, 0)^T = grid_x[i] R[i] (0, 1, 0)^T = grid_y[i] R[i] (0, 0, 1)^T = grid_z[i] for each i in range(len(grids)). It is easy to show that. |
|
See rotation2grid function. |
|
Convert a series of N rotational objects (represented as a scipy object Rotation) to three grids by applying the rotations to a unit vectors in x, y, z directions. |
|
|
|
Take a vector or an array of vectors and return its skew matrix/matrices. |
|
Take vectors x and y (or arrays of vectors with the same number of elements and return the rotational matrix that transforms x into y. |
- molgri.space.rotations.rotation2grid(rotations: Rotation) Tuple[ndarray[Any, dtype[ScalarType]], ...]
Convert a series of N rotational objects (represented as a scipy object Rotation) to three grids by applying the rotations to a unit vectors in x, y, z directions. The grids can be saved and converted to a rotational object later if needed or used in grid form to get positional grids in spherical coordinates.
- Args:
rotations: a series of N rotational objects (represented as a scipy object Rotation)
- Returns:
a tuple of three numpy arrays, each of shape (N, 3)
- molgri.space.rotations.rotation2grid4vector(rotations: Rotation, vector: ndarray[Any, dtype[ScalarType]] | None = None) ndarray[Any, dtype[ScalarType]]
- molgri.space.rotations.quaternion2grid(quaternions: ndarray[Any, dtype[ScalarType]]) Tuple[ndarray[Any, dtype[ScalarType]], ...]
See rotation2grid function. This is only a helper function that parsers quaternions as inputs.
- molgri.space.rotations.grid2rotation(grid_x: ndarray[Any, dtype[ScalarType]], grid_y: ndarray[Any, dtype[ScalarType]], grid_z: ndarray[Any, dtype[ScalarType]]) Rotation
Re-create a rotational object by using the (saved) grid_x, grid_y and grid_z projections. We are looking for an array of rotational matrices R that achieve
R[i] (1, 0, 0)^T = grid_x[i] R[i] (0, 1, 0)^T = grid_y[i] R[i] (0, 0, 1)^T = grid_z[i]
for each i in range(len(grids)). It is easy to show that
grid_x[i][0] grid_y[i][0] grid_z[i][0]
- R[i] = grid_x[i][1] grid_y[i][1] grid_z[i][1]
grid_x[i][2] grid_y[i][2] grid_z[i][2]
- Args:
grid_x: an array (N, 3) where each row is a coordinate on a 3D sphere created by projecting rotation on 1, 0, 0 grid_y: an array (N, 3) where each row is a coordinate on a 3D sphere created by projecting rotation on 0, 1, 0 grid_z: an array (N, 3) where each row is a coordinate on a 3D sphere created by projecting rotation on 0, 0, 1
- Returns:
a list of length N where each element is a rotational object
- molgri.space.rotations.grid2quaternion(grid_x: ndarray[Any, dtype[ScalarType]], grid_y: ndarray[Any, dtype[ScalarType]], grid_z: ndarray[Any, dtype[ScalarType]]) ndarray[Any, dtype[ScalarType]]
See grid2rotation; this function only reformats the output as a (N, 4) array of quaternions.
- molgri.space.rotations.skew(x: ndarray[Any, dtype[ScalarType]]) ndarray[Any, dtype[ScalarType]]
Take a vector or an array of vectors and return its skew matrix/matrices.
- Args:
x: a vector (3,) or (N, 3)
- Returns:
skew matrix, see structure below
- molgri.space.rotations.two_vectors2rot(x: ndarray[Any, dtype[ScalarType]], y: ndarray[Any, dtype[ScalarType]]) ndarray[Any, dtype[ScalarType]]
Take vectors x and y (or arrays of vectors with the same number of elements and return the rotational matrix that transforms x into y.
- Args:
x: an array of shape (3,), first vector, or an array of vectors of size (N, 3) y: an array of shape (3,), second vector, or an array of vectors of size (N, 3)
- Returns:
a 3x3 rotational matrix
- molgri.space.rotations.N_eye_matrices(N, d=3)
Returns a (N, d, d) array in which each ‘row’ is an identity matrix.
- Args:
N: number of rows d: dimension of the identity matrix
Returns: