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, z
float Components of the vector
- x, y, z
- Attributes:
cos_thetaReturn cosine of polar angle from -1 to 1
magAlias for
SingleVector.magnitudemagnitudeReturn magnitude of vector
normReturn normalized Vector
phiReturn azimuth angle in rad from -PI to PI
phi_degReturn azimuth angle in degree from -180 to 180
thetaReturn polar angle in rad from 0 to PI e
theta_degReturn polar angle in degree from 0 to 180
xx-Component of Vector
yy-Component of Vector
zz-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