      SUBROUTINE SORT(VAL,VEC,N)
      complex VEC(N,*), SUM
      real    VAL(*)
      include 'MOP6FILE'
      do 30 I=1,N
         X=1.E9
         do 10 J=I,N
            if (VAL(J).LT.X) then
               K=J
               X=VAL(J)
            end if
   10    continue
         do 20 J=1,N
            SUM=VEC(J,K)
            VEC(J,K)=VEC(J,I)
   20    VEC(J,I)=SUM
         VAL(K)=VAL(I)
         VAL(I)=X
   30 continue
      return
      end
