These are mainly utility methods to deal with Euler angles and rotation matricies.
Utility methods for paramagnetic observables
Return the 3 Euler angles (A, B, G) in ZXZ from a given rotation matrix.
Parameters: |
|
---|
Warning
This method is yet to be written. ZYZ is the favoured convention.
Return the 3 Euler angles (A, B, G) in ZYZ from a given rotation matrix.
Parameters: |
|
---|
Warning
At the present moment this method does not handle cases where the generated rotation matrix contains Euler angles at 0,90,180,270 or 360 degrees respectively. Need to look how Numbat handles this.
Example Usage/Doctests:
>>> import random
>>> from math import degrees
>>> rand_angles = []
>>> det_angles = []
>>> for i in range(0, 10):
... a,b,g = random.randint(271,359), random.randint(1,89), random.randint(181,269)
... rand_angles.append(a)
... rand_angles.append(b)
... rand_angles.append(g)
... zyz = ZYZRot(a,b,g)
... vals = ABGFromRotMatrixZYZ(zyz)
... for i in range (0, len(vals)):
... det_angles.append(degrees((vals[i])))
...
>>> for i in range(0, len(det_angles)):
... if round(det_angles[i], 0) != rand_angles[i]:
... print 'fail'
...
Return an angle such that it is [0:2pi] bound.
Useful as the angles determined from an optimization are not [0:2pi] bound
Parameters: |
|
---|
Example Usage/Doctests:
>>> res = []
>>> test = [0.0, 100.0, 360.0, 361.0, 720.0, -100.0, -360.0, -361.0, -720.0]
>>> corr = [0.0, 100.0, 0.0, 1.0, 0.0, 260.0, 0.0, 359.0, 0.0]
>>> for i in range(0, len(test)):
... res.append(FixAngle(test[i]))
...
>>> print res == corr
True
Return the Axial or Rhombic component converted from van Vleck units.
van Vleck units = m3/3.77 10-35, See: http://www.cerm.unifi.it/Downloads/Xplor/PARArestraints.pdf
Parameters: |
|
---|
:type AxorRh : float
Returns the rotation matrix for a 90 degree rotation about X.
[[1, 0, 0], [0, 0, 1], [0, -1, 0]]
Used in UTR determination
Example Usage/Doctests:
>>> rx90 = RotX90()
>>> print rx90
[[ 1. 0. 0.]
[ 0. 0. 1.]
[ 0. -1. 0.]]
Returns the rotation matrix for a 90 degree rotation about Y.
[[0, 0, -1], [0, 1, 0], [1, 0, 0]]
Used in UTR determination
Example Usage/Doctests:
>>> ry90 = RotY90()
>>> print ry90
[[ 0. 0. -1.]
[ 0. 1. 0.]
[ 1. 0. 0.]]
Returns the rotation matrix for a 90 degree rotation about Z.
[[0, 1, 0], [-1, 0, 0], [0, 0, 1]]
Used in UTR determination
Example Usage/Doctests:
>>> rz90 = RotZ90()
>>> print rz90
[[ 0. 1. 0.]
[-1. 0. 0.]
[ 0. 0. 1.]]
Return the Axial or Rhombic component converted to van Vleck units.
van Vleck units = m3/3.77 10-35, See: http://www.cerm.unifi.it/Downloads/Xplor/PARArestraints.pdf
Parameters: |
|
---|
:type AxorRh : float
Returns a ZXZ rotation matrix when given 3 Euler angles (in degrees).
See: http://mathworld.wolfram.com/EulerAngles.html
Parameters: |
|
---|
Example Usage/Doctests:
>>> a,b,g = 0.0, 0.0, 0.0
>>> zxz = ZXZRot(a,b,g)
>>> print zxz
[[ 1. 0. 0.]
[-0. 1. 0.]
[ 0. -0. 1.]]
>>> #TODO: More complicated testing...
Returns a ZYZ rotation matrix when given 3 Euler angles (in degrees).
See: http://mathworld.wolfram.com/EulerAngles.html
Parameters: |
|
---|
Example Usage/Doctests:
>>> a,b,g = 0.0, 0.0, 0.0
>>> zyz = ZYZRot(a,b,g)
>>> print zyz
[[ 1. 0. -0.]
[-0. 1. 0.]
[ 0. 0. 1.]]
>>> #TODO: More complicated testing...
Return an angle in correct quadrant given a cosine and sine of the angle.
Applies sin in [-pi/2, x, pi/2] and cos in [0, x, pi]
This agrees with Numbat code.
Parameters: |
|
---|
Example Usage/Doctests:
>>> import math
>>> cosL = [20, 110]
>>> sinL = [-70, -35, 35, 70 ]
>>> for c in range(0, len(cosL)):
... for s in range(0, len(sinL)):
... x = correctAngle(math.radians(cosL[c]), math.radians(sinL[s]))
... print cosL[c], sinL[s], math.degrees(x)
20 -70 290.0
20 -35 325.0
20 35 35.0
20 70 70.0
110 -70 250.0
110 -35 250.0
110 35 110.0
110 70 110.0
Returns a ParaParser object -unpickle (re-initilize a saved session)
Parameters: |
|
---|
Return the gyromagnetic ratio(s) for the given spin type.
From: http://nmrwiki.org/wiki/index.php?title=Gyromagnetic_ratio
The values defined are consistent with those in Xplor-NIH.
Note
As ‘N’itrogen can be 14N or 15N both gyromagnetic ratios are returned in that order.
Note
This method really doesn’t belong here. Will be moved (perhaps to ParaParser) soon. If in ParaParser all parsed RDC sets will have a MGR lookup method...
Parameters: |
|
---|
Calculate the scaling constant.for the RDC calculation.
See: Journal of Biomolecular NMR, 22: 365-368, 2002 for an explaination.
Note
This method really doesn’t belong here. Will be moved (perhaps to ParaParser) soon. If in ParaParser all parsed RDC sets will have a MGR lookup method...
Parameters: |
|
---|