SUBROUTINE TEMPGM90
!use consts
use global
implicit none  
    
REAL(DP) :: B2(NSTLAY),gam
integer :: iloc,izloc,iz
save

CALL TSTAV90
     B2(1:NLAYST)=(RLAMR(1:NLAYST)*VOLST)/(CWQWGM*D1(1:NLAYST)*D1(1:NLAYST))
 !     DO 5 IZ=1,NLAYST
 !       B2(IZ)=(RLAMR(IZ)*VOLST)/(CWQWGM*D1(IZ)*D1(IZ))
 !   5 CONTINUE
      DO 10 ILOC=1,NLOC
        IZLOC=MOD(ILOC-1,NZLOC)+1
        IZ=ILAYST(IZLOC)
        GAM=B2(IZ)*VOLOC(ILOC)
        SFBETA(ILOC)=(1.-EXP(-GAM))*CWQWGM/(VOLOC(ILOC)*GVOHST)
   10 CONTINUE
      
RETURN
END subroutine tempgm90