From 642416c082b4c864ceb436dfd8650cec270e9463 Mon Sep 17 00:00:00 2001
From: Antonio Manesco <am@antoniomanesco.org>
Date: Thu, 9 Nov 2023 10:43:37 +0100
Subject: [PATCH] make kwant model hermitian

---
 codes/utils.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/codes/utils.py b/codes/utils.py
index 114ad73..22f48a0 100644
--- a/codes/utils.py
+++ b/codes/utils.py
@@ -113,6 +113,11 @@ def builder2tb_model(builder, params={}, return_data=False):
                     .toarray()
                     .T.conj()
                 )
+            else:
+                # Hopping vector in the opposite direction
+                tb_model[tuple(-b_dom)] += coo_array(
+                    (data, (row, col)), shape=(norbs_tot, norbs_tot)
+                ).toarray().T.conj()
         else:
             tb_model[tuple(b_dom)] = coo_array(
                 (data, (row, col)), shape=(norbs_tot, norbs_tot)
@@ -123,6 +128,10 @@ def builder2tb_model(builder, params={}, return_data=False):
                     .toarray()
                     .T.conj()
                 )
+            else:
+                tb_model[tuple(-b_dom)] = coo_array(
+                    (data, (row, col)), shape=(norbs_tot, norbs_tot)
+                ).toarray().T.conj()
 
     if return_data:
         data = {}
-- 
GitLab