# Bio.PDB.Vector模块¶

Bio.PDB.vectors.m2rotaxis(m)

Bio.PDB.vectors.vector_to_axis(line, point)

• line (L{Vector}) -- 定义直线的矢量

• point (L{Vector}) -- 定义点的矢量

Bio.PDB.vectors.rotaxis2m(theta, vector)

• theta (float) -- 旋转角度

• vector (L{Vector}) -- 旋转轴

```>>> from numpy import pi
>>> from Bio.PDB.vectors import rotaxis2m
>>> from Bio.PDB.vectors import Vector
>>> m = rotaxis2m(pi, Vector(1, 0, 0))
>>> Vector(1, 2, 3).left_multiply(m)
<Vector 1.00, -2.00, -3.00>
```
Bio.PDB.vectors.rotaxis(theta, vector)

• theta (float) -- 旋转角度

• vector (L{Vector}) -- 旋转轴

```>>> from numpy import pi
>>> from Bio.PDB.vectors import rotaxis2m
>>> from Bio.PDB.vectors import Vector
>>> m = rotaxis2m(pi, Vector(1, 0, 0))
>>> Vector(1, 2, 3).left_multiply(m)
<Vector 1.00, -2.00, -3.00>
```
Bio.PDB.vectors.refmat(p, q)

```>>> from Bio.PDB.vectors import refmat
>>> p, q = Vector(1, 2, 3), Vector(2, 3, 5)
>>> mirror = refmat(p, q)
>>> qq = p.left_multiply(mirror)
>>> print(q)
<Vector 2.00, 3.00, 5.00>
>>> print(qq)
<Vector 1.21, 1.82, 3.03>
```
Bio.PDB.vectors.rotmat(p, q)

• p (L{Vector}) -- 移动矢量

• q (L{Vector}) -- 固定矢量

3x3 Numeric array

```>>> from Bio.PDB.vectors import rotmat
>>> p, q = Vector(1, 2, 3), Vector(2, 3, 5)
>>> r = rotmat(p, q)
>>> print(q)
<Vector 2.00, 3.00, 5.00>
>>> print(p)
<Vector 1.00, 2.00, 3.00>
>>> p.left_multiply(r)
<Vector 1.21, 1.82, 3.03>
```
Bio.PDB.vectors.calc_angle(v1, v2, v3)

v3 (v1, v2,) -- 定义角度的树点

float

Bio.PDB.vectors.calc_dihedral(v1, v2, v3, v4)

v4 (v1, v2, v3,) -- 定义二面角的四个点

class Bio.PDB.vectors.Vector(x, y=None, z=None)

__init__(x, y=None, z=None)

__repr__()

__neg__()

__sub__(other)

__mul__(other)

__truediv__(x)

__pow__(other)

__getitem__(i)

__setitem__(i, value)

__contains__(i)

norm()

normsq()

normalize()

normalized()

angle(other)

get_array()

left_multiply(matrix)

right_multiply(matrix)

copy()

• axis (char) -- 指定旋转轴的字符

Bio.PDB.vectors.homog_trans_mtx(x: float, y: float, z: float) array

z (x, y,) -- 各轴平移

Bio.PDB.vectors.set_homog_trans_mtx(x: float, y: float, z: float, mtx: ndarray)

Bio.PDB.vectors.homog_scale_mtx(scale: float) array

scale (float) -- 比例乘数

Bio.PDB.vectors.get_spherical_coordinates(xyz: array) Tuple[float, float, float]

xyz (array) -- 列向量(3行x 1列数组)

Bio.PDB.vectors.coord_space(a0: ndarray, a1: ndarray, a2: ndarray, rev: bool = False) Tuple[ndarray, Optional[ndarray]]

ACS [0] 关于XZ平面ACS [1] 源ACS [2] 在+Z轴上

• acs (numpy column array x3) -- X、Y、Z列输入坐标x3

• rev (bool) -- 如果为True，还返回反向转换矩阵(从coord_space返回)

4x4数值数组，如果rev=True，则为x2

• entries -- 生成的矩阵的整数个数。