C LAST UPDATE:
C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C*************************
C**       LRL_RECCEL    **
C*************************
C
CD-Routine: Convert Between Real and Reciprocal Cells - LRL_RECCEL
C This routine converts between real and reciprocal cell parameters.
CD-end
CD-Fortran:
      SUBROUTINE LRL_RECCEL(RX ,CX ,WAVE)
CD-end
C Purpose: Convert between real and reciprocal cell parameters. CX input,
C          RX output; angles in degrees
C
CD-Parameters:
C RX(6)   r  (W) Converted cell parameters reciprocal or real
C CX(6)   r  (R) Input cell parameters real or reciprocal
C WAVE    r  (R) Standard wavelength
CD-end

      DIMENSION CX(6),RX(6)

      REAL C(6)
      REAL DTOR

C
C-------------------------------------------------------------------------------
C
      
       DTOR = 0.0174533

      DO 10 I = 1, 3
         C(I) = CX(I)
 10   CONTINUE

      SUM = 0.
      DO 20 I = 4 , 6
         C(I) = DTOR*CX(I)
         SUM = SUM + 0.5*C(I)
 20   CONTINUE
 
      V = 1.
      DO 30 I = 4 , 6
         V = V*SIN(SUM-C(I))
 30   CONTINUE
 
      WV = WAVE/(2.*C(1)*C(2)*C(3)*SQRT(SIN(SUM)*V))

      RX(1) = C(2)*C(3)*SIN(C(4))*WV
      RX(2) = C(1)*C(3)*SIN(C(5))*WV
      RX(3) = C(1)*C(2)*SIN(C(6))*WV
 
      RX(4) = ACOS((COS(C(5))*COS(C(6))-COS(C(4)))
     +       /(SIN(C(5))*SIN(C(6))))
      RX(4) = RX(4)/DTOR

      RX(5) = ACOS((COS(C(6))*COS(C(4))-COS(C(5)))
     +       /(SIN(C(6))*SIN(C(4))))
      RX(5) = RX(5)/DTOR

      RX(6) = ACOS((COS(C(4))*COS(C(5))-COS(C(6)))
     +       /(SIN(C(4))*SIN(C(5))))
      RX(6) = RX(6)/DTOR
 
      RETURN
      END
