Thomas-Kuhn sum rule for quantum mechanical systems with a spatially varying effective mass