      PROGRAM LEA406b

C EXAMPLE OF CALLING THE 'LEA406.FOR' SUBROUTINE: 
C CALCULATION OF LUNAR RECTANGULAR COORDINATES ON THE BASE OF SIMPLIFIED LEA-406b SERIES

      IMPLICIT REAL*8 (A-H,O-Z)
      DIMENSION TDB(2), P(3) 

      DATA MODEL/1/ ! SIMPLIFIED LEA-406b SERIES ARE USED      
      DATA DATE_MIN/625673.5D0/, DATE_MAX/2816787.5D0/, STEP/219112.D0/ ! [JD],  [3000BC - 3000AD]
C
C INITIALIZATION OF TDB ARRAY (2-WORD D.P. JULIAN DATE (TDB) AT WHICH LUNAR POSITION IS WANTED) 
C
      TDB(1)=2451545.D0
      TDB(2)=DATE_MIN-TDB(1)
C
C CALCULATION OF GEOCENTRIC POSITION OF THE MOON REFERENCED TO THE EARTH MEAN EQUATOR AND EQUINOX OF J2000 
C (THE REFERENCE FRAME OF NUMERICAL LUNAR EPHEMERIS LE-405/406).
C THE UNITS ARE KM.
C 
    1 DO WHILE (TDB(1)+TDB(2).LE.DATE_MAX) 

       CALL LEA406(TDB,MODEL,P)
C
C PRINTING THE RESULTS
C
       WRITE (*,'(F17.8,3F17.5,F12.5)') TDB(1)+TDB(2), P

       TDB(2)=TDB(2)+STEP

      END DO 

      IF (TDB(1)+TDB(2)-STEP.LT.DATE_MAX) THEN
        TDB(2)=DATE_MAX-TDB(1)
        GO TO 1
      END IF

      STOP
      END
C
C                               RESULTS OF CALCULATION:
C
C   GEOCENTRIC RECTANGULAR COORDINATES THE MOON IN THE MEAN GEOEQUATOR AND EQUINOX OF J2000.0 
C   CALCULATED ON THE BASE OF SIMPLIFIED ANALYTICAL SERIES LEA-406b (KUDRYAVTSEV 2007)
C
C   JULIAN DATE, TDB       X, KM            Y, KM            Z, KM              DIFFERENCE FROM DE-406, KM
C    625673.50000000     285686.29630    -245953.19270    -149153.92172    |    0.15758
C    844785.50000000    -320539.24186    -208879.11514    -132931.30936    |    0.06171
C   1063897.50000000    -189495.95763     333702.03981     109539.07657    |    0.02583
C   1283009.50000000     372166.73405     126768.17941      21074.25557    |    0.02266
C   1502121.50000000      64242.32146    -338587.23128    -182758.03487    |    0.02543
C   1721233.50000000    -373831.13828      18615.93694     -21946.94734    |    0.03276
C   1940345.50000000     106772.79031     325905.11429     121205.70007    |    0.03499
C   2159457.50000000     316496.92619    -168645.93461     -88859.03233    |    0.01564
C   2378569.50000000    -246564.25381    -243544.50367    -116301.43970    |    0.02093
C   2597681.50000000    -188295.72163     282192.30268     122222.60909    |    0.04308
C   2816787.50000000     199010.62780    -333482.07521    -104947.63891    |    0.26627
