Package Bio :: Package PDB :: Module Vector'
[hide private]
[frames] | no frames]

Module Vector'

source code

Vector class, including rotation-related functions.

Classes [hide private]
  Vector
3D vector
Functions [hide private]
float
calc_angle(v1, v2, v3)
Calculate the angle between 3 vectors representing 3 connected points.
source code
 
calc_dihedral(v1, v2, v3, v4)
Calculate the dihedral angle between 4 vectors representing 4 connected points.
source code
 
m2rotaxis(m)
Return angles, axis pair that corresponds to rotation matrix m.
source code
 
refmat(p, q)
Return a (left multiplying) matrix that mirrors p onto q.
source code
 
rotaxis(theta, vector)
Calculate a left multiplying rotation matrix that rotates theta rad around vector.
source code
 
rotaxis2m(theta, vector)
Calculate a left multiplying rotation matrix that rotates theta rad around vector.
source code
3x3 Numeric array
rotmat(p, q)
Return a (left multiplying) matrix that rotates p onto q.
source code
 
vector_to_axis(line, point)
Returns the vector between a point and the closest point on a line (ie.
source code
Variables [hide private]
  arccos = <ufunc 'arccos'>
  cos = <ufunc 'cos'>
  pi = 3.14159265359
  sin = <ufunc 'sin'>
  sqrt = <ufunc 'sqrt'>
Function Details [hide private]

calc_angle(v1, v2, v3)

source code 

Calculate the angle between 3 vectors representing 3 connected points.

Parameters:
  • v1, v2, v3 - the tree points that define the angle
Returns: float
angle

calc_dihedral(v1, v2, v3, v4)

source code 

Calculate the dihedral angle between 4 vectors representing 4 connected points. The angle is in ]-pi, pi].

Parameters:
  • v1, v2, v3, v4 - the four points that define the dihedral angle

refmat(p, q)

source code 

Return a (left multiplying) matrix that mirrors p onto q.

Example:

>>> mirror=refmat(p,q)
>>> qq=p.left_multiply(mirror)
>>> print q, qq # q and qq should be the same
Parameters:
Returns:
The mirror operation, a 3x3 Numeric array.

rotaxis(theta, vector)

source code 

Calculate a left multiplying rotation matrix that rotates theta rad around vector.

Example:

>>> m=rotaxis(pi, Vector(1,0,0))
>>> rotated_vector=any_vector.left_multiply(m)
Parameters:
  • theta (float) - the rotation angle
  • vector (Vector) - the rotation axis
Returns:
The rotation matrix, a 3x3 Numeric array.

rotaxis2m(theta, vector)

source code 

Calculate a left multiplying rotation matrix that rotates theta rad around vector.

Example:

>>> m=rotaxis(pi, Vector(1,0,0))
>>> rotated_vector=any_vector.left_multiply(m)
Parameters:
  • theta (float) - the rotation angle
  • vector (Vector) - the rotation axis
Returns:
The rotation matrix, a 3x3 Numeric array.

rotmat(p, q)

source code 

Return a (left multiplying) matrix that rotates p onto q.

Example:

>>> r=rotmat(p,q)
>>> print q, p.left_multiply(r)
Parameters:
Returns: 3x3 Numeric array
rotation matrix that rotates p onto q

vector_to_axis(line, point)

source code 

Returns the vector between a point and the closest point on a line (ie. the perpendicular projection of the point on the line).

Parameters:
  • line (Vector) - vector defining a line
  • point (Vector) - vector defining the point