Capped velocities to avoid crashes and unphysical behavior.

Fixed max number of atoms bug so that arrays are never exceeded.