anchor.diff:                                 rho(k),    &  ! [OUT] density (kg m^-3)
                                  q(k),      &  ! [OUT] water vapor mixing ratio (kg/kg)
                                  pert       )  ! [IN ] perturbation switch
  +
  +          q(k) = max( q(k), 0.0D0 ) ! fix negative value
  +          ! force zero for q upper tropopause (12km)
  +          if ( z(k) > 12000.D0 ) q(k) = 0.0D0
          enddo
   
          ! Re-Evaluation of temperature from virtual temperature
  
positive.code:                                       ps,        &  ! [OUT] Surface Pressure (Pa)
                                        rho(k),    &  ! [OUT] density (kg m^-3)
                                        q(k)       )  ! [OUT] water vapor mixing ratio (kg/kg)
         enddo
  
         ! Re-Evaluation of temperature from virtual temperature
  
negative.code:                                      ps,         &  ! [OUT] Surface Pressure (Pa)
                                       rho(k),     &  ! [OUT] density (kg m^-3)
                                       q(k)        )  ! [OUT] water vapor mixing ratio (kg/kg)
  
            q(k) = max( q(k), 0.0D0 ) ! fix negative value
         enddo
  
         ! Re-Evaluation of temperature from virtual temperature
  