PMDSPH is a combined 3D particle-mesh and SPH code aimed to simulate the self-consistent dynamical evolution of spiral galaxies including live stellar and collisionless dark matter components, as well as an isothermal gas component. This paper describes some aspects of this code and shows how its application to the Milky Way helps to recover the gas flow within the Galactic bar region from the observed HI and CO longitude-velocity distributions.