      SUBROUTINE MKSPC(FFT,Y,NUNI1,NDFAST,NDFILE,
     *                 DO,DELTA,NO,NN,XSI0,JJ,IFILE)

      COMPLEX*8 FFT(NDFAST),SPEC
      DIMENSION NUNI1(NDFILE),Y(NDFAST)
      COMMON   /SPEC/ XSI,XEI,YSI,YEI,IXSPN,IXUT1,IXUT2,
     *                IYSPN,IYUT1,IYUT2,IFPX,IFPY,IGRID,MAPNG
     *        /STYLE/ NSTYLE,IXR,IYR,JXR,JYR,NSX,NSTY

C     **********  INITIALIZATION  **********

      SMAX = 0.0
      PAI  = 4.D0*DATAN(1.D0)

      IF(NSX.EQ.1) THEN
        DELTA = DO
      ELSE
        DELTA = DO/2.0/PAI
      END IF

      NOS  = INT(XSI/DELTA)+1
      NOE  = INT(XEI/DELTA)+1
      IF(NOE.GT.NO+1) NOE = NO+1
      IF(NOS.EQ.1   ) NOS = 2
      IF(NOS.GT.NOE ) NOS = NOE
      NN   = NOE-NOS+1
      XSI0 = DELTA*DFLOAT(NOS-1)

      DO 100 I = 1, NDFAST
        Y(I) = 0.0
  100 CONTINUE

C     **********  CALCULATION  **********

      NP = JJ-NUNI1(IFILE)

      DO 200 I = NOS, NOE
        K      = I-NOS+1
        SPEC   = FFT(I)*CMPLX(0.0,DO*FLOAT(I-1))**NP
        ASPEC  = CABS(SPEC)
        Y(K)   = ASPEC
        IF(ASPEC.GT.SMAX) SMAX = ASPEC
  200 CONTINUE

      WRITE(*,'(A,F10.4)')'     smax = ',SMAX

      RETURN
      END
