      SUBROUTINE HTC20(DJ,IS,XYZ,VXYZ)

!------------------------------------------------------------------------------!
! Positions (in astronomical unit) and velocities (in astronomical unit per
! Julian year of 365.25 days) of Helene, Telesto, and Calypso referred to
! the center of Saturn and to the mean ecliptic and mean equinox of J2000.

! From: "An upgraded theory for Helene, Telesto, and Calypso"
! Oberti P., Vienne A., 2002, A&A XXX, XXX
! Pascal.Oberti@obs-nice.fr / Alain.Vienne@imcce.fr

! Input: DJ (real*8); IS (integer)
! DJ: a Saturnian time in Julian day (Terrestrial Time minus light time)
! IS: the satellite's number (1: Helene, 2: Telesto, 3: Calypso)

! Output: XYZ(3) (real*8 array); VXYZ(3) (real*8 array)
! XYZ: the 3 Cartesian coordinates of the satellite's position (a.u.)
! VXYZ: the 3 Cartesian coordinates of the satellite's velocity (a.u./year)
!------------------------------------------------------------------------------!

      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION XYZ(3),VXYZ(3)
      DIMENSION RNU1(3),RNU2(3),RNU3(3),RLAMDA(3)
      DIMENSION PHI1(3),PHI2(3),PHI3(3),THETA(3)
      DIMENSION IH(0:4,24),IT(0:4,12),IC(0:4,24)
      DIMENSION RH(6,24),RT(6,12),RC(6,24)
      DATA RNU1/2.29427177,3.32489098,-3.32489617/
      DATA RNU2/-0.00802443,-0.00948045,0.00946761/
      DATA RNU3/2.29714724,3.33170385,-3.33170262/
      DATA RLAMDA/2.29571726,3.32830561,3.32830561/
      DATA PHI1/3.27342548,6.24233590,5.41384760/
      DATA PHI2/1.30770422,4.62624497,1.36874776/
      DATA PHI3/0.77232982,0.04769409,5.64157287/
      DATA THETA/3.07410251,3.24465053,3.25074880/
      DATA IH/0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,0,1,0,1,0,0,2,0,
     &1,1,0,2,0,1,0,0,3,0,1,0,1,0,0,-1,1,1,0,0,-1,0,0,1,0,-1,1,0,1,0,-1,
     &0,0,2,0,-1,1,0,2,0,-1,0,0,3,0,-1,1,0,0,1,0,0,1,0,0,1,1,0,3,0,1,1,
     &0,3,0,-1,1,1,1,0,1,1,1,-1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,-1,0,1/
      DATA RH/-0.002396,-0.000399,0.000442,0.001278,-0.004939,0.002466,
     &0.000557,-0.002152,0.001074,0.005500,0.000916,-0.001015,-0.000003,
     &0.,0.,0.000003,-0.000011,0.000006,-0.000066,0.000265,-0.000133,
     &-0.000676,-0.000107,0.000122,-0.000295,-0.000047,0.000053,
     &0.000151,-0.000607,0.000303,0.000015,0.000017,-0.000010,-0.000044,
     &0.000033,-0.000013,-0.000019,0.000014,-0.000006,-0.000035,
     &-0.000038,0.000023,0.000002,0.,0.,-0.000002,0.000004,-0.000002,
     &-0.000002,0.000008,-0.000004,0.,0.,0.,0.000009,0.,-0.000002,0.,0.,
     &0.,-0.000067,0.000264,-0.000132,-0.000677,-0.000110,0.000123,
     &0.000294,0.000048,-0.000053,-0.000154,0.000608,-0.000304,0.000015,
     &0.000016,-0.000010,-0.000044,0.000033,-0.000013,0.000019,
     &-0.000014,0.000006,0.000035,0.000038,-0.000023,0.000002,0.,0.,
     &-0.000002,0.000004,-0.000002,0.,0.000005,0.000010,0.,0.,0.,0.,
     &0.000002,0.,-0.000013,-0.000002,0.000002,0.,0.000002,0.,-0.000004,
     &-0.000002,0.,0.,-0.000002,0.,0.000004,0.000002,0.,0.,0.,0.,
     &-0.000003,0.,0.,0.,0.,0.,-0.000003,0.,0.,0.,0.,0.,0.,0.000005,
     &0.000010,0.,0.,0.,0.,0.000003,0.,0.,0.,0.,0.,0.000003,0./
      DATA IT/1,0,0,1,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,0,1,0,
     &1,1,1,0,0,-1,0,0,1,0,-1,1,0,1,0,-1,0,1,0,0,1,0,1,0,0,-1,0,0,0,1,0/
      DATA RT/0.000002,0.000010,0.000019,0.,0.,0.,
     &-0.001933,-0.000253,0.000320,0.001237,-0.005767,0.002904,0.000372,
     &-0.001733,0.000873,0.006432,0.000842,-0.001066,-0.000002,0.,0.,
     &0.000003,-0.000014,0.000007,-0.000006,0.000029,-0.000015,
     &-0.000108,-0.000014,0.000018,-0.000033,-0.000004,0.000005,
     &0.000020,-0.000097,0.000049,0.000007,0.,0.,0.,0.,0.,-0.000006,
     &0.000029,-0.000015,-0.000108,-0.000014,0.000018,0.000032,0.000004,
     &-0.000005,-0.000021,0.000097,-0.000049,0.,0.000002,0.,-0.000016,
     &-0.000002,0.000003,0.,0.000007,-0.000003,0.,0.,0.,0.,0.,0.,
     &0.000002,0.000010,0.000019/
      DATA IC/1,0,0,1,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,
     &1,1,0,1,0,1,0,0,2,0,1,0,1,0,0,-1,0,0,1,0,-1,1,0,1,0,-1,0,0,2,0,-1,
     &1,0,2,0,1,1,1,0,0,-1,1,0,2,0,-1,0,0,1,1,0,0,0,1,-1,0,0,0,0,1,0,0,
     &1,1,0,-1,0,1,-1,0,-1,1,1,1,0,-1,1,1,-1,0,-1,1,0,1,1,0,1,0,1,-1,0/
      DATA RC/0.000005,0.000027,0.000052,0.,0.,0.,0.000651,0.001615,
     &-0.000910,-0.006145,0.002170,-0.000542,-0.000011,0.000004,0.,0.,
     &0.,0.,-0.001846,0.000652,-0.000163,-0.002166,-0.005375,0.003030,
     &-0.000004,-0.000010,0.000006,0.,0.,0.,-0.000077,0.000028,
     &-0.000007,-0.000092,-0.000225,0.000127,-0.000028,-0.000067,
     &0.000038,0.000257,-0.000092,0.000023,-0.000002,0.,0.,0.000004,
     &-0.000006,0.000003,-0.000004,0.,0.,-0.000009,-0.000022,0.000012,
     &-0.000078,0.000027,-0.000007,-0.000089,-0.000225,0.000127,
     &0.000027,0.000068,-0.000038,-0.000257,0.000089,-0.000022,
     &-0.000002,0.,0.,0.000004,-0.000006,0.000003,0.,-0.000002,0.,
     &0.000007,0.000003,-0.000002,0.,0.000003,-0.000002,-0.000025,
     &0.000009,-0.000002,0.,0.000002,0.,-0.000007,-0.000003,0.000002,
     &0.,0.,-0.000002,0.,0.,0.,0.,0.,-0.000002,0.,0.,0.,0.,0.,0.,
     &0.000005,0.000027,0.000052,0.,0.,0.,0.000002,0.,0.,0.,0.,0.,
     &0.000002,0.,0.,0.,0.,0.,0.,-0.000002,0.,0.,0.,0.,0.,-0.000002,0.,
     &0.,0.,0.,0.,0.,0.000002,0.,0.,0.,0.,0.,-0.000002/

      T=DJ-2451545.D0
      DO I=1,3
        XYZ(I)=0.D0
        VXYZ(I)=0.D0
      ENDDO
      IF(IS.EQ.1) THEN
        DO I=1,24
          ANG=IH(1,I)*(RNU1(1)*T+PHI1(1))+IH(2,I)*(RNU2(1)*T+PHI2(1))+
     +        IH(3,I)*(RNU3(1)*T+PHI3(1))+IH(4,I)*(RLAMDA(1)*T+THETA(1))
          IF(IH(0,I).EQ.0) THEN
            TRG=COS(ANG)
          ELSE
            TRG=SIN(ANG)
          ENDIF
          VTRG=TRG*365.25D0
          DO J=1,3
            XYZ(J)=XYZ(J)+RH(J,I)*TRG
            VXYZ(J)=VXYZ(J)+RH(J+3,I)*VTRG
          ENDDO
        ENDDO
      ELSE IF(IS.EQ.2) THEN
        DO I=1,12
          ANG=IT(1,I)*(RNU1(2)*T+PHI1(2))+IT(2,I)*(RNU2(2)*T+PHI2(2))+
     +        IT(3,I)*(RNU3(2)*T+PHI3(2))+IT(4,I)*(RLAMDA(2)*T+THETA(2))
          IF(IT(0,I).EQ.0) THEN
            TRG=COS(ANG)
          ELSE
            TRG=SIN(ANG)
          ENDIF
          VTRG=TRG*365.25D0
          DO J=1,3
            XYZ(J)=XYZ(J)+RT(J,I)*TRG
            VXYZ(J)=VXYZ(J)+RT(J+3,I)*VTRG
          ENDDO
        ENDDO
      ELSE IF(IS.EQ.3) THEN
        DO I=1,24
          ANG=IC(1,I)*(RNU1(3)*T+PHI1(3))+IC(2,I)*(RNU2(3)*T+PHI2(3))+
     +        IC(3,I)*(RNU3(3)*T+PHI3(3))+IC(4,I)*(RLAMDA(3)*T+THETA(3))
          IF(IC(0,I).EQ.0) THEN
            TRG=COS(ANG)
          ELSE
            TRG=SIN(ANG)
          ENDIF
          VTRG=TRG*365.25D0
          DO J=1,3
            XYZ(J)=XYZ(J)+RC(J,I)*TRG
            VXYZ(J)=VXYZ(J)+RC(J+3,I)*VTRG
          ENDDO
        ENDDO
      ENDIF

      RETURN
      END
