  We argue that the definition of the thermodynamic work done on a charged
particle by a time-dependent electromagnetic field is an open problem, because
the particle's Hamiltonian is not gauge-invariant. The solution of this problem
demands accounting for the source of the field. Hence we focus on the work done
by a heavy body (source) on a lighter particle when the interaction between
them is electromagnetic and relativistic. The work can be defined via the
gauge-invariant kinetic energy of the source. We uncover a formulation of the
first law (or the generalized work-energy theorem) which is derived from
relativistic dynamics, has definite validity conditions, and relates the work
to the particle's Hamiltonian in the Lorenz gauge. Thereby the thermodynamic
work also relates to the mechanic work done by the Lorentz force acting on the
source. The formulation of the first law is based on a specific separation of
the overall energy into those of the source, particle and electromagnetic
field. This separation is deduced from a consistent energy-momentum tensor.
Hence it holds relativistic covariance and causality.
