* PACKAGE DEDIAG  !" $@@~7ANO3X8GM-CM2r@O(J : $@8GM-CM7W;;?GCG=PNO(J
*
*"  [HIS]  92/12/28(takepiro) 
*"         93/04/30(takepiro)
*"         93/07/14(takepiro) $@%]%m%$%@%k(J, $@29EY$NGH?t@_DjJ,N%(J
*"         95/06/13(takepiro) 
*"         95/06/17(takepiro) $@:n6HJQ?t(J GD* $@$r0z?t$K(J
*"         95/06/21(takepiro) $@=PNO8GM-4X?t7W;;?tF3F~(J
*
**********************************************************************
      SUBROUTINE LDIAG
     I            (  GROWTH , FRQENC , 
     I               EIGVCR , EIGVCI ,
     I               NMKMTX , NUMEIG , NVEC   ,
     I               NMTLST , NMTMAX , 
     I               NMPLST , NMPMAX , 
     I               NMQLST , NMQMAX , 
     F               OATOR  , OAPOR  , OAT    ,
     C               NMO    , FLAPLA , UVFACT , 
     C               ARAD   , DRAD   ,
     W               GDU    , GDV    , GDW    , GDT   ,
     W               GDTOR  , GDPOR  )
*
*   [PARAM]
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                      !" $@3J;RE@?t(J, $@GH?t(J
      INCLUDE   (ZLDIM)                      !" $@3J;RE@?t(J, $@GH?t(J
      INCLUDE   (ZHDIM)                      !" $@J8;z?t(J
#else
#include        "zcdim.F"                    !" $@3J;RE@?t(J, $@GH?t(J
#include        "zldim.F"                    !" $@78?t9TNs$NBg$-$5(J
#include        "zhdim.F"                    !" $@J8;z?t(J
#endif
*
*"  [INPUT]
      REAL       GROWTH( MATDMX )            !" $@@.D9N((J($@8GM-CM<B?tIt(J)
      REAL       FRQENC( MATDMX )            !" $@?6F0?t(J($@8GM-CM5u?tIt(J)
      REAL       EIGVCR( MATDMX, * )         !" $@8GM-%Y%/%H%k<B?tIt(J
      REAL       EIGVCI( MATDMX, * )         !" $@8GM-%Y%/%H%k5u?tIt(J
*
      INTEGER    NMKMTX ( NMDIM, 0:KDIM, 3 ) !" $@78?t9TNs$NE:$(;z(J
      INTEGER    NUMEIG                      !" $@8GM-CM$N?t(J
      INTEGER    NMTLST  ( NMDIM )           !" MFIX $@@.J,%j%9%H(J($@%H%m%$%@%k(J)
      INTEGER    NMPLST  ( NMDIM )           !" MFIX $@@.J,%j%9%H(J($@%]%m%$%@%k(J)
      INTEGER    NMQLST  ( NMDIM )           !" MFIX $@@.J,%j%9%H(J($@29EY(J)
      INTEGER    NMTMAX                      !" NMTLST $@$N:GBgE:$(;z(J
      INTEGER    NMPMAX                      !" NMPLST $@$N:GBgE:$(;z(J
      INTEGER    NMQMAX                      !" NMQLST $@$N:GBgE:$(;z(J
