The vibrational energy is obtained by solving the vibrational Schrödinger equation
\begin{equation}\label{6} \left[-\frac{\hbar^2}{2\mu}\frac{d^2}{dR^2}+E_e(R)\right]\psi_{ vib}(R)=(E_{vib}+E_{ele})\psi_{vib}(R) \end{equation}
The Taylor series expansion of the potential energy $E_e(R)$ around the equilibrium distance $R_e$ gives us:
\begin{equation}\label{71} E_e(R)\approx E_e(R_e)+\frac{1}{2}\frac{d^2E_e(R_e)}{dR^2}(R-R_e)^ 2+..... \end{equation}
The quantity $E_e(R_e)=E_{el}$ is constant for a given electronic state and is called equilibrium electronic energy.
Substituting into the vibrational Schrödinger equation and grouping terms, we get:
\begin{equation}\label{8} \left[-\frac{\hbar^2}{2\mu}\frac{d^2}{dR^2}+\cancel{E_e(R_e)}+\ frac{1}{2}\frac{d^2E_e(R_e)}{dR^2}x^2\right]\psi_{vib}=(E_{vib}+\cancel{E_{el}})\ psi_{vib} \end{equation}
Doing $x=R-R_e$ and $dx=dR$, we obtain:
\begin{equation}\label{9} \left[-\frac{\hbar^2}{2\mu}\frac{d^2}{dx^2}+\frac{1}{2}\frac {d^2E_e(R_e)}{dx^2}x^2\right]\psi_{vib}=E_{vib}\psi_{vib} \end{equation}
Where, $k_e=\frac{d^2E_e(R_e)}{dx^2}$.
\begin{equation} \left[-\frac{\hbar^2}{2\mu}\frac{d^2}{dx^2}+\frac{1}{2}kx^2\right]\ psi_{vib}=E_{vib}\psi_{vib} \end{equation}
This last equation has the form of the Schrödinger equation for a harmonic oscillator and its solution gives us:
\begin{equation}\label{91} E_{vib}=(v+\frac{1}{2})h\nu_e \end{equation}
Where $v=0,1,2,3....$ is the vibrational quantum number and $\nu_e$ is the equilibrium vibrational frequency.
\begin{equation}\label{10} \nu_e=\frac{1}{2\pi}\sqrt{\frac{k_e}{\mu}} \end{equation}
The oscillator force constant corresponds to the second derivative of $E_e$ with $R=R_e$.
\begin{equation}\label{11} k=\left(\frac{\partial^2E_e}{\partial R^2}\right)_{R=R_e} \end{equation}
The internal energy of the diatomic molecule is given by: $E_{int}=E_{rot}+E_{vib}+E_{ele}$
\begin{equation}\label{12} E_{int}=B_e h J(J+1)+(v+\frac{1}{2})h\nu_e+E_{ele} \end{equation}