Added new energy function