anchor.diff:  
     end function get_rotation_from_cosines
   
  -  ! ********************************************************
  -  ! routine that returns the ang rate matrix (euler angles)
  -  ! ********************************************************
  -  function get_angrate_from_angles(theta) result(SMAT)
  -
  -    real(dp) :: theta(NUM_SPAT_DIM)    
  +
  +  !*******************************************************************!
  +  ! Returns the ang rate matrix from the supplied euler angles
  +  !
  +  ! Compute the 3-2-1 Euler angle rotation. The S matrix does not 
  +  ! depend on c3/s3, however we keep these as inputs in case we ever
  +  ! want to change the Euler sequence.
  +  !
  +  ! Input : theta of type VECTOR
  +  ! Output: SMAT  of type MATRIX
  +  ! 
  +  ! Ref: Section 2.3 Eq. 24/25 Hughes
  +  ! ******************************************************************!
  +  function get_angrate_from_angles_vec(thetain) result(SMAT)
  +
  +    type(vector) :: thetain
  +    real(dp)     :: theta(NUM_SPAT_DIM)    
       type(matrix) :: SMAT
  -    real(dp)                   :: c1, c2, c3, s1, s2, s3
  +
  +    ! convert to array
  +    theta = array(thetain)
  +
  +    ! call the function with array signature
  +    SMAT = get_angrate_from_angles_array(theta)
  +
  +  end function get_angrate_from_angles_vec
  +
  +  !*******************************************************************!
  +  ! Returns the ang rate matrix from the supplied euler angles
  +  !
  +  ! Compute the 3-2-1 Euler angle rotation. The S matrix does not 
  +  ! depend on c3/s3, however we keep these as inputs in case we ever
  +  ! want to change the Euler sequence.
  +  !
  +  ! Input : theta as an array
  +  ! Output: SMAT  of type MATRIX
  +  ! 
  +  ! Ref: Section 2.3 Eq. 24/25 Hughes
  +  ! ******************************************************************!
  +  function get_angrate_from_angles_array(theta) result(SMAT)
  +
  +    real(dp)     :: theta(NUM_SPAT_DIM)    
  +    type(matrix) :: SMAT
  +    real(dp)     :: c1, c2, c3, s1, s2, s3
   
       ! Compute the sin/cos of the Euler angles
       c1 = cos(theta(1))
  
positive.code:   end function get_angrate_from_cosines
  
    !-----------------------------------------------------------
    ! we use the 3-2-1 Euler angles, the S matrix does not depend
    ! on c3/s3, however we keep these as inputs in case we ever  
    ! want to change the Euler sequence.
    !-----------------------------------------------------------
    function get_angrate_dot(theta, dtheta) result(SMAT_DOT)
  
      real(dp)     :: theta(NUM_SPAT_DIM), dtheta(NUM_SPAT_DIM)
      type(matrix) :: SMAT_DOT
      real(dp)     :: c1, c2, c3, s1, s2, s3
  
      ! Compute the sin/cos of the Euler angles
      c1 = cos(theta(1))
      s1 = sin(theta(1))
  
  
negative.code:   !*******************************************************************!
    ! Returns the rotation matrix (euler angles) based on the sines and 
    ! cosines of the euler angles
    !
    ! Compute the 3-2-1 Euler angle rotation
  
    ! Input: sines and cosines of the euler angles
    ! Output: CMAT of type MATRIX
    !
    ! Ref: Section 2.2 Eq. 18/19 Hughes
    !*******************************************************************!
    function get_rotation_from_cosines(c1,c2,c3,s1,s2,s3) result(CMAT)
  
  