      SUBROUTINE EXTINC (ISYMCE,NS)
C- I am assuming that an extinction is a systematic absence...
C
C  isymce indicates if lattice is centrosymmetric and ns is the number
C  sites not including Bravais lattice or inversion symmetry

      implicit none
c...	common blocks
      integer IHOO,IOKO,IOOL,IHKO,IHOL,IOKL,IHHL,ILAU,ITRIG
      COMMON /EXTI/ IHOO,IOKO,IOOL,IHKO,IHOL,IOKL,IHHL,ILAU,ITRIG

C      real ts(3,24), fs(3,3,24)
      double precision ts(3,24), fs(3,3,24)
      COMMON /EQUO/ TS,FS

      integer ibravl,isystm
      common /cell/ ibravl,isystm

c...	passed variables
      integer ns,isymce 

c...	local variables

C-----FINDS EXTINCTIONS, LAUE GROUP AND HEXAGONAL SYMMETRY INDICATOR    EXTI0001
C local variables
C      real q1,q2,q3,q4,poin
      double precision q1,q2,q3,q4,poin
      integer i
C      real r,s,t,x,y,z,xo,yo,zo
      double precision r,s,t,x,y,z,xo,yo,zo

      
      ILAU=1
      Q1=1.0d0/3.0d0
      Q2=1.0d0/6.0d0
      Q3=2.0d0/3.0d0
      Q4=5.0d0/6.0d0
      DO 2 I=1,NS
         POIN=0.0d0
         R=TS(1,I)           ! x-offset
         S=TS(2,I)           ! y-offset
         T=TS(3,I)           ! z-offset
         X=FS(1,1,I)*10.0d0+FS(2,1,I)*50.0d0+FS(3,1,I)*100.0d0
         Y=FS(1,2,I)*10.0d0+FS(2,2,I)*50.0d0+FS(3,2,I)*100.0d0
         Z=FS(1,3,I)*10.0d0+FS(2,3,I)*50.0d0+FS(3,3,I)*100.0d0
         XO=DABS(X)
         YO=DABS(Y)
         ZO=DABS(Z)
         IF ((R.EQ..5d0).AND.(XO.EQ.10.0d0)) IHOO=2   ! 1/2 +/- x -> h is even
         IF ((S.EQ..5d0).AND.(YO.EQ.50.0d0)) IOKO=2   ! k must be even
         IF (IOOL.GT.3) GO TO 1                  ! info from prev loop
         IF ((T.EQ..5d0).AND.(ZO.EQ.100.0d0)) IOOL=2  ! l must be even
         IF ((T.EQ.Q2).OR.(T.EQ.Q4)) IOOL=6      ! l is multiple of 6
         IF ((T.EQ.Q1).OR.(T.EQ.Q3)) IOOL=3      ! l is a multiple of 3
         IF ((T.EQ..25d0).OR.(T.EQ..75d0)) IOOL=4    ! l is a multiple of 4
 1       IF ((X.EQ.50.0d0).AND.(Y.EQ.10.0d0)) ILAU=2   ! x and y transposed
         IF ((X.EQ.-50.0d0).AND.(Y.EQ.-10.0d00)) ILAU=2

C  triggers for trigonal  x-y, y, z  or y-x, -y, -z
         IF ((X.EQ.-40.0d0).AND.(Y.EQ.10.0d0).AND.(Z.EQ.100.0d0)) 
     &     ITRIG=6
         IF ((X.EQ.40.0d0).AND.(Y.EQ.-10.0d0).AND.(Z.EQ.-100.0d0))
     &     ITRIG=6

C  if there are atoms 1/4 or 3/4 postitions, h or k is a multiple of 4
         IF (((S.EQ..25d0).OR.(S.EQ..75d0)).AND.(YO.EQ.50.0d0)) IOKO=4
         IF (((R.EQ..25d0).OR.(R.EQ..75d0)).AND.(XO.EQ.10.0d0)) IHOO=4

         X=X+R    ! combine offsets with vectors to find combos
         Y=Y+S
         Z=Z+T
C I think the following combinations are done solely to save space
C in the condtional statements.

C         X=XO+R    ! combine offsets with vectors to find combos
C         Y=YO+S
C         Z=ZO+T
         
C         write(*,*) r,s,t,x,y,z,xo,yo,zo

