Magnetically manipulated atomic and molecular beams