Calculating elastic properties of confined simple fluids