Density functional theory predictions of adsorption isotherms with hysteresis loops