A novel type of porous organic frameworks, based on Mg-porphyrin, with diamond-like topology, named POF-Mgs is computationally designed, and the gas uptakes of CO , H , N , and H O in POF-Mgs are investigated by Grand canonical Monte Carlo simulations based on first-principles derived force fields (FF). The FF, which describes the interactions between POF-Mgs and gases, are fitted by dispersion corrected double-hybrid density functional theory, B2PLYP-D3. The good agreement between the obtained FF and the first-principle energies data confirms the reliability of the FF. Furthermore our simulation shows the presence of a small amount of H O (≤ 0.01 kPa) does not much affect the adsorption quantity of CO , but the presence of higher partial pressure of H O (≥ 0.1 kPa) results in the CO adsorption decrease significantly. The good performance of POF-Mgs in the simulation inspires us to design novel porous materials experimentally for gas adsorption and purification. © 2017 Wiley Periodicals, Inc.