calculating distances to reduce steps in simulation (bottleneck now output of energydeposition)