added a small optimization that prevents unnecessary reductions of index relations while calculating the local energy