diff --git a/aiida_kkr/tools/tools_STM_scan.py b/aiida_kkr/tools/tools_STM_scan.py index df343bfb..2190bc6c 100644 --- a/aiida_kkr/tools/tools_STM_scan.py +++ b/aiida_kkr/tools/tools_STM_scan.py @@ -106,14 +106,14 @@ def offset_clust2(clust1, clust2, host_structure, add_position): return clust2_offset -def get_imp_info_add_position(host_calc, imp_info, add_position): +def get_imp_info_add_position(add_position, host_structure, imp_info): """ Create combined impurity info node for the original imp cluster + an additional (STM tip) position """ # extract host structure - host_structure = find_parent_structure(host_calc) + # host_structure = find_parent_structure(host_calc) # convert imp info to cls form imp_info_cls, clust1 = convert_to_imp_cls(host_structure, imp_info) @@ -138,14 +138,14 @@ def get_imp_info_add_position(host_calc, imp_info, add_position): @engine.calcfunction -def get_imp_info_add_position_cf(host_remote, imp_info, add_position): +def get_imp_info_add_position_cf(add_position, host_structure, imp_info): """ Create a new impurty info node that combines the impurity cluster of an original calculation and an STM scanning position. """ # then combine the imp info - imp_info_combined = get_imp_info_add_position(host_remote, imp_info, add_position) + imp_info_combined = get_imp_info_add_position(add_position, host_structure, imp_info) return imp_info_combined @@ -154,7 +154,7 @@ def get_imp_info_add_position_cf(host_remote, imp_info, add_position): # combine potentials -def extract_host_potential(add_position, host_remote): +def extract_host_potential(add_position, host_calc): """ Extract the potential of the position in the host that matches the additional position """ @@ -163,7 +163,7 @@ def extract_host_potential(add_position, host_remote): ilayer = add_position['ilayer'] # get host calculation from remote - host_calc = host_remote.get_incoming(node_class=orm.CalcJobNode).first().node + #host_calc = host_remote.get_incoming(node_class=orm.CalcJobNode).first().node # read potential from host's retrieved node with host_calc.outputs.retrieved.open('out_potential') as _f: @@ -183,12 +183,12 @@ def extract_host_potential(add_position, host_remote): return pot_add -def add_host_potential_to_imp(add_position, host_remote, imp_potential_node): +def add_host_potential_to_imp(add_position, host_calc, imp_potential_node): """ combine host potential with impurity potential """ # get add potential from host - pot_add = extract_host_potential(add_position, host_remote) + pot_add = extract_host_potential(add_position, host_calc) # get impurity potential and convert to list pot_imp = imp_potential_node.get_content().split('\n') @@ -200,7 +200,7 @@ def add_host_potential_to_imp(add_position, host_remote, imp_potential_node): return pot_combined -def create_combined_potential_node(add_position, host_remote, imp_potential_node): +def create_combined_potential_node(add_position, host_calc, imp_potential_node): """ Combine impurity potential with an additional potential from the host for the STM tip position (additional position) @@ -208,7 +208,7 @@ def create_combined_potential_node(add_position, host_remote, imp_potential_node import io # combine potential texts - pot_combined = add_host_potential_to_imp(add_position, host_remote, imp_potential_node) + pot_combined = add_host_potential_to_imp(add_position, host_calc, imp_potential_node) # convert to byte string and put into SinglefilData node pot_combined_string = '' @@ -218,14 +218,13 @@ def create_combined_potential_node(add_position, host_remote, imp_potential_node return pot_combined_node - @engine.calcfunction -def create_combined_potential_node_cf(add_position, host_remote, imp_potential_node): +def create_combined_potential_node_cf(add_position, host_calc, imp_potential_node): """ Calcfunction that combines the impurity potential with an addition potential site from the host """ - pot_combined_node = create_combined_potential_node(add_position, host_remote, imp_potential_node) + pot_combined_node = create_combined_potential_node(add_position, host_calc, imp_potential_node) return pot_combined_node diff --git a/aiida_kkr/workflows/kkr_STM.py b/aiida_kkr/workflows/kkr_STM.py index cb7835ed..7392c871 100644 --- a/aiida_kkr/workflows/kkr_STM.py +++ b/aiida_kkr/workflows/kkr_STM.py @@ -208,7 +208,7 @@ def combine_potentials(self, host_structure, impurity_to_combine, da, db): imp_info = self.inputs.imp_info #(impurity to combine) #host_remote = self.inputs.host_remote - combined_imp_info = get_imp_info_add_position(tip_position, host_structure, imp_info) + combined_imp_info = get_imp_info_add_position(Dict(tip_position), host_structure, imp_info) # Since the objects in AiiDA are immutable we have to create a new dictionary and then convert # it to the right AiiDA type @@ -425,6 +425,9 @@ def STM_lmdos_run(self): # Check if the kkrflex files are already given in the outputs if 'kkrflex_files' in self.inputs: builder.gf_dos_remote = self.inputs.kkrflex_files + message = f'Remote host function is given in the outputs from the node: {self.inputs.kkrflex_files}' + print(message) + self.report(message) else: builder.kkr = self.inputs.kkr # needed to evaluate the kkr_flex files in the DOS step @@ -484,6 +487,9 @@ def STM_lmdos_run(self): calc = self.submit(builder) message = f"""INFO: running DOS step for an STM measurement (pk: {calc.pk}) at position (ilayer: {self.inputs.tip_position['ilayer']}, da: {x}, db: {y} )""" + + if self.inputs.BdG.params_kkr_overwrite: + message = f"""INFO: runnig DOS step (pk: {calc.pk}) BdG is present""" print(message) self.report(message)