Constrained dynamics of oxygen atoms of water molecules

Have you tried using position restraints? If you use gmx make_ndx to create a group containing only the oxygen atoms, you can then use gmx genrestr to create position restraints for that group, it will place a harmonic force to keep the atoms in place.

I’m not sure about setting the oxygen mass super high, but I’d found from a previous post that freeze groups don’t work for all simulation setups