From 89ad18c9125aa24818c21402fd147463f2dbacc5 Mon Sep 17 00:00:00 2001 From: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:15:14 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Jacob Wilkins <46597752+oerc0122@users.noreply.github.com> --- aiida_mlip/calculations/descriptors.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/aiida_mlip/calculations/descriptors.py b/aiida_mlip/calculations/descriptors.py index 0786ac9..15a04ea 100644 --- a/aiida_mlip/calculations/descriptors.py +++ b/aiida_mlip/calculations/descriptors.py @@ -28,7 +28,7 @@ def define(cls, spec: CalcJobProcessSpec) -> None: Parameters ---------- - spec : `aiida.engine.CalcJobProcessSpec` + spec : aiida.engine.CalcJobProcessSpec The calculation job process spec to define. """ super().define(spec) @@ -88,13 +88,11 @@ def prepare_for_submission( # descriptors is overwriting the placeholder "calculation" from the base.py file codeinfo.cmdline_params[0] = "descriptors" - cmdline_options = {} - if "invariants_only" in self.inputs: - cmdline_options["invariants-only"] = self.inputs.invariants_only.value - if "calc_per_element" in self.inputs: - cmdline_options["calc-per-element"] = self.inputs.calc_per_element.value - if "calc_per_atom" in self.inputs: - cmdline_options["calc-per-atom"] = self.inputs.calc_per_atom.value + cmdline_options = { + key.replace("_", "-"): getattr(self.inputs, key).value + for key in ("invariants_only", "calc_per_element", "calc_per_atom") + if key in self.inputs + } for flag, value in cmdline_options.items(): if isinstance(value, bool):