From 0ac41379eb907c148c0875cbec7d24765426a5d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20R=C3=BC=C3=9Fmann?=
Date: Wed, 29 Nov 2023 10:37:37 +0000
Subject: [PATCH] Bugfix parse Jij's for CPA without SOC
---
aiida_kkr/tools/jij_tools.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/aiida_kkr/tools/jij_tools.py b/aiida_kkr/tools/jij_tools.py
index 02c7642c..6521bdfb 100644
--- a/aiida_kkr/tools/jij_tools.py
+++ b/aiida_kkr/tools/jij_tools.py
@@ -35,9 +35,12 @@ def get_jijs_shells(jij_calc, verbose=False):
try:
tmp = np.loadtxt(f)
except:
+ # this means we could not read the file which happens, for example,
+ # in case of CPA where "&" characters are inserted to mark the end of block
f.seek(0)
txt = f.readlines()
- tmp = np.loadtxt(txt[:-1])
+ txt = [line for line in txt if '&' not in line]
+ tmp = np.loadtxt(txt)
# sort by radius
jij_atom = tmp[tmp[:, 0].argsort()]
if len(jij_atom[0]) > 4: