      subroutine tensor (cel,t,cosi,ipr,icomp)                          TENS001
c --------------------------------------------------------------------- TENS002
c     print the metric tensor and  transformation matrix                TENS003
c --------------------------------------------------------------------- TENS004
c     This program module is part of the PhysiSoft X-ray Library        TENS005
c     and may not be sold or reproduced for commercial purposes.        TENS006
c     Although it has been tested carefully, there is no warranty       TENS007
c     regarding accuracy or freedom from side-effects.                  TENS008
c                   (C) 1986-1990 Bernhard Rupp                         TENS009
c ----------------------------------------------------------------------TENS010
c     Revision 4.0 : print coordinate transformation into CORMAT.DAT    TENS011
c ----------------------------------------------------------------------TENS012
                                                                        TENS013
      character lo,lu,ro,ru,mi,icomp*4                                  TENS014
      dimension cel(6),t(3,3),tm(3,3),cosi(3)                           TENS015
      if (icomp.eq.'IBM ') then                                         TENS016
         lo=char(218)                                                   TENS017
         lu=char(192)                                                   TENS018
         ro=char(191)                                                   TENS019
         ru=char(217)                                                   TENS020
         mi=char(179)                                                   TENS021
      else                                                              TENS022
         lo='|'                                                         TENS023
         lu=lo                                                          TENS024
         ro=lo                                                          TENS025
         ru=lo                                                          TENS026
         mi=lo                                                          TENS027
      end if                                                            TENS028
                                                                        TENS029
      tm(1,2)=cel(1)*cel(2)*cosi(3)                                     TENS030
      tm(1,3)=cel(1)*cel(3)*cosi(2)                                     TENS031
      tm(2,3)=cel(2)*cel(3)*cosi(1)                                     TENS032
      do 0001 i=1,3                                                     TENS033
         tm(i,i)=cel(i)**2                                              TENS034
         do 0001,j=1,3                                                  TENS035
            tm(j,i)=tm(i,j)                                             TENS036
 0001 continue                                                          TENS037
                                                                        TENS038
      call frames (ipr,2,icomp)                                         TENS039
      write(ipr,'(1x,a1,4x,a,8x,a1)') mi,                               TENS040
     &    'Real space metric tensor used            Metric orthogonalization041
     &tion',mi                                                          TENS042
      write(ipr,'(1x,a1,6x,a,10x,a1)') mi,                              TENS043
     &'for distance calculation                transformation matrix',miTENS044
      write(ipr,'(1x,a1,3x,a1,31x,a1,5x,a1,28x,a1,6x,a1)')              TENS045
     & mi,lo,ro,lo,ro,mi                                                TENS046
      do 0002 j=1,3                                                     TENS047
      write(ipr,'(1x,a1,3x,a1,3f10.3,1x,a1,5x,a1,3f9.5,1x,a1,6x,a1)')   TENS048
     & mi,mi,(tm(j,i),i=1,3),mi,mi,(t(j,i),i=1,3),mi,mi                 TENS049
 0002 continue                                                          TENS050
c --- write transformation matrix out into file CORMAT.DAT ---          TENS051
      open(17,file='cormat.dat',status='unknown')                       TENS052
      do 0003 j=1,3                                                     TENS053
         write(17,'(3f12.6)') (t(j,i),i=1,3)                            TENS054
 0003 continue                                                          TENS055
      close(17, status='keep')                                          TENS056
      write(ipr,'(1x,a1,3x,a1,31x,a1,5x,a1,28x,a1,6x,a1)')              TENS057
     & mi,lu,ru,lu,ru,mi                                                TENS058
      call frames (ipr,3,icomp)                                         TENS059
      return                                                            TENS060
      end                                                               TENS061
