Vector#
- class atompy.Vector(x, y, z)[source]#
Class representing a single vector.
Tip
If you want to store an array of vectors, consider
VectorArray.See also
Examples
>>> vec = ap.Vector(1, 2, 3) >>> vec Vector(1.0, 2.0, 3.0) >>> vec.x 1.0
For more examples, see Working with vectors.
Methods
angle_to(other)Calculate the angle to vector other.
asarray()Return as a numpy array.
copy()Return a copy of the vector.
Calculate cosine of the polar angle.
cross(other)Calculate cross (outer) product with other.
dot(other)Calculate dot (inner) product with other.
mag()Calculate magnitude of vector.
norm([copy])Return the vector normalized to 1.
phi()Calculate azimuth angle in rad.
rotate(angle_rad, axis)Rotate a vector by angle_rad around axis
scale(fac[, copy])Scale the vector.
theta()Calculate polar angle in rad.