Path integral molecular dynamic simulation of flexible molecular systems in their ground state: Application to the water dimer