winak.curvilinear.numeric package¶
Submodules¶
winak.curvilinear.numeric.Matrix module¶
This Module
-
winak.curvilinear.numeric.Matrix.
regularizedInverse
(A, eps=1e-15)¶
winak.curvilinear.numeric.MyVector module¶
winak.curvilinear.numeric.Quaternions module¶
Author: Daniel Strobusch Date: 14. March 2010
This package contains a simple class for describing rotations using quaternions. Hopefully this will be implemented in NumPy, SciPy or another standard library soon.
-
class
winak.curvilinear.numeric.Quaternions.
InverseDescriptor
¶ Bases:
object
-
class
winak.curvilinear.numeric.Quaternions.
Quaternion
(arg)¶ Bases:
object
-
getAngle
()¶ Get the angle of return described by the quaternion.
-
getAxis
()¶ Get the axis of rotation described by the quaternion.
-
getRotationMatrix
()¶ Return a matrix describing the rotation.
-
getTaitBryanZYXAngles
()¶ Calculates the three angles phi, theta, psi for consecutive rotation around XYZ The rotation order is first x, than y, than z axis
-
norm
()¶
-
q
¶
-
rotate
(v)¶ Return a vector or matrix rotated by quaternion.
-
-
class
winak.curvilinear.numeric.Quaternions.
TransposeDescriptor
¶ Bases:
object
winak.curvilinear.numeric.Rotation module¶
Rigid Body rotations
-
winak.curvilinear.numeric.Rotation.
EulerAngle
(u, v, x, y, z, eps=1e-07)¶ compute the Euler angles phi, theta, psi in the so-called “x-convention” [Goldstein (1980, ch. 4-4) and Landau and Lifschitz (1976)] for transforming the right-handed coordinate system given by vectors (x, y, z) into the one (e1, e2, e3) defined by vectors u, v with the convention: e1 || u e2 in plane(u, v) e3 = e1 x e2
-
winak.curvilinear.numeric.Rotation.
EulerAngles_LC2WC
(x1, y1, z1)¶ Calculate the Euler angles in “x-convention” between the World Coordinates (1 0 0), (0 1 0), (0 0 1) and the local coordinate system defined by x1, y1, z1 algorithm by Nikolaev -> www.geom3d.com
-
winak.curvilinear.numeric.Rotation.
EulerAngles_WC2LC
(x1, y1, z1)¶ Euler Angles for going from WC to LC all in x-convention
-
winak.curvilinear.numeric.Rotation.
EulerParameter
(u, v, x, y, z)¶ compute the Euler parameters (quaternions) [Goldstein (1980, ch. 4-5)] for transforming the right-handed coordinate system given by vectors (x, y, z) into the one (w1, w2, w3) defined by vectors u, v with the convention:
v1 || u v2 in plane(u, v) v3 = v1 x v2
-
winak.curvilinear.numeric.Rotation.
directionCosines
(u, v, x, y, z)¶
-
winak.curvilinear.numeric.Rotation.
rand_rotation_matrix
(deflection=1.0, randnums=None)¶ Creates a random rotation matrix.
deflection: the magnitude of the rotation. For 0, no rotation; for 1, competely random rotation. Small deflection => small perturbation. randnums: 3 random numbers in the range [0, 1]. If None, they will be auto-generated.
-
winak.curvilinear.numeric.Rotation.
rigidBodySuperposition
(X, Y, weights=None, RMSD=False, shift=True)¶ Align ‘X’ to ‘Y’ minimizing the RMSD of the coordinates. The parameter ‘weights’ specifies how the coordinates should be weighted during the alignment procedure. Possible options are: ‘None’ : equal weight for all atoms array of weights : a user defined array of weights, e.g. to align only a fraction of the atoms by setting the weights for some atoms to zero or to use mass weighting ‘RMSD’ defines if the RMSD should be computed. Returns a tuple of transformed X, the RMSD and a tuple defining the transformation, i.e a vector, a quaternion and another vector. To apply the transformation ‘(v, q, w)’ to an arbitrary set of coordinates ‘r’ calculate q.rotate(r+v) + w Algorithm depending on: “Kneller, Gerald R. (1991) ‘Superposition of Molecular Structures using Quaternions’, Molecular Simulation, 7: 1, 113 - 119”
-
winak.curvilinear.numeric.Rotation.
rotationFromQuaternion
(e)¶