  Flows on the moduli space of the algebraic Riemann surfaces, preserving the
periods of the corresponding solutions of the soliton equations are studied. We
show that these flows are gradient with respect to some indefinite symmetric
flat metric arising in the Hamiltonian theory of the Whitham equations. The
functions generating these flows are conserved quantities for all the equations
simultaneously. We show that for 1+1 systems these flows can be imbedded in a
larger system of ordinary nonlinear differential equations with a rational
right-hand side. Finally these flows are used to give a complete description of
the moduli space of algebraic Riemann surfaces corresponding to periodic
solutions of the nonlinear Schr\"odinger equation.
