



      SUBROUTINE GVSW2M (RMAT1,RMAT2)















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       J,I
      REAL          RMAT1(3,3), RMAT2(3,3), ARTOT, GVFMAX, GVFMIN
      CHARACTER*10  FMTL, TMAT1(3,3),TMAT2(3,3)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT1,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT1,9))
      ARTOT=MAX(ARTOT,GVFMAX(RMAT2,9))
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT2,9))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT1,RMAT1,9,FMTL)
      CALL GVSFRA (TMAT2,RMAT2,9,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1142')
      DO 10 I=1,3
         WRITE (LOCLIN,FMT,ERR=997)(TMAT1(I,J),J=1,3),(TMAT2(I,J),J=1,3)
         CALL GVSTT6 (LOCLIN)
 10   CONTINUE
      TEXLEVEL=SAVLEVEL
      IF (TEXLEVEL.NE.' ') THEN
         WRITE (TEXUNT,1200,ERR=997)
         WRITE (TEXUNT,1100,ERR=997) ((TMAT1(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1210,ERR=997)
         WRITE (TEXUNT,1100,ERR=997) ((TMAT2(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1220,ERR=997)
      END IF
      GOTO 998



 997  CONTINUE
      CALL GVSEIW ('GVSW2M')
      TEXLEVEL=' '



 998  CONTINUE



 1100 FORMAT (A10,'&',A10,'&',A10,'\\\\')

 1200 FORMAT ('\\halfpage{$\\left['/,'\\begin{array}{rrr}')
 1210 FORMAT ('\\end{array}'/,'\\right]$}%'/,
     +        '\\halfpage{$\\left['/,'\\begin{array}{rrr}')
 1220 FORMAT ('\\end{array}'/,'\\right]$}')


      RETURN
      END
      SUBROUTINE GVSW3M (RMAT1,RMAT2,RMAT3)














      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       J,I
      REAL          RMAT1(3,3), RMAT2(3,3), RMAT3(3,3), ARTOT,
     +              GVFMAX, GVFMIN
      LOGICAL       GVFFOP
      CHARACTER*10  FMTL, TMAT1(3,3), TMAT2(3,3), TMAT3(3,3)







      ARTOT=GVFMAX(RMAT1,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT1,9))
      ARTOT=MAX(ARTOT,GVFMAX(RMAT2,9))
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT2,9))
      ARTOT=MAX(ARTOT,GVFMAX(RMAT3,9))
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT3,9))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT1,RMAT1,9,FMTL)
      CALL GVSFRA (TMAT2,RMAT2,9,FMTL)
      CALL GVSFRA (TMAT3,RMAT3,9,FMTL)



      CALL GVSFMT ('?FMT791')
      WRITE (6,FMT,ERR=998)
     +     (TMAT1(1,J),J=1,3), (TMAT2(1,J),J=1,3), (TMAT3(1,J),J=1,3),
     +     (TMAT1(2,J),J=1,3), (TMAT2(2,J),J=1,3), (TMAT3(2,J),J=1,3),
     +     (TMAT1(3,J),J=1,3), (TMAT2(3,J),J=1,3), (TMAT3(3,J),J=1,3)
      IF (GVFFOP(16)) WRITE (16,FMT,ERR=997)
     +     (TMAT1(1,J),J=1,3), (TMAT2(1,J),J=1,3), (TMAT3(1,J),J=1,3),
     +     (TMAT1(2,J),J=1,3), (TMAT2(2,J),J=1,3), (TMAT3(2,J),J=1,3),
     +     (TMAT1(3,J),J=1,3), (TMAT2(3,J),J=1,3), (TMAT3(3,J),J=1,3)
      IF (GVFFOP(PDBUNT)) WRITE (PDBUNT,FMT,ERR=999)
     +     (TMAT1(1,J),J=1,3), (TMAT2(1,J),J=1,3), (TMAT3(1,J),J=1,3),
     +     (TMAT1(2,J),J=1,3), (TMAT2(2,J),J=1,3), (TMAT3(2,J),J=1,3),
     +     (TMAT1(3,J),J=1,3), (TMAT2(3,J),J=1,3), (TMAT3(3,J),J=1,3)
      IF (TEXLEVEL.NE.' ') THEN
         WRITE (TEXUNT,1200,ERR=998)
         WRITE (TEXUNT,1100,ERR=998) ((TMAT1(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1210,ERR=998)
         WRITE (TEXUNT,1100,ERR=998) ((TMAT2(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1210,ERR=998)
         WRITE (TEXUNT,1100,ERR=998) ((TMAT3(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1220,ERR=998)
      END IF
      GOTO 996



 997  CONTINUE
      CALL GVSCLF (16)
      CALL GVSTTE ('?M3511')
      GOTO 996
 998  CONTINUE
      TEXLEVEL=' '
      CALL GVSTTE ('?M3512')
      GOTO 996
 999  CONTINUE
      CALL GVSTTE ('?M3513')



 996  CONTINUE



 1100 FORMAT (A10,'&',A10,'&',A10,'\\\\')

 1200 FORMAT ('\\fullpage{'/,'$\\left['/,'\\begin{array}{rrr}')
 1210 FORMAT ('\\end{array}'/,'\\right]$'/,
     +        '$\\left['/,'\\begin{array}{rrr}')
 1220 FORMAT ('\\end{array}'/,'\\right]$'/,'}')


      RETURN
      END
      SUBROUTINE GVSW4M (RMAT1,RMAT2,RMAT3,RMAT4)














      IMPLICIT      NONE
      REAL          RMAT1(3,3), RMAT2(3,3), RMAT3(3,3), RMAT4(3,3)







      CALL GVSW2M (RMAT1,RMAT2)
      CALL GVSNL6 (1)
      CALL GVSW2M (RMAT3,RMAT4)





      RETURN
      END
      SUBROUTINE GVSWM3 (RMAT)













      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      REAL          RMAT(3,3), ARTOT, GVFMAX, GVFMIN
      INTEGER       I, J
      CHARACTER*10  FMTL, TMAT(3,3)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT,9))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT,RMAT,9,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1142')
      DO 10 I=1,3
         WRITE (LOCLIN,FMT,ERR=999) (TMAT(I,J),J=1,3)
         CALL GVSTT6 (LOCLIN)
 10   CONTINUE
      TEXLEVEL=SAVLEVEL
      IF (TEXLEVEL.NE.' ') THEN
         WRITE (TEXUNT,1200,ERR=999)
         WRITE (TEXUNT,1100,ERR=999) ((TMAT(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1210,ERR=999)
      END IF
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('GVSWM3')
      TEXLEVEL=' '



 998  CONTINUE



 1100 FORMAT (A10,'&',A10,'&',A10,'\\\\')

 1200 FORMAT ('\\fullpage{'/,'$\\left['/,'\\begin{array}{rrr}')
 1210 FORMAT ('\\end{array}'/,'\\right]$}')






      RETURN
      END
      SUBROUTINE GVSWM3V (RMAT,VECT)













      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      REAL          RMAT(3,3), VECT(3), ARTOT, GVFMAX, GVFMIN
      INTEGER       I, J
      CHARACTER*10  FMTL, TMAT(3,3), TVEC(3)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT,9))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT,RMAT,9,FMTL)
      CALL GVSFRA (TVEC,VECT,3,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1142')
      DO 10 I=1,3
         WRITE (LOCLIN,FMT,ERR=999) (TMAT(I,J),J=1,3),TVEC(I)
         CALL GVSTT6 (LOCLIN)
 10   CONTINUE
      TEXLEVEL=SAVLEVEL
      IF (TEXLEVEL.NE.' ') THEN
         WRITE (TEXUNT,1200,ERR=999)
         WRITE (TEXUNT,1100,ERR=999) (TMAT(1,J),J=1,3),TVEC(1)
         WRITE (TEXUNT,1100,ERR=999) (TMAT(2,J),J=1,3),TVEC(2)
         WRITE (TEXUNT,1100,ERR=999) (TMAT(3,J),J=1,3),TVEC(3)
         WRITE (TEXUNT,1210,ERR=999)
      END IF
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('GVSW3M')
      TEXLEVEL=' '



 998  CONTINUE



 1100 FORMAT (A10,'&',A10,'&',A10,'&',A10,'\\\\')

 1200 FORMAT ('$\\left['/,'\\begin{array}{rrrr}')
 1210 FORMAT ('\\end{array}'/,'\\right]$')






      RETURN
      END
      SUBROUTINE GVSW44 (RMAT)













      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       I, J
      REAL          RMAT(4,4), ARTOT, GVFMAX, GVFMIN
      CHARACTER*10  FMTL, TMAT(4,4)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT,16)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT,16))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT,RMAT,16,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1143')
      DO 10 I=1,4
         WRITE (LOCLIN,FMT,ERR=999) (TMAT(I,J),J=1,4)
         CALL GVSTT6 (LOCLIN)
 10   CONTINUE
      TEXLEVEL=SAVLEVEL
      IF (TEXLEVEL.NE.' ') THEN
         WRITE (TEXUNT,1200,ERR=999)
         WRITE (TEXUNT,1100,ERR=999) ((TMAT(I,J),J=1,4),I=1,4)
         WRITE (TEXUNT,1210,ERR=999)
      END IF
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('GVSW44')
      TEXLEVEL=' '



  998 CONTINUE



 1100 FORMAT (A10,'&',A10,'&',A10,'&',A10,'\\\\')

 1200 FORMAT ('\\fullpage{'/,'$\\left['/,'\\begin{array}{rrr}')
 1210 FORMAT ('\\end{array}'/,'\\right]$}')






      RETURN
      END
      SUBROUTINE GVSWM4 (RMAT,VECT)













      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       J
      REAL          RMAT(3,3), VECT(3), ARTOT,
     +              GVFMAX, GVFMIN, GVFGTA, GVFDET, GVFRTD
      CHARACTER*10  FMTL, TMAT(3,3), TVEC(3)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT,9))
      ARTOT=MAX(ARTOT,GVFMAX(VECT,3))
      ARTOT=MAX(ARTOT,-GVFMIN(VECT,3))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT,RMAT,9,FMTL)
      CALL GVSFRA (TVEC,VECT,3,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1144')
      WRITE (LOCLIN,FMT,ERR=999) (TMAT(1,J),J=1,3),
     + TVEC(1),GVFRTD(GVFGTA(RMAT))
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT1145')
      WRITE (LOCLIN,FMT,ERR=999) (TMAT(2,J),J=1,3),
     + TVEC(2),GVFDET(RMAT)
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT1146')
      WRITE (LOCLIN,FMT,ERR=999) (TMAT(3,J),J=1,3),TVEC(3)
      CALL GVSTT6 (LOCLIN)
      TEXLEVEL=SAVLEVEL
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('GVSWM4')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSWM5 (RMAT,VECT,RMS)













      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       J
      REAL          RMAT(3,3), VECT(3), ARTOT, RMS, GVFMAX, GVFMIN, 
     +              GVFGTA, GVFDET, GVFRTD
      CHARACTER*10  FMTL, TMAT(3,3), TVEC(3)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT,9))
      ARTOT=MAX(ARTOT,GVFMAX(VECT,3))
      ARTOT=MAX(ARTOT,-GVFMIN(VECT,3))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT,RMAT,9,FMTL)
      CALL GVSFRA (TVEC,VECT,3,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1144')
      WRITE (LOCLIN,FMT,ERR=999) (TMAT(1,J),J=1,3),TVEC(1),
     + GVFRTD(GVFGTA(RMAT))
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT1145')
      WRITE (LOCLIN,FMT,ERR=999) (TMAT(2,J),J=1,3),TVEC(2),
     + GVFDET(RMAT)
      CALL GVSTT6 (LOCLIN)
      CALL GVSFMT ('?FMT1147')
      WRITE (LOCLIN,FMT,ERR=999) (TMAT(3,J),J=1,3),TVEC(3),RMS
      CALL GVSTT6 (LOCLIN)
      TEXLEVEL=SAVLEVEL
      GOTO 998



 999  CONTINUE
      CALL GVSEIW ('GVSWM5')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE RHSWMV (RMAT,VECT)















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'PDBINC.INC'
      INTEGER       I,J
      REAL          RMAT(3,3), VECT(3), ARTOT, GVFMAX, GVFMIN
      CHARACTER*10  FMTL, TVEC(3), TMAT(3,3)
      CHARACTER*80  LOCLIN
      CHARACTER*3   SAVLEVEL







      ARTOT=GVFMAX(RMAT,9)
      ARTOT=MAX(ARTOT,-GVFMIN(RMAT,9))
      ARTOT=MAX(ARTOT,GVFMAX(VECT,3))
      ARTOT=MAX(ARTOT,-GVFMIN(VECT,3))
      CALL GVSFLF (FMTL,ARTOT)



      CALL GVSFRA (TMAT,RMAT,9,FMTL)
      CALL GVSFRA (TVEC,VECT,3,FMTL)



      SAVLEVEL=TEXLEVEL
      TEXLEVEL=' '
      CALL GVSFMT ('?FMT1148')
      DO 10 I=1,3
         WRITE (LOCLIN,FMT,ERR=999) (TMAT(I,J),J=1,3), TVEC(I)
         CALL GVSTT6 (LOCLIN)
 10   CONTINUE
      TEXLEVEL=SAVLEVEL
      IF (TEXLEVEL.NE.' ') THEN
         WRITE (TEXUNT,1200,ERR=999)
         WRITE (TEXUNT,1100,ERR=999) ((TMAT(I,J),J=1,3),I=1,3)
         WRITE (TEXUNT,1210,ERR=999)
         WRITE (TEXUNT,1300,ERR=999) (TVEC(I),I=1,3)
         WRITE (TEXUNT,1220,ERR=999)
      END IF
      GOTO 998



 999  CONTINUE
      CALL GVSTTE ('GVSWMV')
      TEXLEVEL=' '



  998 CONTINUE



 1100 FORMAT (A10,'&',A10,'&',A10,'\\\\')

 1200 FORMAT ('\\fullpage{'/,'$\\left['/,'\\begin{array}{rrr}')
 1210 FORMAT ('\\end{array}'/,'\\right]$'/,
     +        '$\\left['/,'\\begin{array}{r}')
 1220 FORMAT ('\\end{array}'/,'\\right]$}')

 1300 FORMAT (A10,'\\\\')


      RETURN
      END
      SUBROUTINE GVSFLF (FMT,R)







      IMPLICIT      NONE
      CHARACTER*(*) FMT
      REAL          R, LOCR





      LOCR=ABS(R)
      IF (LOCR.LT.9.9995) THEN
         CALL GVSFMTL (FMT,'?M5069')
      ELSE IF (LOCR.LT.99.9995) THEN
         CALL GVSFMTL (FMT,'?M5070')
      ELSE IF (LOCR.LT.999.9995) THEN
         CALL GVSFMTL (FMT,'?M5071')
      ELSE IF (LOCR.LT.9999.995) THEN
         CALL GVSFMTL (FMT,'?M5072')
      ELSE IF (LOCR.LT.99999.95) THEN
         CALL GVSFMTL (FMT,'?M5073')
      ELSE IF (LOCR.LT.999999.5) THEN
         CALL GVSFMTL (FMT,'?M5074')
      ELSE
         CALL GVSFMTL (FMT,'?M5075')
      END IF





      RETURN
      END
      SUBROUTINE GVSFRA (TEXT,ARR,NUM,FMT)







      IMPLICIT      NONE
      INTEGER       NUM
      CHARACTER*(*) FMT
      CHARACTER*10  TEXT(NUM)
      REAL          ARR(NUM)
      INTEGER       I





      DO 10 I=1,NUM
         WRITE (TEXT(I),FMT,ERR=999) ARR(I)
 10   CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('GVSFRA')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE GVSWV3 (VECT,LINE)












      IMPLICIT      NONE
      REAL          VECT(3)
      CHARACTER*80  LINE, FMT







      CALL GVSFMT ('?FMT1149')
      WRITE (LINE,FMT,ERR=999) VECT



      CALL GVSRDB (LINE)
      CALL GVSTT6 (LINE)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('GVSWV3')



  998 CONTINUE


      RETURN
      END
