Soft porous crystals present a challenge to molecular dynamics simulations with flexible size and shape of the simulation cell (i.e., in the NPT ensemble), since their framework responds very sensitively to small external stimuli. Hence, all interactions have to be described very accurately in order to obtain correct equilibrium structures. Here, we report a methodological study on the nanoporous metal-organic framework MIL-53(Ga), which undergoes a large-amplitude transition between a narrow- and a large-pore phase upon a change in temperature. Since this system has not been investigated by density functional theory (DFT)-based NPT simulations so far, we carefully check the convergence of the stress tensor with respect to computational parameters. Furthermore, we demonstrate the importance of dispersion interactions and test two different ways of incorporating them into the DFT framework. As a result, we propose two computational schemes which describe accurately the narrow- and the large-pore phase of the material, respectively. These schemes can be used in future work on the delicate interplay between adsorption in the nanopores and structural flexibility of the host material.