# 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.
`rotate_atoms_around_y_axis`(theta) | Get rotation matrix for y-axis.
`rotate_atoms_around_z_axis`(theta) | Get rotation matrix for z-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.
`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)

  A 4-by-4 matrix class.

class propka.vector_algebra.Vector(xi: float = 0.0, yi: float = 0.0, zi: float = 0.0, atom1: _XYZ | None = None, atom2: _XYZ | None = None)
  cross(other: _XYZ)

    Cross product.

  length() → float

    Return vector length.

  orthogonal()

    Returns a vector orthogonal to self

  rescale(new_length: float)

    Rescale vector to new length while preserving direction

  sq_length()

    Return vector squared-length

propka.vector_algebra.angle(avec: Vector, bvec: Vector) → float

  Get the angle between two vectors.

  Parameters:

    - avec – vector 1

    - bvec – vector 2

  Returns:

    angle in radians

propka.vector_algebra.angle_degrees(avec: Vector, bvec: Vector) → float

  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: float) → Matrix4x4

  Get rotation matrix for y-axis.

  Parameters:

    theta – angle of rotation (radians)

  Returns:

    rotation matrix

propka.vector_algebra.rotate_atoms_around_z_axis(theta: float) → Matrix4x4

  Get rotation matrix for z-axis.

  Parameters:

    theta – angle of rotation (radians)

  Returns:

    rotation matrix

propka.vector_algebra.rotate_vector_around_an_axis(theta: float, axis: Vector, vec: Vector) → Vector

  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: Vector, bvec: Vector, axis: Vector) → float

  Get signed angle of two vectors around axis in radians.

  Parameters:

    - avec – vector 1

    - bvec – vector 2

    - axis – axis

  Returns:

    angle in radians