      subroutine qtiles(n,x,q,xq1,xq2) ! bernd berg jan 12 1999.
c interpolation for qtiles.
      include '../../libs/fortran/implicit.sta'
      include '../../libs/fortran/constants.par'
      dimension x(n)
      nq=int(q*n)
c      print*,'nq,q,n:',nq,q,n
      if(nq.eq.0) stop 'qtiles: n too small.'
      w2=q*(n+1)-(nq*one)
      w1=one-w2
      xq1=w1*x(nq)  +w2*x(nq+1)
      xq2=w1*x(n+1-nq)+w2*x(n-nq)
      return
      end
