Geometry and force constant determination from correlated wave functions for polyatomic molecules: Ground states of H2O and CH2