      SUBROUTINE GAMRTDM
C     SOUND SPEED MODEL, C**2=GAMMA*R*T/M
      implicit DOUBLE PRECISION (a-h,o-z)

C     COMMON DECK "CC" INSERTED HERE
      DOUBLE PRECISION MODC
      COMMON/CC/MODC(4),CS,PCST,PCSR,PCSTH,PCSPH
C     COMMON DECK "TT" INSERTED HERE
      DOUBLE PRECISION MODT
      COMMON/TT/MODT(4), T,PTT,PTR,PTTH,PTPH
      DOUBLE PRECISION M,MODM
      COMMON/MM/MODM(4),M,PMT,PMR,PMTH,PMPH
C     COMMON DECK "CONST" INSERTED HERE
      COMMON/PCONST/CREF,RGAS,GAMMA
      COMMON/MCONST/PI,PIT2,PID2,DEGS,RAD,ALN10
C     COMMON DECK "WW" INSERTED HERE
      PARAMETER (NWARSZ=1000)
      COMMON/WW/ dum(10),MAXW,W(NWARSZ)
C
C     SOUND SPEED 150-174
      EQUIVALENCE (W(150),CMODEL),(W(151),CFORM),(W(152),CID)
      EQUIVALENCE (W(153),REFC)
C
C
C     COMMON DECK "B3" INSERTED HERE
      INTEGER CMX,CNTBL,CITBL,CFRMTBL,IDSC(10)
      COMMON/B3/CMX,CNTBL(10),CITBL(10),CFRMTBL(10),CGP(512)
      EQUIVALENCE (CGP,IDSC),(ANC,CGP(11))
      DATA CMX/1/
      DATA CNTBL/1,11,8*0/
      DATA CITBL/1,9*0/
      DATA CFRMTBL/1,9*0/
C
      ENTRY SETSPD
	call SETPSP
	call SETTMP
      RETURN


      ENTRY ISPEED
C
      IF(REFC.GT.0.0) CREF=REFC
      if (w(150) .ne. 1.) then
           PRINT*,' Model check number mismatch: '
           STOP ' W(150) should be 1 if you are using model GAMRTDM.'
      endif

      MODC(1)=7HGAMRTDM
      MODC(2)= w(152)
      CALL ITEMP
      CALL IMOLWT
      CALL IPSPEED
C
      RETURN
C
      ENTRY SPEED
      CALL TEMP
      CALL MOLWT
      CS=GAMMA*RGAS*T/M
      PCST=CS*(PTT/T - PMT/M)
      PCSR=CS*(PTR/T - PMR/M)
      PCSTH=CS*(PTTH/T - PMTH/M)
      PCSPH=CS*(PTPH/T - PMPH/M)
C
C
      CALL PSPEED
      RETURN
      END
