Fluctuation formulas for the elastic constants of an arbitrary system