From 8610289e8aad6ee7e3326db5fd6bdc8e1eeb7414 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20R=C3=BC=C3=9Fmann?=
Date: Mon, 7 Oct 2024 13:00:38 +0000
Subject: [PATCH] Small bugfixes - take care of edge case where Zimp is not a
list but a number (happens for single impurity case without specification of
imp_cls input) - fix renaming params_kkr_overwrite -> params_overwrite
---
aiida_kkr/tools/tools_STM_scan.py | 6 +++++-
aiida_kkr/workflows/kkr_STM.py | 10 +++++-----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/aiida_kkr/tools/tools_STM_scan.py b/aiida_kkr/tools/tools_STM_scan.py
index 98074f1c..a38a878a 100644
--- a/aiida_kkr/tools/tools_STM_scan.py
+++ b/aiida_kkr/tools/tools_STM_scan.py
@@ -137,7 +137,11 @@ def get_imp_info_add_position(add_position, host_structure, imp_info):
#raise ValueError('Additional position exists already in impurity cluster.')
cluster_combined, rimp_rel_combined, _, _ = combine_clusters(clust1, clust2_offset, False, debug=False)
# combine the zimp arrays
- zimp_combined = imp_info['Zimp'] + imp_info2['Zimp']
+ zimp1 = imp_info['Zimp']
+ if not isinstance(zimp1, list):
+ # convert to list if necessary
+ zimp1 = [zimp1]
+ zimp_combined = zimp1 + imp_info2['Zimp']
# now combine the imp info node
imp_info_combined = orm.Dict({'imp_cls': cluster_combined, 'Zimp': zimp_combined, 'Rimp_rel': rimp_rel_combined})
diff --git a/aiida_kkr/workflows/kkr_STM.py b/aiida_kkr/workflows/kkr_STM.py
index 75d4432c..f076ace1 100644
--- a/aiida_kkr/workflows/kkr_STM.py
+++ b/aiida_kkr/workflows/kkr_STM.py
@@ -33,7 +33,7 @@ class kkr_STM_wc(WorkChain):
:param kkr: (Code), KKR host code for the writing out kkrflex files
:param kkrimp: (Code), KKR impurity code for the normal state impurity scf and BdG impurity DOS calculation
:param gf_writeout.params_kkr_overwrite (Dict), overwrite parameters for the GF calculation
- :param kkr_imp_sub.params_kkr_overwrite (Dict), overwrite parameters for the impurity calculation
+ :param kkr_imp_sub.params_overwrite (Dict), overwrite parameters for the impurity calculation
returns::
@@ -499,8 +499,8 @@ def STM_lmdos_run(self):
# Update the BdG parameters if they are inserted in the workflow
if 'BdG' in self.inputs:
- if 'params_kkr_overwrite' in self.inputs.BdG:
- builder.BdG.params_overwrite = self.inputs.BdG.params_kkr_overwrite # pylint: disable=no-member
+ if 'params_overwrite' in self.inputs.BdG:
+ builder.BdG.params_overwrite = self.inputs.BdG.params_overwrite # pylint: disable=no-member
self.ctx.kkrimp_params_dict = Dict(
dict={
@@ -559,8 +559,8 @@ def STM_lmdos_run(self):
# print report
message = f"""INFO: running DOS step for an STM measurement (pk: {calc.pk}) at position (ilayer: {self.inputs.tip_position['ilayer']})"""
- if 'params_kkr_overwrite' in self.inputs.BdG:
- if self.inputs.BdG.params_kkr_overwrite:
+ if 'params_overwrite' in self.inputs.BdG:
+ if self.inputs.BdG.params_overwrite:
message += f'\nINFO: runnig DOS step (pk: {calc.pk}) BdG is present'
self.report(message)