Stochastic modeling of macromolecules in solution. I. Relaxation processes