Relaxation toward states of minimum energy in a compact torus