Algebraic method for determining the potential energy surface for nonlinear triatomic molecules