* Updates energy function