Quantum and statistical mechanical studies of liquids. 3. Deriving intermolecular potential functions for the water dimer from ab initio calculations