*
      LOGICAL    OATOR , OAPOR , OAT         !" $@2r@OBP>]J*M}NL(J
      INTEGER    NMO   ( 2, 0:MMAX, 0:LMAX ) !" $@%9%Z%/%H%k$NE:;z=gHV(J
      REAL       FLAPLA( NMDIM  )            !" $@%i%W%i%7%"%s$N78?t(J
      REAL       UVFACT ( IDIM, JDIM )       !" u$@"*(JU $@$N%U%!%/%?!<(J
*
      REAL       ARAD  ( 0:KDIM )              !" $@#r%l%Y%k(J($@@0?t(J)
      REAL       DRAD  ( 0:KDIM )              !" $@&$#r(J($@@0?t(J)
*
      REAL       GDU   ( IDIM, JDIM, 0:KDIM )  !" $@@>Iw(J   $@#u(J
      REAL       GDV   ( IDIM, JDIM, 0:KDIM )  !" $@FnIw(J   $@#v(J
      REAL       GDW   ( IDIM, JDIM, 0:KDIM )  !" $@1tD>Iw(J $@#w(J
      REAL       GDT   ( IDIM, JDIM, 0:KDIM )  !" $@29EY(J   $@#T(J
      REAL       GDTOR ( IDIM, JDIM, 0:KDIM )  !" $@%H%m%$%@%k(J $@&7(J
      REAL       GDPOR ( IDIM, JDIM, 0:KDIM )  !" $@%]%m%$%@%k(J $@&5(J
*
*   [INTERNAL WORK]
      INTEGER    I, ITA
      LOGICAL    OLDIAG, OLDIAF, OLDIAV
      CHARACTER  FNGROW * (NFILN)       !" $@@.D9N(=PNO%U%!%$%kL>(J
      CHARACTER  FNFREQ * (NFILN)       !" $@?6F0?t=PNO%U%!%$%kL>(J
*
      CHARACTER  HFMT*16
      INTEGER    JFLDIA, NCOLS, ISTR, IEND, IINT
*
      DATA       HFMT    / '(1PE12.4)' /           !" $@=PNO=q<0(J
      DATA       JFLDIA  / 6 /                     !" $@=PNOAuCVHV9f(J
      DATA       NCOLS   / 80 /                    !" $@=PNO%+%i%`?t(J
      DATA       ISTR    / 1 /                     !" $@=PNO3+;O(J
      DATA       IEND    / 1 /
      DATA       IINT    / 1 /                     !" $@=PNO4V3V(J
*
      LOGICAL    OEIAXS
      DATA       OEIAXS / .TRUE. /
      SAVE
*
*"  < 1. $@=PNO$N%Q%i%a%?!<@_Dj(J >
*
      CALL QLDIAG
     O     (  OLDIAG , OLDIAF, OLDIAV , 
     O        FNGROW , FNFREQ             ) 
*
      IEND = NUMEIG 
*
*"  < 2. $@8GM-CM?GCG=PNO(J >
*
      IF( OLDIAG )THEN
*
         WRITE ( JFLDIA, * ) '@@@@@@@@@@@@< GROWTH RATE ',
     &                       '>@@@@@@@@@@@@@'
*
         CALL PRINTD
     I         ( JFLDIA , HFMT  , GROWTH ,
     I           ISTR   , IEND  , IINT   , 1 ,
     I           MATDMX , 1     , NCOLS          )
*
         WRITE ( JFLDIA, * ) '@@@@@@@@@@@@< FREQUENCY ', 
     &                       '>@@@@@@@@@@@@@'
*
         CALL PRINTD
     I         ( JFLDIA , HFMT  , FRQENC ,
     I           ISTR   , IEND  , IINT   , 1 ,
     I           MATDMX , 1     , NCOLS          )
*
      ENDIF
*
*"  < 3. $@8GM-CM%U%!%$%k=PNO(J >
*
      IF( OLDIAF )THEN
         IF( OEIAXS )THEN
            OEIAXS = .FALSE. 
            CALL EIGAXS
     I           ( NUMEIG )
         ENDIF
*
         CALL EIALWR     !" $@@.D9N((J, $@?6F0?tA4%b!<%I=PNO(J
     I        (  GROWTH , FRQENC , 
     I           NUMEIG ,  
     I           FNGROW , FNFREQ   ) 
      ENDIF
*
*"  < 4. $@8GM-4X?t=PNO(J >
*
      IF( OLDIAV )THEN
         DO 1000 I = 1, MIN( NUMEIG, NVEC )
            ITA = I
*
            CALL LEIVEC
     O       ( GDU    , GDV    , GDW    , GDT    ,
     O         GDTOR  , GDPOR  , 
     I         EIGVCR(1,I) , EIGVCI(1,I) ,
     I         NMKMTX , 
     I         NMTLST , NMTMAX , 
     I         NMPLST , NMPMAX , 
     I         NMQLST , NMQMAX , 
     F         OATOR  , OAPOR  , OAT    ,
     C         NMO    , FLAPLA , UVFACT , 
     C         ARAD   , DRAD                       )
*
            CALL WRRSTR         !" $@%j%9%?!<%H!&%U%!%$%k$N=q$-9~$_(J
     I         ( GDU   , GDV   , GDW   , GDT   , 
     I           GDTOR , GDPOR ,
     I           ITA   , ITA                     )
*
 1000    CONTINUE 
      ENDIF
*
      RETURN
      END
**********************************************************************
      SUBROUTINE QLDIAG
     O           (  OLDIAG , OLDIAF, OLDIAV , 
     O              FNGR   , FNFR             ) 
*
*
*   [PARAM] 
#ifdef SYS_IBMS
      INCLUDE   (ZHDIM)                      !" $@J8;z?t(J
#else
#include        "zhdim.F"                    !" $@J8;z?t(J
#endif
**  [OUTPUT]
      LOGICAL    OLDIAG                 !" $@8GM-CM?GCG=PNO%9%$%C%A(J
      LOGICAL    OLDIAF                 !" $@8GM-CM%U%!%$%k=PNO%9%$%C%A(J
      LOGICAL    OLDIAV                 !" $@8GM-4X?t%U%!%$%k=PNO%9%$%C%A(J
      CHARACTER  FNGR * (NFILN)         !" $@@.D9N(=PNO%U%!%$%kL>(J
      CHARACTER  FNFR * (NFILN)         !" $@?6F0?t=PNO%U%!%$%kL>(J
*
*  [INTERNAL WORK]
      LOGICAL    OEIGEN                 !" $@8GM-CM?GCG=PNO%9%$%C%A(J
      LOGICAL    OEIGFI                 !" $@8GM-CM%U%!%$%k=PNO%9%$%C%A(J
      LOGICAL    OEIVEC                 !" $@8GM-4X?t%U%!%$%k=PNO%9%$%C%A(J
      CHARACTER  FNGROW * (NFILN)       !" $@@.D9N(=PNO%U%!%$%kL>(J
      CHARACTER  FNFREQ * (NFILN)       !" $@?6F0?t=PNO%U%!%$%kL>(J
*
      NAMELIST   / NMLDIA / OEIGEN, OEIGFI, OEIVEC, FNGROW, FNFREQ
*
      INTEGER    IFPAR, JFPAR
      LOGICAL    OFIRST
      DATA       OFIRST  / .TRUE. /
*
      SAVE
*
*"         < 1. NAMELIST $@$NFI$_9~$_(J >
*
      IF( OFIRST )THEN
         OFIRST = .FALSE.
*
         OEIGEN = .TRUE.
         OEIGFI = .FALSE.
         OEIVEC = .FALSE.
         FNGROW = ' '
         FNFREQ = ' '
*
         CALL   REWNML ( IFPAR , JFPAR )
         READ   ( IFPAR, NMLDIA, END=1190 )
 1190    WRITE  ( JFPAR, NMLDIA  )
      ENDIF
*
      OLDIAG = OEIGEN
      OLDIAF = OEIGFI
      OLDIAV = OEIVEC
      FNGR   = FNGROW
      FNFR   = FNFREQ
*
      RETURN
      END
