Skip to content

Commit

Permalink
Exposing settings_LDAU input in kkr_imp_wc + imp_BdG workflow improve…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
dantogni committed Jun 28, 2024
1 parent 4192c3f commit 1ee56bb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
38 changes: 27 additions & 11 deletions aiida_kkr/workflows/imp_BdG.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__copyright__ = (u'Copyright (c), 2022, Forschungszentrum Jülich GmbH, '
'IAS-1/PGI-1, Germany. All rights reserved.')
__license__ = 'MIT license, see LICENSE.txt file'
__version__ = '0.1.1'
__version__ = '0.1.2'
__contributors__ = (u'David Antognini Silva, Philipp Rüßmann')

# TODO: add _wf_default parameters and activate get_wf_defaults method
Expand All @@ -33,8 +33,8 @@ class kkrimp_BdG_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 BdG_settings: (Dict), set BdG parameters
:param imp_scf.startpot: (SinglefileData), converged impurity potential, skips the impurity scf calculation if provided
:param imp_scf.startpot: (SinglefileData), pre-converged impurity potential used to start the impurity scf calculation
:param imp_scf.converged_potential: (SinglefileData), converged impurity potential, skips the impurity scf calculation if provided
:param imp_scf.wf_parameters: (Dict), parameters for the kkr impurity scf
:param imp_scf.gf_writeout.params_kkr_overwrite: (Dict), set some input parameters of the KKR calculation for the GF writeout step of impurity scf workchain
:param imp_scf.gf_writeout.options: (Dict), computer settings
Expand Down Expand Up @@ -144,10 +144,19 @@ def define(cls, spec):
spec.expose_inputs(
kkr_imp_wc,
namespace='imp_scf',
include=('startpot', 'wf_parameters', 'gf_writeout', 'scf.params_overwrite', 'scf.initial_noco_angles')
include=(
'startpot', 'wf_parameters', 'gf_writeout', 'scf.params_overwrite', 'scf.initial_noco_angles',
'scf.settings_LDAU'
)
)
spec.inputs['imp_scf']['gf_writeout']['kkr'].required = False
spec.input('imp_scf.options', required=False, help='computer options for impurity scf step')
spec.input(
'imp_scf.converged_potential',
valid_type=SinglefileData,
required=False,
help='Converged impurity potential. Skips impurity scf step.'
)

spec.input(
'imp_scf.remote_data_host',
Expand Down Expand Up @@ -268,9 +277,9 @@ def validate_input(self):

def do_imp_pot_calc(self):
"""
run impurity potential calculation only if impurity potential not provided already
run impurity potential calculation only if converged impurity potential not provided already
"""
if not 'startpot' in self.inputs.imp_scf:
if not 'converged_potential' in self.inputs.imp_scf:
return True

def imp_pot_calc(self):
Expand All @@ -284,9 +293,10 @@ def imp_pot_calc(self):
builder.voronoi = self.inputs.voronoi
builder.kkr = self.inputs.kkr
builder.kkrimp = self.inputs.kkrimp
builder.remote_data_host = self.inputs.imp_scf.remote_data_host
if 'remote_data_gf' in self.inputs.imp_scf:
builder.remote_data_gf = self.inputs.imp_scf.remote_data_gf
else:
builder.remote_data_host = self.inputs.imp_scf.remote_data_host
builder.wf_parameters = self.inputs.imp_scf.wf_parameters
if 'options' in self.inputs.imp_scf:
builder.options = self.inputs.imp_scf.options
Expand All @@ -307,6 +317,12 @@ def imp_pot_calc(self):
if 'params_overwrite' in self.inputs.imp_scf.scf:
builder.scf.params_overwrite = self.inputs.imp_scf.scf.params_overwrite # pylint: disable=no-member

if 'startpot' in self.inputs.imp_scf:
builder.startpot = self.inputs.imp_scf.startpot

if 'settings_LDAU' in self.inputs.imp_scf.scf:
builder.scf.settings_LDAU = self.inputs.imp_scf.scf.settings_LDAU # pylint: disable=no-member

imp_calc = self.submit(builder)

return ToContext(last_imp_calc=imp_calc)
Expand Down Expand Up @@ -417,8 +433,8 @@ def DOS_calc(self):
if not self.inputs.calc_DOS:
builder.imp_pot_sfd = self.ctx.last_imp_calc_BdG.outputs.converged_potential
else:
if 'startpot' in self.inputs.imp_scf:
builder.imp_pot_sfd = self.inputs.imp_scf.startpot
if 'converged_potential' in self.inputs.imp_scf:
builder.imp_pot_sfd = self.inputs.imp_scf.converged_potential
else:
builder.imp_pot_sfd = self.ctx.last_imp_calc.outputs.converged_potential

Expand Down Expand Up @@ -468,7 +484,7 @@ def results(self):
else:
self.out('gf_host_BdG', self.inputs.BdG_scf.remote_data_gf)

if 'startpot' not in self.inputs.imp_scf:
if 'converged_potential' not in self.inputs.imp_scf:
self.out('impurity_potential', self.ctx.last_imp_calc.outputs.converged_potential)
else:
self.out('impurity_potential', self.inputs.imp_scf.startpot)
self.out('impurity_potential', self.inputs.imp_scf.converged_potential)
3 changes: 2 additions & 1 deletion aiida_kkr/workflows/kkr_imp.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def define(cls, spec):
# 'wf_parameters',
'params_overwrite',
'initial_noco_angles',
'rimpshift'
'rimpshift',
'settings_LDAU',
)
)

Expand Down

0 comments on commit 1ee56bb

Please sign in to comment.