Particle dynamics with variable mass and charge