fixed h energy function