diff --git a/aiida_kkr/tools/tools_STM_scan.py b/aiida_kkr/tools/tools_STM_scan.py index 75d9169c..217c2fa3 100644 --- a/aiida_kkr/tools/tools_STM_scan.py +++ b/aiida_kkr/tools/tools_STM_scan.py @@ -240,10 +240,17 @@ def STM_pathfinder(host_structure): """This function is used to help visualize the scanned positions and the symmetries that are present in the system """ """ +<<<<<<< HEAD inputs:: host_struture : RemoteData : The Remote data contains all the information needed to create the path to scan outputs:: +======= + inputs: + host_struture : RemoteData : The Remote data contains all the information needed to create the path to scan + + outputs: +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 struc_info : Dict : Dictionary containing the structural information of the film matrices : Array : Array containing the matrices that generate the symmetries of the system @@ -341,10 +348,14 @@ def lattice_generation(x_len, y_len, rot, vec): for i in range(-x_len, x_len + 1): for j in range(-y_len, y_len + 1): +<<<<<<< HEAD if ( (lattice_points[i][j][0] > 0 or math.isclose(lattice_points[i][j][0],0, abs_tol=1e-3)) and (lattice_points[i][j][1] > 0 or math.isclose(lattice_points[i][j][1],0, abs_tol=1e-3)) ): +======= + if lattice_points[i][j][0] >= 0 and lattice_points[i][j][1] >= 0: +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 for element in rot[1:]: point = np.dot(element, lattice_points[i][j]) if point[0] >= 0 and point[1] >= 0: diff --git a/aiida_kkr/workflows/_combine_imps.py b/aiida_kkr/workflows/_combine_imps.py index a98f3fe0..82227884 100644 --- a/aiida_kkr/workflows/_combine_imps.py +++ b/aiida_kkr/workflows/_combine_imps.py @@ -540,7 +540,7 @@ def create_big_cluster(self): # pylint: disable=inconsistent-return-statements ): if (offset, ilayer) == (imp_offset_index, imp2_ilayer): self.report( - f"ERROR: The new impurity is overlaping with the existing impurities. Change the 'ilayer_certer': {ilayer} or 'offset_index'{offset}." + f"ERROR: The new impurity is overlaping with the existing impurities. Change the 'ilayer_center': {ilayer} or 'offset_index'{offset}." ) return self.exit_codes.ERROR_SOMETHING_WENT_WRONG # pylint: disable=no-member diff --git a/aiida_kkr/workflows/kkr_STM.py b/aiida_kkr/workflows/kkr_STM.py index 522c2e68..c80cd461 100644 --- a/aiida_kkr/workflows/kkr_STM.py +++ b/aiida_kkr/workflows/kkr_STM.py @@ -32,8 +32,11 @@ class kkr_STM_wc(WorkChain): :param wf_parameters: (Dict), parameters that are used to run the workflow :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 +<<<<<<< HEAD :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 +======= +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 returns:: @@ -81,7 +84,13 @@ def define(cls, spec): super(kkr_STM_wc, cls).define(spec) spec.input('kkr', valid_type=Code, required=False, help='KKRhost code, needed if gf_dos_remote is not given.') +<<<<<<< HEAD spec.input('kkrimp', valid_type=Code, required=True, help='KKRimp code, always needed.') +======= + + spec.input('kkrimp', valid_type=Code, required=True, help='KKRimp code, always needed.') + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'options', valid_type=Dict, @@ -89,6 +98,10 @@ def define(cls, spec): default=lambda: Dict(dict=cls._options_default), help='Computer options (resources, quene name, etc.).' ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'wf_parameters', valid_type=Dict, @@ -96,6 +109,10 @@ def define(cls, spec): default=lambda: Dict(dict=cls._wf_default), help='Workflow parameter (see `kkr_dos_wc.get_wf_defaults()`).' ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'tip_position', valid_type=Dict, @@ -110,15 +127,25 @@ def define(cls, spec): # nx is the number of (symmetric) steps that we take in the x-direction starting from the impurity # ny is the number of (symmetric) steps that we take in the y-direction starting from the impurity # (0,0) correspond to calculate the DOS only on the impurity site +<<<<<<< HEAD help= 'How many sites will be scanned in the da and db direction (Bravais Lattice). And the layer that is being scanned.' ) +======= + help='How many sites will be scanned in the x and y direction. And the layer that is being scanned.' + ) + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'imp_info', valid_type=Dict, required=True, help='Information of the impurity like position in the unit cell, screening cluster, atom type.' ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'host_calc', valid_type=RemoteData, @@ -126,24 +153,40 @@ def define(cls, spec): help='The information about the clean host structure is required in order to continue the cluster' 'Inside a bigger host structure with empty sites.' ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'host_remote', valid_type=RemoteData, required=True, help='Remote Data containing the remote folder from the outputs of the host calculation', ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'imp_potential_node', valid_type=SinglefileData, required=True, help='Impurity potential node', ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'remote_data', valid_type=RemoteData, required=False, help='Remote data from a converged kkr calculation, required for the gf writeout step', ) +<<<<<<< HEAD +======= + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.input( 'kkrflex_files', valid_type=RemoteData, @@ -155,6 +198,7 @@ def define(cls, spec): # One parameter which is crucial is the NSHELD, which determines the impurity cluster radius. spec.expose_inputs(kkr_flex_wc, namespace='gf_writeout', include=('params_kkr_overwrite')) +<<<<<<< HEAD # Here we expose the BdG calculations from the kkr_imp_dos_wc spec.expose_inputs(kkr_imp_sub_wc, namespace='BdG', include=('params_overwrite')) spec.expose_inputs(kkr_imp_sub_wc, include=('initial_noco_angles', 'rimpshift')) @@ -166,6 +210,21 @@ def define(cls, spec): #spec.output('workflow_info', valid_type=Dict) spec.output('kkrflexfiles', valid_type=RemoteData) spec.output('combined_imp_info', valid_type=Dict) +======= + # Specify the possible outputs + spec.output('tip_position', valid_type=Dict) + + spec.output('STM_dos_data', valid_type=XyData, required=True) + + spec.output('STM_dos_data_lmdos', valid_type=XyData, required=True) + + #spec.output('workflow_info', valid_type=Dict) + + spec.output('kkrflexfiles', valid_type=RemoteData) + + spec.output('combined_imp_info', valid_type=Dict) + +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 spec.output('combined_imp_potential', valid_type=SinglefileData) # Define all possible error messages @@ -193,17 +252,32 @@ def define(cls, spec): cls.results ) +<<<<<<< HEAD def combine_potentials(self, host_structure, impurity_to_combine, da, db): from aiida_kkr.tools.tools_STM_scan import get_imp_info_add_position import numpy as np # TO DO: optimize this call, only need append from numpy """ Here we want to combine the impurity information and the host information """ +======= + def combine_potentials(self, impurity_to_combine, da, db): + from aiida_kkr.tools.tools_STM_scan import get_imp_info_add_position_cf + """ + Here we want to combine the impurity information and the host information + """ + + imp_info = self.inputs.imp_info #(impurity to combine) + host_remote = self.inputs.host_remote + + # Since the objects in AiiDA are immutable we have to create a new dictionary and then convert + # it to the right AiiDA type +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 tip_position = {} tip_position['ilayer'] = self.inputs.tip_position['ilayer'] tip_position['da'] = da tip_position['db'] = db +<<<<<<< HEAD #print(impurity_to_combine.get_dict()) imp_info = self.inputs.imp_info #(impurity to combine) #host_remote = self.inputs.host_remote @@ -217,6 +291,16 @@ def combine_potentials(self, host_structure, impurity_to_combine, da, db): if 'imp_cls' in impurity_to_combine: for key in impurity_to_combine.keys(): +======= + + combined_imp_info = get_imp_info_add_position_cf(tip_position, host_remote, imp_info) + # Add check to see if imp_cls is there + if 'imp_cls' in impurity_to_combine: + + new_combined_imp_info = {} + + for key, value in impurity_to_combine.items(): +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 if key == 'Zimp': #print(impurity_to_combine[key]) impurity_to_combine[key].append(combined_imp_info[key][-1]) @@ -224,6 +308,7 @@ def combine_potentials(self, host_structure, impurity_to_combine, da, db): # np.append(impurity_to_combine[key], [combined_imp_info[key][-1]], axis=0) # print(impurity_to_combine[key]) else: +<<<<<<< HEAD #print(combined_imp_info[key][-1]) impurity_to_combine[key] = np.append(impurity_to_combine[key], [combined_imp_info[key][-1]], axis=0) #print(impurity_to_combine[key]) @@ -242,6 +327,15 @@ def combine_potentials(self, host_structure, impurity_to_combine, da, db): # Convert to an AiiDA Dictionary new_combined_imp_info = impurity_to_combine +======= + # Here we have lists of list that we need to confront + new_combined_imp_info[key] = impurity_to_combine[key] + set_tmp = [set(row) for row in impurity_to_combine[key]] + + new_combined_imp_info[key] += [row for row in combined_imp_info[key] if set(row) not in set_tmp] + + new_combined_imp_info = orm.Dict(dict=new_combined_imp_info) +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 else: @@ -249,24 +343,42 @@ def combine_potentials(self, host_structure, impurity_to_combine, da, db): return new_combined_imp_info +<<<<<<< HEAD def combine_nodes(self, host_calc, node_to_combine, da, db): from aiida_kkr.tools.tools_STM_scan import create_combined_potential_node +======= + def combine_nodes(self, node_to_combine, da, db): + from aiida_kkr.tools.tools_STM_scan import create_combined_potential_node_cf +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 """ Here we create a combined potential node from the host potential (no impurity) and from the impurity potential """ #imp_potential_node = self.inputs.imp_potential_node # (node_to_combine). +<<<<<<< HEAD #host_remote = self.inputs.host_remote # the remote host structure remains the same. +======= + host_remote = self.inputs.host_remote # the remote host structure remains the same. +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 # Since the objects in AiiDA are immutable we have to create a new dictionary and then convert # it to the right AiiDA type tip_position = {} +<<<<<<< HEAD tip_position['ilayer'] = self.inputs.tip_position['ilayer'] # for now we require that the z position remains the same. tip_position['da'] = da tip_position['db'] = db combined_node = create_combined_potential_node(tip_position, host_calc, node_to_combine) +======= + tip_position['ilayer'] = self.inputs.tip_position['ilayer' + ] # for now we require that the z position remains the same. + tip_position['da'] = da + tip_position['db'] = db + + combined_node = create_combined_potential_node_cf(tip_position, host_remote, node_to_combine) +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 return combined_node def start(self): @@ -372,7 +484,10 @@ def validate_input(self): def impurity_cluster_evaluation(self): from aiida_kkr.tools import tools_STM_scan +<<<<<<< HEAD from aiida_kkr.tools import find_parent_structure +======= +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 # Here we create an impurity cluster that has inside all the positions on which the STM will scan @@ -384,10 +499,13 @@ def impurity_cluster_evaluation(self): impurity_info = self.inputs.imp_info # for the first step we combine the impurity info from the input imp_potential_node = self.inputs.imp_potential_node # for the first step we combine the impurity node from the input +<<<<<<< HEAD host_remote = self.inputs.host_remote host_calc = host_remote.get_incoming(node_class=CalcJobNode).first().node host_structure = find_parent_structure(host_remote) +======= +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 # Information of the host structure struc_info, symm_matrices = tools_STM_scan.STM_pathfinder(host_remote) @@ -400,7 +518,11 @@ def impurity_cluster_evaluation(self): coeff = tools_STM_scan.find_linear_combination_coefficients(struc_info['plane_vectors'], used_pos) for element in coeff: +<<<<<<< HEAD tmp_imp_info = self.combine_potentials(host_structure, impurity_info, element[0], element[1]) +======= + tmp_imp_info = self.combine_potentials(impurity_info, element[0], element[1]) +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 impurity_info = tmp_imp_info # Aggregation the impurity nodes @@ -435,11 +557,14 @@ def STM_lmdos_run(self): else: # This is a big value of NSHELD to make sure that most calculations work builder.gf_writeout.params_kkr_overwrite = Dict(dict={'NSHELD': 1500}) +<<<<<<< HEAD # 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 +======= +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 self.ctx.kkrimp_params_dict = Dict( dict={ @@ -460,7 +585,12 @@ def STM_lmdos_run(self): # Finally we overwrite the number of energy points to 1 # This is because we want many epoints around the impurity position +<<<<<<< HEAD self.ctx.kkrimp_params_dict['dos_params']['nepts'] = 7 # Here 7 because of the interpolated files that aren't generated +======= + self.ctx.kkrimp_params_dict['dos_params'][ + 'nepts'] = 7 # Here 7 because of the interpolated files that aren't generated +>>>>>>> deeb2f88313d293946f7657d00f7dcac0bc22d12 #builder.metadata.label = label_imp # pylint: disable=no-member #builder.metadata.description = description_imp # pylint: disable=no-member diff --git a/aiida_kkr/workflows/kkr_imp_dos.py b/aiida_kkr/workflows/kkr_imp_dos.py index 3c4964b8..a8f33425 100644 --- a/aiida_kkr/workflows/kkr_imp_dos.py +++ b/aiida_kkr/workflows/kkr_imp_dos.py @@ -786,12 +786,14 @@ def parse_impdosfiles(folder, natom, nspin, ef, use_lmdos): dosnode.set_x(dos[:, :, 0], 'E-EF', 'eV') name = ['tot', 's', 'p', 'd', 'f', 'g'] + name = name[:len(dos[0, 0, 1:]) - 1] + ['ns'] + if use_lmdos.value: name = [ - 'tot', 's', 'p1', 'p2', 'p3', 'd1', 'd2', 'd3', 'd4', 'd5', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'g1', - 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8', 'g9' + 's', 'p1', 'p2', 'p3', 'd1', 'd2', 'd3', 'd4', 'd5', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'g1', 'g2', + 'g3', 'g4', 'g5', 'g6', 'g7', 'g8', 'g9' ] - name = name[:len(dos[0, 0, 1:]) - 1] + ['ns'] + name = name[:len(dos[0, 0, 1:])] ylists = [[], [], []] for l in range(len(name)): diff --git a/aiida_kkr/workflows/voro_start.py b/aiida_kkr/workflows/voro_start.py index 6484f93b..bde4b105 100644 --- a/aiida_kkr/workflows/voro_start.py +++ b/aiida_kkr/workflows/voro_start.py @@ -556,7 +556,7 @@ def run_voronoi(self): kkr_para.set_value('EMIN', emin_new) self.report(f'INFO: setting EMIN to {emin_new} (DOS check showed that EMIN is too high)') if 'ef_set' in update_list: - kkr_para.set_value('EFSET', self.ctx.ef_set) + kkr_para.set_value('EF_SET', self.ctx.ef_set) self.report(f'INFO: setting Fermi level of stating potential to {self.ctx.ef_set}') updatenode = orm.Dict(dict=kkr_para.get_dict())