anchor.diff:              PMFD(JL,JK)=0.
               PMFDS(JL,JK)=0.
               PMFDQ(JL,JK)=0.
  -            PDMFDP(JL,JK-1)=0.
  +			if (jk.gt.1) then !edg with low model level top, things can get screwy and jk can endup = 1
  +	            PDMFDP(JL,JK-1)=0.
  +			end if
            END IF
         ELSE
            PMFU(JL,JK)=0.
  
positive.code: !*    1.      CALCULATE ENTRAINMENT AND DETRAINMENT RATES
  ! -------------------------------------------------------
    100 CONTINUE
           DO 150 JL=1,KLON
            IF( .NOT. LDCUM(JL).AND.KLAB(JL,KK+1).EQ.0.0.AND.  &
               PQEN(JL,KK).GT.0.80*PQSEN(JL,KK)) THEN
  
negative.code:   100 CONTINUE
        DO 120 JK=KTOPM2,KLEV
        IK=JK-1
        IF(JK.EQ.1) IK=1 !edg
        DO 110 JL=1,KLON
        IF(LDCUM(JL)) THEN
          ZMFUU(JL,JK)=PMFU(JL,JK)*(PUU(JL,JK)-PUEN(JL,IK))
  