A closed form solution for the internal dynamics of polymer chains. I. Bonds with independent rotational potentials