*********************************************************************SDK ************************************************************************ * * Subroutine NFOLD2MTX * * Function: * Convert direction cosines and rotation angle to rotation matrix * * Comments: * * * Arguments: * Dircos (i) direction cosines of rotation axis * Rotang (i) rotation angle * Rot (o) 3 x 3 rotation matrix * * * History: * From Polar2Mtx March 3 1994 S. Knight ************************************************************************ subroutine NFold2Mtx ( dircos , rotang , rot ) implicit none * Arguments real dircos( 3 ) , rotang , rot(3,3) * Local variables integer i , j double precision dkappa , r(3,3) double precision atr , a1 , a2 , a3 , a4 , a5 , a6 parameter (atr = 3.141592653589793/180.) *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= * a1,a2,a3 = direction cosines of rotation axis a1 = dircos( 1 ) a2 = dircos( 2 ) a3 = dircos( 3 ) dkappa = atr * rotang a4 = sin ( dkappa ) a5 = cos ( dkappa ) a6 = 1 - a5 * First row r(1,1) = a5 + a6 * a1**2 r(1,2) = a1 * a2 * a6 - a3 * a4 r(1,3) = a1 * a3 * a6 + a2 * a4 * Second row r(2,1) = a1 * a2 * a6 + a3 * a4 r(2,2) = a5 + a6 * a2**2 r(2,3) = a2 * a3 * a6 - a1 * a4 * Third row r(3,1) = a1 * a3 * a6 - a2 * a4 r(3,2) = a2 * a3 * a6 + a1 * a4 r(3,3) = a5 + a6 * a3**2 * Copy result do 20 j = 1 , 3 do 10 i = 1 , 3 rot( i,j ) = r( i,j ) 10 continue 20 continue return *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= end