Skip to content

Commit

Permalink
Reuse RUNOPT and RCLUSTZ in voronoi step of kkr_imp workflow
Browse files Browse the repository at this point in the history
During scf a KKRhost calculation might have overwritten the RCLSUTZ and RUNOPT inputs.
When a KKRimp calculation is not done we need to make sure that the impurity potential takes over the same setting as the voronoi run from where the KKRhost calculation started.
This in particular means that the FINDSIZE run option is required to ensure that the radial mesh is the same.
  • Loading branch information
PhilippRue committed Jan 13, 2023
1 parent 55ec356 commit 68e9566
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions aiida_kkr/workflows/kkr_imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ def run_voroaux(self):
kkrcode = self.inputs.kkr
imp_info = self.inputs.impurity_info
voro_params = self.ctx.voro_params_dict

if self.ctx.do_gf_calc:
self.report('INFO: get converged host remote from inputs to extract structure for Voronoi calculation')
converged_host_remote = self.inputs.remote_data_host
Expand All @@ -553,6 +554,9 @@ def run_voroaux(self):
GF_host_calc = remote_data_gf_node.get_incoming(link_label_filter=u'remote_folder').first().node
converged_host_remote = GF_host_calc.inputs.parent_folder

# find host structure
structure_host, voro_calc = VoronoiCalculation.find_parent_structure(converged_host_remote)

# get previous kkr parameters following remote_folder->calc->parameters links
prev_kkrparams = converged_host_remote.get_incoming(link_label_filter='remote_folder'
).first().node.get_incoming(link_label_filter='parameters'
Expand All @@ -570,10 +574,24 @@ def run_voroaux(self):
# add or overwrite some parameters (e.g. things that are only used by voronoi)
calc_params_dict = calc_params.get_dict()
# add some voronoi specific parameters automatically if found (RMTREF should also set RMTCORE to the same value)
if '<RMTREF>' in list(calc_params_dict.keys()):
if calc_params_dict.get('<RMTREF>', None) is not None:
self.report('INFO: add rmtcore to voro params')
self.ctx.change_voro_params['<RMTCORE>'] = calc_params_dict['<RMTREF>']
self.report(self.ctx.change_voro_params)

# add some voronoi-specific settings starting from host's voronoi run (might have been overwritten in between)
# this is necessary to make sure that voronoi creates the same radial mesh for the impurity potential, otherwise KKRimp will fail
if voro_calc.inputs.parameters.get_dict().get('RUNOPT', None) is not None:
self.report("INFO: copy runopt from host's voronoi run")
runopt = self.ctx.change_voro_params.get('RUNOPT', None)
if runopt is None:
runopt = []
runopt += voro_calc.inputs.parameters['RUNOPT']
self.ctx.change_voro_params['RUNOPT'] = runopt
if voro_calc.inputs.parameters.get_dict().get('RCLUSTZ', None) is not None:
self.report("INFO: copy RCLUSTZ from host's voronoi run")
self.ctx.change_voro_params['RCLUSTZ'] = voro_calc.inputs.parameters['RCLUSTZ']

changed_params = False
for key, val in self.ctx.change_voro_params.items():
if key in ['RUNOPT', 'TESTOPT']:
Expand All @@ -589,9 +607,6 @@ def run_voroaux(self):
updatenode.description = 'Overwritten voronoi input parameter from kkr_imp_wc input.'
calc_params = update_params_wf(calc_params, updatenode)

# find host structure
structure_host, voro_calc = VoronoiCalculation.find_parent_structure(converged_host_remote)

# for every impurity, generate a structure and launch the voronoi workflow
# to get the auxiliary impurity startpotentials
self.ctx.voro_calcs = {}
Expand Down

0 comments on commit 68e9566

Please sign in to comment.