Fundamentals of gas separation in nanoporous materials