From 9b4a9bc1539eea34fc87dcac14d30b970d56503c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20R=C3=BC=C3=9Fmann?=
Date: Thu, 9 Nov 2023 08:40:21 +0000
Subject: [PATCH] Fix strucplot input in plot_kkr for KkrimpCalculations
default is now to not show the structure
---
aiida_kkr/tools/plot_kkr.py | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/aiida_kkr/tools/plot_kkr.py b/aiida_kkr/tools/plot_kkr.py
index f5bd2e6d..63a1d6ea 100644
--- a/aiida_kkr/tools/plot_kkr.py
+++ b/aiida_kkr/tools/plot_kkr.py
@@ -382,6 +382,8 @@ class plot_kkr(object):
:type switch_xy: bool
:param iatom: list of atom indices which are supposed to be plotted (default: [], i.e. show all atoms)
:type iatom: list
+ :param debug: activate debug output
+ :type debug: bool
additional keyword arguments are passed onto the plotting function which allows, for example,
to change the markers used in a DOS plot to crosses via `marker='x'`
@@ -400,8 +402,17 @@ def __init__(self, nodes=None, **kwargs):
from aiida import load_profile
load_profile()
+ # used to keep track of structure plotting
self.sview = None
+ # debug mode
+ self.debug = False
+ if 'debug' in kwargs:
+ self.debug = kwargs.pop('debug')
+ print('start plot_kkr')
+ print('kwargs:', kwargs)
+
+ # grouping of node if a list of nodes is the input instead of a single node
groupmode = False
if type(nodes) == list:
if len(nodes) > 1:
@@ -1047,8 +1058,12 @@ def plot_voro_calc(self, node, **kwargs):
def plot_kkrimp_calc(self, node, return_rms=False, return_stot=False, plot_rms=True, **kwargs):
"""plot things from a kkrimp Calculation node"""
+ if self.debug:
+ print('in plot_kkrimp_calc')
+ print('kwargs:', kwargs)
+
# plot impurity cluster
- if kwargs.get('strucplot', True):
+ if kwargs.get('strucplot', False):
if _has_ase_notebook():
self.sview = plot_imp_cluster(node, **kwargs)
else:
@@ -1115,10 +1130,14 @@ def plot_kkrimp_sub_wc(self, node, **kwargs):
"""plot things from a kkrimp_sub_wc workflow"""
from aiida_kkr.calculations import KkrimpCalculation
+ if self.debug:
+ print('in plot_kkrimp_sub_wc')
+ print('kwargs:', kwargs)
+
impcalcs = [i.node for i in node.get_outgoing(node_class=KkrimpCalculation).all()]
# plot impurity cluster
- if len(impcalcs) > 0 and kwargs.get('strucplot', True):
+ if len(impcalcs) > 0 and kwargs.get('strucplot', False):
if _has_ase_notebook():
self.sview = plot_imp_cluster(impcalcs[0], **kwargs)
else:
@@ -1232,6 +1251,10 @@ def plot_kkrimp_dos_wc(self, node, **kwargs):
from masci_tools.vis.kkr_plot_dos import dosplot
from matplotlib.pyplot import show, figure, title, xticks, xlabel, axvline
+ if self.debug:
+ print('in plot_kkrimp_dos_wc')
+ print('kwargs:', kwargs)
+
interpol, all_atoms, l_channels, sum_spins, switch_xy = True, False, True, False, False
ptitle = None
if 'ptitle' in list(kwargs.keys()):