From 17a7647dcb01d50ccb05aca14b264dd7b2260700 Mon Sep 17 00:00:00 2001
From: Kostas Vilkelis <kostasvilkelis@gmail.com>
Date: Tue, 30 Jan 2024 13:24:51 +0100
Subject: [PATCH] normalize total energy to kpoint number

---
 codes/hf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/codes/hf.py b/codes/hf.py
index aac48be..4ea39fa 100644
--- a/codes/hf.py
+++ b/codes/hf.py
@@ -126,7 +126,7 @@ def total_energy(h, rho):
     total_energy : float
         System total energy computed as tr[h@rho].
     """
-    return np.sum(np.trace(h @ rho, axis1=-1, axis2=-2)).real
+    return np.sum(np.trace(h @ rho, axis1=-1, axis2=-2)).real / np.prod(rho.shape[:-2])
 
 def updated_matrices(mf_k, model):
     """
-- 
GitLab