From 24a18190b7df46802996ee1826cafe32f15388cd Mon Sep 17 00:00:00 2001 From: Sebastiaan Huber Date: Mon, 4 Mar 2024 08:35:59 +0100 Subject: [PATCH] Use `ProcessBuilder._merge` instead of `ProcessBuilder._update` (#335) The `ProcessBuilder._update` method does not properly recurse into nested mapping like `ProcessBuilder._merge` does. Note that the recursiveness just considers normal Python mappings and will not recurse inside node instances that may behave like mappings, such as `Dict` nodes. --- src/aiida_common_workflows/workflows/dissociation.py | 2 +- src/aiida_common_workflows/workflows/eos.py | 2 +- src/aiida_common_workflows/workflows/relax/abinit/generator.py | 2 +- src/aiida_common_workflows/workflows/relax/castep/generator.py | 2 +- src/aiida_common_workflows/workflows/relax/fleur/generator.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aiida_common_workflows/workflows/dissociation.py b/src/aiida_common_workflows/workflows/dissociation.py index 30ad4cef..ea3d2150 100644 --- a/src/aiida_common_workflows/workflows/dissociation.py +++ b/src/aiida_common_workflows/workflows/dissociation.py @@ -170,7 +170,7 @@ def get_sub_workchain_builder(self, distance, reference_workchain=None): builder = process_class.get_input_generator().get_builder( structure=molecule, reference_workchain=reference_workchain, **self.inputs.generator_inputs ) - builder._update(**self.inputs.get('sub_process', {})) + builder._merge(**self.inputs.get('sub_process', {})) distance_node = molecule.creator.inputs.distance diff --git a/src/aiida_common_workflows/workflows/eos.py b/src/aiida_common_workflows/workflows/eos.py index 03d238c2..19661919 100644 --- a/src/aiida_common_workflows/workflows/eos.py +++ b/src/aiida_common_workflows/workflows/eos.py @@ -144,7 +144,7 @@ def get_sub_workchain_builder(self, scale_factor, reference_workchain=None): base_inputs['reference_workchain'] = reference_workchain builder = process_class.get_input_generator().get_builder(**base_inputs, **self.inputs.generator_inputs) - builder._update(**self.inputs.get('sub_process', {})) + builder._merge(**self.inputs.get('sub_process', {})) return builder, structure diff --git a/src/aiida_common_workflows/workflows/relax/abinit/generator.py b/src/aiida_common_workflows/workflows/relax/abinit/generator.py index 9d69595b..7778fc45 100644 --- a/src/aiida_common_workflows/workflows/relax/abinit/generator.py +++ b/src/aiida_common_workflows/workflows/relax/abinit/generator.py @@ -154,7 +154,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091 else: inputs = generate_inputs(self.process_class._process_class, protocol, code, structure, override) - builder._update(inputs) + builder._merge(inputs) # RelaxType if relax_type == RelaxType.NONE: diff --git a/src/aiida_common_workflows/workflows/relax/castep/generator.py b/src/aiida_common_workflows/workflows/relax/castep/generator.py index 4c6e1cbd..655ccbfc 100644 --- a/src/aiida_common_workflows/workflows/relax/castep/generator.py +++ b/src/aiida_common_workflows/workflows/relax/castep/generator.py @@ -203,7 +203,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091 inputs['calc']['kpoints'] = previous_kpoints inputs['base'].pop('kpoints_spacing', None) - builder._update(inputs) + builder._merge(inputs) return builder diff --git a/src/aiida_common_workflows/workflows/relax/fleur/generator.py b/src/aiida_common_workflows/workflows/relax/fleur/generator.py index d1c82d93..587bcb51 100644 --- a/src/aiida_common_workflows/workflows/relax/fleur/generator.py +++ b/src/aiida_common_workflows/workflows/relax/fleur/generator.py @@ -201,7 +201,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091 'wf_parameters': wf_para, } - builder._update(inputs) + builder._merge(inputs) return builder