During the formation of metal-organic frameworks (MOFs), metal centres can coordinate with the intended organic linkers, but also with solvent molecules. In this case, subsequent activation by removal of the solvent molecules creates unsaturated "open" metal sites known to have a strong affinity for CO 2 molecules, but their interactions are still poorly understood. Common force fields typically underestimate by as much as two orders of magnitude the adsorption of CO 2 in open-site Mg-MOF-74, which has emerged as a promising MOF for CO 2 capture. Here we present a systematic procedure to generate force fields using high-level quantum chemical calculations. Monte Carlo simulations based on an ab initio force field generated for CO 2 in Mg-MOF-74 shed some light on the interpretation of thermodynamic data from flue gas in this material. The force field describes accurately the chemistry of the open metal sites, and is transferable to other structures. This approach may serve in molecular simulations in general and in the study of fluid-solid interactions.