Energetics for gas separation in microporous membranes