Solar wind-magnetosphere interaction as simulated by a 3-D em particle code