      SUBROUTINE AHNFNC                                                 NFNC001 
	character*8 id,ndate,modx,mody,modz,modrin,koll,modsav
C          CALCULATES THE REFRACTIVE INDEX AND ITS GRADIENT USING THE   NFNC002 
C          APPLETON-HARTREE FORMULA -- NO FIELD, NO COLLISIONS          NFNC003 
      COMMON /CONST/ PI,PIT2,PID2,DEGS,RADIAN,K,C,LOGTEN                NFNC004 
      COMMON /RIN/ MODRIN(3),COLL,FIELD,SPACE,KAY2,KAY2I,               NFNC005 
     1             H,HI,PHPT,PHPTI,PHPR,PHPRI,PHPTH,PHPTHI,PHPPH,PHPPHI,NFNC006 
     2             PHPOM,PHPOMI,PHPKR,PHPKRI,PHPKTH,PHPKTI,PHPKPH,PHPKPINFNC007 
     3            ,KPHPK,KPHPKI,POLAR,POLARI,LPOLAR,LPOLRI,SGN          NFNC008 
      COMMON /XX/ MODX(2),X,PXPR,PXPTH,PXPPH,PXPT,HMAX                  NFNC009 
      COMMON /YY/ MODY,Y(16)  /ZZ/ MODZ,Z(4)                            NFNC010 
      COMMON /RK/ N,STEP,MODE,E1MAX,E1MIN,E2MAX,E2MIN,FACT,RSTART       NFNC011 
      COMMON R,TH,PH,KR,KTH,KPH   /WW/ ID(10),W0,W(400)                 NFNC012 
      EQUIVALENCE (RAY,W(1)),(F,W(6))                                   NFNC013 
      LOGICAL SPACE                                                     NFNC014 
      REAL N2,NNP,KR,KTH,KPH,K2,KPHPK,KPHPKI,KAY2,KAY2I,LPOLAR,LPOLRI   NFNC015 
	data modrin,mody,modz / 'appleton','-hartree',' formula',
     a       ' ',' ' /
	data coll,field,kay2i,hi,phpti,phpri,phpthi,phpphi,phpomi,
     a  phpkri,phpkti,phpkpi,kphpki,polar,lpolar,x,pxpr,pxpth,pxpph,
     a  pxpr,  polari,lpolri / 20*0.0,2*1.0 /
c
      ENTRY RINDEX                                                      NFNC024 
      OM=PIT2*1.E6*F                                                    NFNC025 
      C2=C*C                                                            NFNC026 
      K2=KR*KR+KTH*KTH+KPH*KPH                                          NFNC027 
      OM2=OM*OM                                                         NFNC028 
      VR =C/OM*KR                                                       NFNC029 
      VTH=C/OM*KTH                                                      NFNC030 
      VPH=C/OM*KPH                                                      NFNC031 
      CALL ELECTX                                                       NFNC032 
      PNPR =PNPX*PXPR                                                   NFNC033 
      PNPTH=PNPX*PXPTH                                                  NFNC034 
      PNPPH=PNPX*PXPPH                                                  NFNC035 
      PNPT=PNPX*PXPT                                                    NFNC036 
      N2=1.-X                                                           NFNC037 
      SPACE=N2.EQ.1.                                                    NFNC038 
      KAY2=OM2/C2*N2                                                    NFNC039 
      IF(RSTART.EQ.0.) GO TO 1                                          NFNC040 
      SCALE=SQRT(KAY2/K2)                                               NFNC041 
      KR =SCALE*KR                                                      NFNC042 
      KTH=SCALE*KTH                                                     NFNC043 
      KPH=SCALE*KPH                                                     NFNC044 
  1   CONTINUE                                                          NFNC045 
C********* CALCULATES A HAMILTONIAN H                                   NFNC046 
      H=.5*(C2*K2/OM2-N2)                                               NFNC047 
C********* AND ITS PARTIAL DERIVATIVES WITH RESPECT TO                  NFNC048 
C********* TIME, R, THETA, PHI, OMEGA, KR, KTHETA, AND KPHI.            NFNC049 
      PHPT =-PNPT                                                       NFNC050 
      PHPR =-PNPR                                                       NFNC051 
      PHPTH=-PNPTH                                                      NFNC052 
      PHPPH=-PNPPH                                                      NFNC053 
      PHPOM=-NNP/OM                                                     NFNC054 
      PHPKR =C2/OM2*KR                                                  NFNC055 
      PHPKTH=C2/OM2*KTH                                                 NFNC056 
      PHPKPH=C2/OM2*KPH                                                 NFNC057 
      KPHPK=N2                                                          NFNC058 
      RETURN                                                            NFNC059 
         END                                                            NFNC060 
