Vector

class Vector.Vector(x, y, z)[source]

A class representing Cartesian 3-dimensonal vectors.

arg(vector)[source]

Return the argument (angle) between this and another vector.RAD

copy()[source]
Return:
A copy of Vector instance
cross(vector)[source]
Return:
A Vector instance of the cross product of this and another vector specified as input parameter
dist(vector)[source]
Return:
The distance between this and another vector specified as input parameter.
dot(vector)[source]
Return:
The dot product of this and another vector specified as input parameter.
matrix_transform(rot_mat)[source]

Transform the vector using a transformation matrix.

Arguments:
rot_mat
a 3x3 Python matrix instance.
Return:
A vector instance
mod()[source]
Return:
The modulus (length) of the vector.
reverse()[source]

Flip the direction of a Vector instance.

Return:
A Vector instance
times(factor)[source]

Multiplies a Vector instance by a scalar factor.

Return:
A Vector instance
to_atom()[source]

Create an Atom instance based on Vector instance.

Return:
Atom instance
translate(x, y, z)[source]

Translate a Vector instance.

Arguments:
x, y, z
distance in Angstroms in respective Cartesian directions to translate vector.
Return:
Vector instance.
unit()[source]
Return:
Vector instance of a unit vector.
Vector.align_2seqs(seq1, seq2)[source]
Vector.altTorsion(a, b, c)[source]

An alternate and better way to find the torsion angle between planes ab and bc.

Arguments:
a,b,c
Vector instances.
Return:
The torsion angle (radians)
Vector.axis_angle_to_euler(x, y, z, turn, rad=False)[source]

Converts the axis angle rotation to an Euler form.

Arguments:
x, y, z
axis of rotation (does not need to be normalised).
turn
angle of rotation, in radians if rad=True, else in degrees.
Returns:
A 3-tuple (x,y,z) containing the Euler angles. .
Vector.axis_angle_to_matrix(x, y, z, turn, rad=False)[source]

Converts the axis angle rotation to a matrix form.

Arguments:
x, y, z
axis of rotation (does not need to be normalised).
turn
angle of rotation, in radians if rad=True, else in degrees.
Return:
A 3X3 transformation matrix.
Vector.calcMtrx(arr)[source]

Calculate 3 x 4 transformation matrix from Euler angles and offset. Arguments:

arr
[psi,theta,phi,offsetx,offsety,offsetz].
Returns:
3 x 4 transformation matrix
Vector.cps(mat_1, mat_2)[source]

Find rotation and translation difference between two transformations. Arguments:

mat_1,mat_2
Transformation matrices.
Returns:
The translation and rotation differences
Vector.euler_to_matrix(x_turn, y_turn, z_turn, rad=False)[source]

Converts an euler rotation to a matrix form.

Arguments:
x_turn, y_turn, z_turn
rotation angles around respective axis, in radians if rad=True, else in degrees.
Return:
A 3X3 transformation matrix.
Vector.random_vector(min_v, max_v)[source]

Generate a random vector. The values for the vector component x, y, and z are randomly sampled between minimum and maximum values specified.

Argument:
min_v, max_v
minimum and maximum value
Return:
A Vector instance.
Vector.random_vector2(ul_list)[source]
Vector.torsion(a, b, c)[source]

Find the torsion angle between planes ab and bc.

Arguments:

a,b,c
Vector instances.
Returns:
The torsion angle in radians