def measure_shadow_work(sim, n_steps):
    """Run the sim for n_steps and return the accumulated shadow work."""
    w0 = sim.integrator.get_shadow_work(dimensionless=True)
    sim.step(n_steps)
    w1 = sim.integrator.get_shadow_work(dimensionless=True)
    return w1 - w0