C-----------------------------------------------------------------------------
      SUBROUTINE GHORIZ
C-----------------------------------------------------------------------------
C     TERRAIN MODEL USING FIXED OFFSET TO EARTHR'S SURFACE
C     COMMON DECK "GG" INSERTED HERE                      
      implicit double precision (a-h,o-z)
      DOUBLE PRECISION MODG
      COMMON/GG/MODG(4)                  
      COMMON/GG/G,PGR,PGRR,PGRTH,PGRPH   
      COMMON/GG/PGTH,PGPH,PGTHTH,PGPHPH,PGTHPH,GSELECT,GTIME
      COMMON/WW/ dum(10), MAXW,W(1000)
      EQUIVALENCE (EARTHR,W(1))
C     COMMON DECK "RKAM" INSERTED HERE
      DOUBLE PRECISION KR,KTH,KPH
      COMMON//R,TH,PH,KR,KTH,KPH,RKVARS(14),TPULSE,CSTEP,DRDT(20) 
      EQUIVALENCE (W(303), Z0) 
C     COMMON DECK "B9" INSERTED HERE
      INTEGER GMX,GNTBL,GITBL,GFRMTBL,IDSG(10)  
      COMMON/B9/GMX,GNTBL(10),GITBL(10),GFRMTBL(10),GGP(113)
      EQUIVALENCE (GGP,IDSG),(ANG,GGP(11))                  
      INTEGER GPX    ,GQTBL(10),GLTBL(10),GIRMTBL(10)       
      DATA GPX/1/           
      DATA GQTBL/1,11,8*0/  
      DATA GLTBL/1,9*0/     
      DATA GIRMTBL/1,9*0/   
c
c
      ENTRY SETTOP  
      GMX=GPX       
      CALL IMOVE(GNTBL,GQTBL,10)    
      CALL IMOVE(GITBL,GLTBL,10)    
      CALL IMOVE(GFRMTBL,GIRMTBL,10)
      CALL SETPTP   
      RETURN   
C              
      ENTRY ITOPOG
      IF(W(300) .NE. 1.) THEN
           PRINT*,' Model check number mismatch: '
           STOP ' W(300) should be 1 if you are using model GHORIZ.'
      ENDIF

      MODG(1)=6HGHORIZ 
      MODG(2)= w(302)
      CALL IPTOPOG     
      RETURN           
C                      
      ENTRY TOPOG      
      G=R-W(1)-Z0      
      PGR=1.d0         
      CALL CLEAR(PGRR,8)
      END               
