Motion of charged particles in the magnetosphere