      SUBROUTINE FINDMX(H,NDIM,XRESP,FREQ,IDOF)
CDEP  
      IMPLICIT REAL (A-H,O-Z)
      DIMENSION H(NDIM,NDIM),XRESP(NDIM)
C-old:DEP  --- NOTE: ALL COMPLEX*16 MEANS A 64-BIT REAL AND IMAGINARY PART
C-old      COMPLEX*16 H,XRESP
      COMPLEX H,XRESP
CDEP  
C-old      RLEN(X,Y)=DSQRT(X**2+Y**2)
      RLEN(X,Y)=SQRT(X*X+Y*Y)
C     
      DO 100 I=1,NDIM
         XRESP(I)=(0.,0.)
 100  CONTINUE
C     
      DO 210 J=1,NDIM
         DO 200 I=1,NDIM
            XRESP(I)=XRESP(I)+H(I,J)
 200     CONTINUE
 210  CONTINUE
C     
      IDOF=0
      RMAGN=0.
      OMEGA2=(6.283185307*FREQ)**2
      DO 300 I=1,NDIM
         XRESP(I)=XRESP(I)*OMEGA2
         RREAL=REAL(XRESP(I))
C-old         RIMAG=DIMAG(XRESP(I))
         RIMAG=AIMAG(XRESP(I))
         T=RLEN(RREAL,RIMAG)
         IF (T.GT.RMAGN) THEN
            RMAGN=T
            IDOF=I
         ENDIF
 300  CONTINUE
      END
