Theoretical studies on molecular vibrations by Green's function analysis and molecular quadrupole moments of N2 and O2