Improved potential functions for bent AB2 molecules: Water and ozone