      SUBROUTINE ORIENT(T,NOEL,NPT,LAYER,KSPT,COORDS,BASIS,ANAME,
     1 NNODES,CNODES,JNNUM)
C
      INCLUDE 'ABA_PARAM.INC'
C
        CHARACTER*80 ANAME
      DIMENSION T(3,3),COORD(3),BASIS(3,3),CNODES(3,NNODES)
      DIMENSION JNNUM(NNODES)
C
C
C    WE WANT THE FIRST MATERIAL AXIS TO BE +45 DEGREES FROM THE
C    FIRST SIDE OF A GIVEN ELEMENT AND ALSO TO BE IN THE PLANE 
C    OF THE SHELL (IE, PERPENDICULAR TO THE SHELL NORMAL). THE 
C    UNIT VECTOR THAT SATISFIES THESE REQUIREMENTS IS IN THE 
C    GLOBAL DIRECTION X=(.091752,.908249,.4082486)
C
C    NOW COMPUTE ANGLE (`THET') BETWEEN THIS DESIRED
C    FIRST MATERIAL DIRECTION AND THE FIRST BASIS DIRECTION 
C    CHOSEN BY ABAQUS
C
C
      X1=.091752
      X2=.908249
      X3=.4082486
C
C   COMPUTE ANGLE FROM DOT PRODUCT
C
      COSTHET= BASIS(1,1)*X1+BASIS(2,1)*X2+BASIS(3,1)
     1          *X3
      THET=ACOS(COSTHET)
C
C     ROTATION `ALPHA' IS  +THETA DEG FOR THE TOP 3 SECTION POINTS
C     AND (THETA - 90) DEG FOR THE BOTTOM THREE SECTION POINTS
C     AT EACH INTEGRATION STATION
C
      IF(ANAME.EQ.'LAYER2') THEN
         ALPH=THET
           ELSE
         ALPH=THET - 1.57079633
       END IF
C
C   COMPUTE ROTATION MATRIX--ONLY THE FIRST TWO BASIS DIRECTIONS NEEDED
C                            FOR SHELLS. THE THIRD DIR. IS ALWAYS
C                            NORMAL TO THE SHELL SURFACE.
C
      T(1,1)=COS(ALPH)
      T(2,1)=SIN(ALPH)
C
      T(1,2)=-SIN(ALPH)
      T(2,2)=COS(ALPH)
      RETURN
      END

