# propka.vector_algebra¶

## Vector calculations¶

Vector algebra for PROPKA.

Functions

 `angle`(avec, bvec) Get the angle between two vectors. `angle_degrees`(avec, bvec) Get the angle between two vectors in degrees. Get rotation matrix for y-axis. Get rotation matrix for z-axis. `rotate_multi_vector_around_an_axis`(theta, ...) Rotate a multi-vector around an axis. `rotate_vector_around_an_axis`(theta, axis, vec) Rotate vector around an axis. `signed_angle_around_axis`(avec, bvec, axis) Get signed angle of two vectors around axis in radians.

Classes

 `Matrix4x4`([a11i, a12i, a13i, a14i, a21i, ...]) A 4-by-4 matrix class. `MultiVector`([atom1, atom2]) Collection of vectors for multiple configurations of atoms. `Vector`([xi, yi, zi, atom1, atom2])
class propka.vector_algebra.Matrix4x4(a11i=0.0, a12i=0.0, a13i=0.0, a14i=0.0, a21i=0.0, a22i=0.0, a23i=0.0, a24i=0.0, a31i=0.0, a32i=0.0, a33i=0.0, a34i=0.0, a41i=0.0, a42i=0.0, a43i=0.0, a44i=0.0)[source]

A 4-by-4 matrix class.

class propka.vector_algebra.MultiVector(atom1=None, atom2=None)[source]

Collection of vectors for multiple configurations of atoms.

TODO - this class does not appear to be used or covered by tests

do_job(job)[source]

Append vectors to configuration.

Parameters

job – name of function to apply to vectors

Returns

TODO - figure out what this is

generic_operation(operation, other)[source]

Perform a generic operation between two MultiVector objects.

Parameters
• operation – operation to perform (string)

• other – other MultiVector object

static generic_self_operation(_)[source]

TODO - delete this.

property get_result

Return the latest result.

rescale(new_length)[source]

Rescale multi-vector to new length.

Parameters

new_length – new length for multi-vector

Result:

MultiVector object

class propka.vector_algebra.Vector(xi=0.0, yi=0.0, zi=0.0, atom1=None, atom2=None)[source]
length()[source]

Return vector length.

orthogonal()[source]

Returns a vector orthogonal to self

rescale(new_length)[source]

Rescale vector to new length while preserving direction

sq_length()[source]

Return vector squared-length

propka.vector_algebra.angle(avec, bvec)[source]

Get the angle between two vectors.

Parameters
• avec – vector 1

• bvec – vector 2

Returns

propka.vector_algebra.angle_degrees(avec, bvec)[source]

Get the angle between two vectors in degrees.

Parameters
• avec – vector 1

• bvec – vector 2

Returns

angle in degrees

propka.vector_algebra.rotate_atoms_around_y_axis(theta)[source]

Get rotation matrix for y-axis.

Parameters

theta – angle of rotation (radians)

Returns

rotation matrix

propka.vector_algebra.rotate_atoms_around_z_axis(theta)[source]

Get rotation matrix for z-axis.

Parameters

theta – angle of rotation (radians)

Returns

rotation matrix

propka.vector_algebra.rotate_multi_vector_around_an_axis(theta, axis, vec)[source]

Rotate a multi-vector around an axis.

NOTE - both axis ans v must be MultiVectors.

Parameters
• theta – angle (in radians)

• axis – multi-vector axis

• vec – multi-vector vector

propka.vector_algebra.rotate_vector_around_an_axis(theta, axis, vec)[source]

Rotate vector around an axis.

Parameters
• theta – rotation angle (in radians)

• axis – axis for rotation

• vec – vector to rotate

Returns

rotated vector

propka.vector_algebra.signed_angle_around_axis(avec, bvec, axis)[source]

Get signed angle of two vectors around axis in radians.

Parameters
• avec – vector 1

• bvec – vector 2

• axis – axis

Returns