added dist-Denergy, derivative of dist energy function