Theory and molecular modelling of gas adsorption in nanopores