  Experiments observing spin density and spin currents (responsible for, e.g.,
spin-transfer torque) in spintronic devices measure only the nonequilibrium
contributions to these quantities, typically driven by injecting unpolarized
charge current or by applying external time-dependent fields. On the other
hand, theoretical approaches to calculate them operate with both the
nonequilibrium (carried by electrons around the Fermi surface) and the
equilibrium (carried by the Fermi sea electrons) contributions. Thus, an
unambiguous procedure should remove the equilibrium contributions, thereby
rendering the nonequilibrium ones which are measurable and satisfy the
gauge-invariant condition according to which expectation values of physical
quantities should not change when electric potential everywhere is shifted by a
constant amount. Using the framework of nonequilibrium Green functions, we
delineate such procedure which yields the proper gauge-invariant nonequilibrium
density matrix in the linear-response and elastic transport regime for
current-carrying steady state of an open quantum system connected to two
macroscopic reservoirs. Its usage is illustrated by computing: (i) conventional
spin-transfer torque (STT) in asymmetric F/I/F magnetic tunnel junctions
(MTJs); (ii) unconventional STT in asymmetric N/I/F semi-MTJs with the strong
Rashba spin-orbit coupling (SOC) at the I/F interface and injected current
perpendicular to that plane; and (iii) current-driven spin density within a
clean ferromagnetic Rashba spin-split two-dimensional electron gas (2DEG) which
generates SO torque in laterally patterned N/F/I heterostructures when such
2DEG is located at the N/F interface and injected charge current flows parallel
to the plane.
