What are the precise conditions for thermodynamic equilibrium? I know that a system in thermodynamic equilibrium must have constant temperature and that there can be no net macroscopic flow of energy or matter. However, is it possible for there to be a system in equilibrium that has a spatially varying energy density? For example, a system of particles treated as independent oscillators where the energy of the oscillators depends on its position in space. Can such a system be in equilibrium or must there be a mechanism that pushes it towards uniform energy density?