Range modulators for protons and heavy ions