      SUBROUTINE GALACTIC(RA1950,DEC1950,GLAT,GLON)
C
C     GIVEN B1950 RIGHT ASCENSION AND DECLINATION (RADIANS) RETURN THE
C     GALACTIC LATITUDE AND LONGITUDE (RADIANS).
C
C     B. KNAPP, 1994-12-28, 2001-01-03
C
C     REFERENCE: J. MEEUS, ASTRONOMICAL ALGORITHMS, WILLMAN-BELL, 1991,
C     PP. 89-90.
C
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      IMPLICIT NONE
      REAL*8 RA1950,DEC1950,GLAT,GLON
C
C     CONSTANTS
      REAL*8 PI,TWOPI,D2R,RA_NGP,DEC_NGP,GLON0,CDEC,SDEC
      PARAMETER (PI=3.14159265358979324D0,TWOPI=2.0D0*PI,D2R=PI/180.D0)
      PARAMETER (RA_NGP=192.25D0*D2R,DEC_NGP=27.4D0*D2R,
     &   GLON0=303.0D0*D2R)
C
C     LOCAL VARIABLES
      REAL*8 CRA,SRA

      CDEC = COS(DEC_NGP)
      SDEC = SIN(DEC_NGP)
      CRA = COS(RA_NGP-RA1950)
      SRA = SIN(RA_NGP-RA1950)

C     COMPUTE GALACTIC LONGITUDE
      GLON = GLON0-ATAN2(SRA,(CRA*SDEC-TAN(DEC1950)*CDEC))
      IF (GLON .LT. 0) GLON = GLON+TWOPI

C     COMPUTE GALACTIC LATITUDE
      GLAT = ASIN(SIN(DEC1950)*SDEC+COS(DEC1950)*CDEC*CRA)

      RETURN
      END