C         IF ((X.EQ.10.5d0).AND.(Y.EQ.50.5d0)) IHKO=2    ! 1/2+x, 1/2+y
C         IF ((X.EQ.10.5d0).AND.(Y.EQ.50.5d0)) IHKO=2    ! 1/2+x, 1/2+y
C         write(*,*) (xo.eq.10.0d0),(r.eq..5d0),
C     &      (yo.eq.50.0d0),(s.eq.5d0)
         if(((xo.eq.10.0d0).and.(r.eq..5d0)).and.
     &      ((yo.eq.50.0d0).and.(s.eq..5d0))) ihko=2  
         IF ((X.EQ.10.0d0).AND.(Y.EQ.50.5d0)) IHKO=3    ! x, 1/2+y
         IF ((X.EQ.10.25d0).AND.(Y.EQ.50.25d0)) IHKO=4  ! 1/4+x, 1/4+y
         IF ((X.EQ.10.75d0).AND.(Y.EQ.50.75d0)) IHKO=4  ! 3/4+x, 3/4+y
         IF ((X.EQ.10.5d0).AND.(Y.EQ.50.0d0)) IHKO=5  ! 1/2+x, y (?)
C         IF ((Y.EQ.50.5d0).AND.(Z.EQ.100.5d0)) IOKL=2 ! 1/2+y, 1/2+z
         if(((yo.eq.50.0d0).and.(s.eq..5d0)).and.
     &      ((zo.eq.100.0d0).and.(t.eq..5d0))) iokl=2  
         IF ((Y.EQ.50.0d0).AND.(Z.EQ.100.5d0)) IOKL=3 ! y, 1/2+z
         IF ((Y.EQ.50.25d0).AND.(Z.EQ.100.25d0)) IOKL=4 ! 1/4+y, 1/4+z
         IF ((Y.EQ.50.75d0).AND.(Z.EQ.100.75d0)) IOKL=4 ! 3/4+y, 3/4+z
         IF ((Y.EQ.50.5d0).AND.(Z.EQ.100.0d0)) IOKL=5 ! 1/2+y, z
C         IF ((X.EQ.10.5d0).AND.(Z.EQ.100.5d0)) IHOL=2  ! 1/2+x, 1/2+z
         if(((xo.eq.10.0d0).and.(r.eq..5d0)).and.
     &      ((zo.eq.100.0d0).and.(t.eq..5d0))) ihol=2  
         IF ((X.EQ.10.0d0).AND.(Z.EQ.100.5d0)) IHOL=3  ! x, 1/2+z
         IF ((X.EQ.10.25d0).AND.(Z.EQ.100.25d0)) IHOL=4 ! 1/4+x, 1/4+z
         IF ((X.EQ.10.75d0).AND.(Z.EQ.100.75d0)) IHOL=4 ! 3/4+x, 3/4+z
         IF ((X.EQ.10.5d0).AND.(Z.EQ.100.0d0)) IHOL=5   ! 1/2+x, z

         IF ((X.EQ.50.5d0).AND.(Y.EQ.10.5d0).AND.(Z.EQ.100.5d0)) IHHL=2
         IF ((X.EQ.50.0d0).AND.(Y.EQ.10.0d0).AND.(Z.EQ.100.5d0)) IHHL=2
         IF ((X.EQ.50.0d0).AND.(Y.EQ.10.0d0).AND.(Z.EQ.100.5d0)) IHHL=2
         IF ((X.EQ.50.0d0).AND.(Y.EQ.10.5d0).AND.(Z.EQ.100.25d0)) IHHL=3
         IF ((X.EQ.50.0d0).AND.(Y.EQ.10.5d0).AND.(Z.EQ.100.75d0)) IHHL=3
         IF ((X.EQ.50.75d0).AND.(Y.EQ.10.75d0).AND.(Z.EQ.100.75d0)) 
     &     IHHL=3
         IF ((X.EQ.50.75d0).AND.(Y.EQ.10.75d0).AND.(Z.EQ.100.25d0)) 
     &     IHHL=3
         IF ((X.EQ.50.25d0).AND.(Y.EQ.10.25d0).AND.(Z.EQ.100.25d0)) 
     &     IHHL=3

C-----CHECK CENTROSYMMETRIC POSITION                                    EXTI0061
         IF (ISYMCE.EQ.0) GO TO 2
         IF (POIN.EQ.-1.0d0) GO TO 2
         POIN=-1.0d0
         X=-X+R
         Y=-Y+S
         Z=-Z+T
         IF (R.NE.0.0d0) R=1.0d0-R
         IF (S.NE.0.0d0) S=1.0d0-S
         IF (T.NE.0.0d0) T=1.0d0-T
         GO TO 1
C 2    write(*,*) IHOO,IOKO,IOOL,IHKO,IHOL,IOKL,IHHL,ILAU,ITRIG
 2    continue
C      stop
      RETURN
      END


