mindsponge.common.make_transform_from_reference

View Source On Gitee
mindsponge.common.make_transform_from_reference(point_a, point_b, point_c)[source]

Using GramSchmidt process to construct rotation and translation from given points.

Calculate the rotation matrix and translation meets

  1. point_b is the original point.

  2. point_c is on the x_axis.

  3. the plane a-b-c is on the x-y plane.

v1=x3x2v2=x1x2e1=v1/||v1||u2=v2e1(e1Tv2)e2=u2/||u2||e3=e1×e2rotation=(e1,e2,e3)translation=(x2)
Parameters
  • point_a (float, tensor) -> (tensor) – Spatial location information of atom 'N', shape is [...,Nres,3] .

  • point_b (float, tensor) -> (tensor) – Spatial location information of atom 'CA', shape is [...,Nres,3] .

  • point_c (float, tensor) -> (tensor) – Spatial location information of atom 'C', shape is [...,Nres,3] .

Returns

  • Tuple, rots (xx,xy,xz,yx,yy,yz,zx,zy,zz) , the shape of every element is (...,Nres) .

  • Tuple, trans (x,y,z) , the shape of every element is (...,Nres) .

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> import mindspore as ms
>>> from mindspore import Tensor
>>> from mindsponge.common.geometry import make_transform_from_reference
>>> input_0 = Tensor(np.ones((4, 256, 3)), ms.float32)
>>> input_1 = Tensor(np.ones((4, 256, 3)), ms.float32)
>>> input_2 = Tensor(np.ones((4, 256, 3)), ms.float32)
>>> rots, trans = make_transform_from_reference(input_0, input_1, input_2)
>>> print(len(rots), rots[0].shape, len(trans), trans[0].shape)
9, (4, 256), 3, (4, 256)