SingleVector#

With the SingleVector class, atompy offers some linear algebra operations for single vectors. If you have a collection of vectors, use Vector instead.

class atompy.SingleVector(x, y, z)[source]#

Data type representing a single vector.

If you want to work with multiple vectors, consider using Vector.

Parameters:
x, y, zfloat

Components of the vector

Attributes:
cos_theta

Return cosine of polar angle from -1 to 1

mag

Alias for SingleVector.magnitude

magnitude

Return magnitude of vector

norm

Return normalized Vector

phi

Return azimuth angle in rad from -PI to PI

phi_deg

Return azimuth angle in degree from -180 to 180

theta

Return polar angle in rad from 0 to PI e

theta_deg

Return polar angle in degree from 0 to 180

x

x-Component of Vector

y

y-Component of Vector

z

z-Component of Vector

Methods

angle_between(other)

Return the angle between Vector and other

cross(other)

Return cross product between self and other

dot(other)

Returrn dot product of Vector with other

rotated_around_x(angle)

Return a new vector which is rotated around the x-axis by angle

rotated_around_y(angle)

Return a new vector which is rotated around the y-axis by angle

rotated_around_z(angle)

Return a new vector which is rotated around the z-axis by angle

Examples

>>> vec  = Vector(1, 2, 3)
>>> vec.x
1.0