mindsponge.common.initial_affine

mindsponge.common.initial_affine(num_residues, use_numpy=False)[source]

Initialize quaternion, rotation, translation of affine.

Parameters
  • num_residues (int) – Number of residues.

  • use_numpy (bool) – Whether to use numpy. Default: False.

Returns

result after quat affine. - quaternion, tensor, shape is \((N_{res}, 4)\) . - rotation, tuple, \((xx, xy, xz, yx, yy, yz, zx, zy, zz)\), shape of every element is \((N_{res}, )\) . - translation, tuple, \((x, y, z)\) shape of every element tensor is \((N_{res}, )\) .

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> import mindspore as ms
>>> from mindspore import Tensor
>>> from mindsponge.common.geometry import initial_affine
>>> output = initial_affine(256)
>>> print(len(output), output[0].shape, len(output[1]), len(output[1][0]), len(output[2]), len(output[2][0]))
>>> print(output[0])
>>> print(output[1])
>>> print(output[2])
3, (1, 4), 9, 1, 3, 1
[[1.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]]
(1, 0, 0, 0, 1, 0, 0, 0, 1)
([0.00000000e+00], [0.00000000e+00], [0.00000000e+00])