The variational method for the calculation of RO-vibrational energy levels