Changeset 3079 for trunk/GSASIImath.py


Ignore:
Timestamp:
Sep 18, 2017 8:52:24 AM (6 years ago)
Author:
vondreele
Message:

implement rigid body reference vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3048 r3079  
    825825    return np.array(XYZ)
    826826
     827def getRBTransMat(X,Y):
     828    '''Get transformation for Cartesian axes given 2 vectors
     829    X will  be parallel to new X-axis; X cross Y will be new Z-axis &
     830    (X cross Y) cross Y will be new Y-axis
     831    Useful for rigid body axes definintion
     832   
     833    :param array X: normalized vector
     834    :param array Y: normalized vector
     835   
     836    :returns: array M: transformation matrix
     837    use as XYZ' = np.inner(M,XYZ) where XYZ are Cartesian
     838   
     839    '''
     840    Mat2 = np.cross(X,Y)      #UxV-->Z
     841    Mat2 /= np.sqrt(np.sum(Mat2**2))
     842    Mat3 = np.cross(Mat2,X)        #(UxV)xU-->Y
     843    Mat3 /= np.sqrt(np.sum(Mat3**2))
     844    return np.array([X,Mat3,Mat2])       
     845               
    827846def RotateRBXYZ(Bmat,Cart,oriQ):
    828847    '''rotate & transform cartesian coordinates to crystallographic ones
Note: See TracChangeset for help on using the changeset viewer.