Franck–Condon factors in studies of dynamics of chemical reactions. I. General theory, application to collinear atom–diatom reactions