      SUBROUTINE AHNFWC                                                 NFWC010 
C          CALCULATES THE REFRACTIVE INDEX AND ITS GRADIENT USING THE   NFWC011 
C          APPLETON-HARTREE FORMULA -- NO FIELD, WITH COLLISIONS        NFWC012 
      COMMON /CONST/ PI,PIT2,PID2,DEGS,RADIAN,K,C,LOGTEN                NFWC013 
      COMMON /RIN/ MODRIN(3),COLL,FIELD,SPACE,KAY2,H,PHPT,PHPR,PHPTH,   NFWC014 
     1             PHPPH,PHPOM,PHPKR,PHPKTH,PHPKPH,KPHPK,POLAR,LPOLAR,  NFWC015 
     2             SGN                                                  NFWC016 
      COMMON /XX/ MODX(2),X,PXPR,PXPTH,PXPPH,PXPT,HMAX                  NFWC017 
      COMMON /YY/ MODY,Y(16)                                            NFWC018 
      COMMON /ZZ/ MODZ,Z,PZPR,PZPTH,PZPPH                               NFWC019 
      COMMON /RK/ N,STEP,MODE,E1MAX,E1MIN,E2MAX,E2MIN,FACT,RSTART       NFWC020 
      COMMON R,TH,PH,KR,KTH,KPH   /WW/ ID(10),W0,W(400)                 NFWC021 
      EQUIVALENCE (RAY,W(1)),(F,W(6))                                   NFWC022 
      LOGICAL SPACE                                                     NFWC023 
      REAL KR,KTH,KPH,K2                                                NFWC024 
      COMPLEX KAY2,H,PHPT,PHPR,PHPTH,PHPPH,PHPOM,PHPKR,PHPKTH,PHPKPH,   NFWC025 
     1        KPHPK,POLAR,LPOLAR,U,I,PNPX,PNPZ,                         NFWC026 
     2        N2,PNPR,PNPTH,PNPPH,PNPVR,PNPVTH,PNPVPH,NNP,PNPT          NFWC027 
      DATA (MODRIN=8HAPPLETON,8H-HARTREE,8H FORMULA),(COLL=1.),         NFWC028 
     1     (FIELD=0.),(POLAR=(0.,1.)),(LPOLAR=(0.,0.)),                 NFWC029 
     2     (X=0.),(PXPR=0.),(PXPTH=0.),(PXPPH=0.),(PXPT=0.),            NFWC030 
     3     (MODY=1H ),                                                  NFWC031 
     4     (Z=0.),(PZPR=0.),(PZPTH=0.),(PZPPH=0.),                      NFWC032 
     5     (I=(0.,1.)),(ABSLIM=1.E-5),(PNPVR=0.),(PNPVTH=0.),(PNPVPH=0.)NFWC033 
      ENTRY RINDEX                                                      NFWC034 
      OM=PIT2*1.E6*F                                                    NFWC035 
      C2=C*C                                                            NFWC036 
      K2=KR*KR+KTH*KTH+KPH*KPH                                          NFWC037 
      OM2=OM*OM                                                         NFWC038 
      VR =C/OM*KR                                                       NFWC039 
      VTH=C/OM*KTH                                                      NFWC040 
      VPH=C/OM*KPH                                                      NFWC041 
      CALL ELECTX                                                       NFWC042 
      CALL COLFRZ                                                       NFWC043 
      U=1.-I*Z                                                          NFWC044 
      N2=1.-X/U                                                         NFWC045 
      PNPX=-1./(2.*U)                                                   NFWC046 
      PNPZ=-I*X/(2.*U**2)                                               NFWC047 
      NNP=N2-(2.*X*PNPX+Z*PNPZ)                                         NFWC048 
      PNPR =PNPX*PXPR +PNPZ*PZPR                                        NFWC049 
      PNPTH=PNPX*PXPTH+PNPZ*PZPTH                                       NFWC050 
      PNPPH=PNPX*PXPPH+PNPZ*PZPPH                                       NFWC051 
      PNPT=PNPX*PXPT                                                    NFWC052 
      SPACE=REAL(N2).EQ.1..AND.ABS(AIMAG(N2)).LT.ABSLIM                 NFWC053 
      KAY2=OM2/C2*N2                                                    NFWC054 
      IF(RSTART.EQ.0.) GO TO 1                                          NFWC055 
      SCALE=SQRT(REAL(KAY2)/K2)                                         NFWC056 
      KR =SCALE*KR                                                      NFWC057 
      KTH=SCALE*KTH                                                     NFWC058 
      KPH=SCALE*KPH                                                     NFWC059 
  1   CONTINUE                                                          NFWC060 
C********* CALCULATES A HAMILTONIAN H                                   NFWC061 
      H=.5*(C2*K2/OM2-N2)                                               NFWC062 
C********* AND ITS PARTIAL DERIVATIVES WITH RESPECT TO                  NFWC063 
C********* TIME, R, THETA, PHI, OMEGA, KR, KTHETA, AND KPHI.            NFWC064 
      PHPT =-PNPT                                                       NFWC065 
      PHPR =-PNPR                                                       NFWC066 
      PHPTH=-PNPTH                                                      NFWC067 
      PHPPH=-PNPPH                                                      NFWC068 
      PHPOM=-NNP/OM                                                     NFWC069 
      PHPKR =C2/OM2*KR                                                  NFWC070 
      PHPKTH=C2/OM2*KTH                                                 NFWC071 
      PHPKPH=C2/OM2*KPH                                                 NFWC072 
      KPHPK=N2                                                          NFWC073 
      RETURN                                                            NFWC074 
         END                                                            NFWC075-
