Suppose a wire of length L carrying a current I is kept in a uniform magnetic field B perpendicular to the current. The force on the wire will be IBL and work done by magnetic force when wire moves a distance d along the force will be IBLd. But magnetic force cannot do any work on a moving charged particle and hence total work done on all particles by magnetic force should be zero. Where does the work IBLd come from?