      SUBROUTINE STAR_J2000
     &   ( PLACE_J2000, PROPER_MOTION_J2000, JDE, PLACE )
C
C     GIVEN THE J2000 MEAN RIGHT ASCENSION AND DECLINATION AND ANNUAL
C     PROPER MOTION (ALL IN RADIANS) OF A STAR, FIND THE APPARENT PLACE
C     OF THE STAR (CORRECTED FOR PROPER MOTION, PRECESSION, ABERRATION,
C     AND NUTATION) FOR A GIVEN JULIAN EPHEMERIS DATE.
C
C     B. KNAPP, 1993-06-21, 2001-01-03, 2001-04-24 (i*4)
C
C     BASED ON ALGORITHMS PRESENTED IN J. MEEUS, ASTRONOMICAL
C     ALGORITHMS, WILLMAN-BELL, 1992.
C
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      IMPLICIT NONE
C
C     INPUT
      REAL*8 PLACE_J2000(2),PROPER_MOTION_J2000(2),JDE
C
C     OUTPUT
      REAL*8 PLACE(2)
C
C     CONSTANTS
      REAL*8 PI
      PARAMETER (PI=3.14159265358979324D0)
      REAL*8 J2000,JDE_J2000
      PARAMETER(J2000=2000.D0, JDE_J2000 = 2451545.D0)
C
C     TIME-DEPENDENT VARIABLES
      REAL*8 JDE_PREV,NY,PN(3,3)
      LOGICAL*4 INIT /.TRUE./
      SAVE JDE_PREV,NY,PN,INIT
C
C     OTHER LOCAL VARIABLES
      REAL*8 RA,DEC,DRA,DDEC,ACC,S0(3),S1(3)
      INTEGER*4 I,J
C
C     FUNCTIONS AND SUBROUTINES
      EXTERNAL ABERRAT,PNMATRIX_J2000
C
C
C     IF WE HAVE A NEW JDE, WE NEED TO INITIALIZE THE TIME-DEPENDENT
C     VARIABLES
      IF (INIT .OR. JDE .NE. JDE_PREV) THEN
         CALL PNMATRIX_J2000(JDE,PN)
         NY = (JDE-JDE_J2000)/365.25D0
         JDE_PREV = JDE
         INIT = .FALSE.
      ENDIF
C
C     APPLY PROPER MOTION
      RA = PLACE_J2000(1)+NY*PROPER_MOTION_J2000(1)
      DEC = PLACE_J2000(2)+NY*PROPER_MOTION_J2000(2)
C
C     APPLY ABERRATION (IN J2000 REFERENCE SYSTEM)
      CALL ABERRAT(JDE,RA,DEC,DRA,DDEC)
      RA = RA+DRA
      DEC = DEC+DDEC
C
C     TRANSFORM TO RECTANGULAR COORDINATES TO APPLY PRECESSION AND
C     NUTATION
      S0(1) = COS(RA)*COS(DEC)
      S0(2) = SIN(RA)*COS(DEC)
      S0(3) = SIN(DEC)

C     APPLY PRECESSION, THEN NUTATION
      DO I=1,3
         ACC = 0.
         DO J=1,3
            ACC = ACC+PN(I,J)*S0(J)
         ENDDO
         S1(I) = ACC
      ENDDO
C      
      RA = ATAN2(S1(2),S1(1))
      IF (RA .LT. 0.) RA = RA+2.*PI
      DEC = ASIN(S1(3))
C
      PLACE(1) = RA
      PLACE(2) = DEC
      RETURN
      END
