      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
      character lo,lu,ro,ru,mi,icomp*4                                  TENS011
      dimension cel(6),t(3,3),tm(3,3),cosi(3)                           TENS012
      if (icomp.eq.'IBM ') then                                         TENS013
         lo=char(218)                                                   TENS014
         lu=char(192)                                                   TENS015
         ro=char(191)                                                   TENS016
         ru=char(217)                                                   TENS017
         mi=char(179)                                                   TENS018
      else                                                              TENS019
         lo='|'                                                         TENS020
         lu=lo                                                          TENS021
         ro=lo                                                          TENS022
         ru=lo                                                          TENS023
         mi=lo                                                          TENS024
      end if                                                            TENS025
                                                                        TENS026
      tm(1,2)=cel(1)*cel(2)*cosi(3)                                     TENS027
      tm(1,3)=cel(1)*cel(3)*cosi(2)                                     TENS028
      tm(2,3)=cel(2)*cel(3)*cosi(1)                                     TENS029
      do 0001 i=1,3                                                     TENS030
         tm(i,i)=cel(i)**2                                              TENS031
         do 0001,j=1,3                                                  TENS032
            tm(j,i)=tm(i,j)                                             TENS033
 0001 continue                                                          TENS034
                                                                        TENS035
      call frames (ipr,2,icomp)                                         TENS036
      write(ipr,'(1x,a1,4x,a,8x,a1)') mi,                               TENS037
     &    'Real space metric tensor used            Contravariant coordiTENS038
     &nate',mi                                                          TENS039
      write(ipr,'(1x,a1,6x,a,10x,a1)') mi,                              TENS040
     &'for distance calculation                transformation matrix',miTENS041
      write(ipr,'(1x,a1,3x,a1,31x,a1,5x,a1,28x,a1,6x,a1)')              TENS042
     & mi,lo,ro,lo,ro,mi                                                TENS043
      do 1001 j=1,3                                                     TENS044
      write(ipr,'(1x,a1,3x,a1,3f10.3,1x,a1,5x,a1,3f9.5,1x,a1,6x,a1)')   TENS045
     & mi,mi,(tm(j,i),i=1,3),mi,mi,(t(j,i),i=1,3),mi,mi                 TENS046
 1001 continue                                                          TENS047
      write(ipr,'(1x,a1,3x,a1,31x,a1,5x,a1,28x,a1,6x,a1)')              TENS048
     & mi,lu,ru,lu,ru,mi                                                TENS049
      call frames (ipr,3,icomp)                                         TENS050
      return                                                            TENS051
      end                                                               TENS052
