We describe a novel algorithm that includes the effect of host lattice flexibility into molecular dynamics simulations that use rigid lattices. It uses a Lowe-Andersen thermostat for interface-fluid collisions to take the most important aspects of flexibility into account. The same diffusivities and other properties of the flexible framework system are reproduced at a small fraction of the computational cost of an explicit simulation. We study the influence of flexibility on the self-diffusion of simple gases inside single walled carbon nanotubes. Results are shown for different guest molecules ͑methane, helium, and sulfur hexafluoride͒, temperatures, and types of carbon nanotubes. We show, surprisingly, that at low loadings flexibility is always relevant. Notably, it has a crucial influence on the diffusive dynamics of the guest molecules.