From f19daeea604794edf11c96d9190507a4bd6555d9 Mon Sep 17 00:00:00 2001 From: Edward Linscott Date: Thu, 10 Oct 2024 17:04:43 +0200 Subject: [PATCH] Rejig pseudo ordered dict --- src/koopmans/workflows/_workflow.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/koopmans/workflows/_workflow.py b/src/koopmans/workflows/_workflow.py index 69c697cd7..40035ba8d 100644 --- a/src/koopmans/workflows/_workflow.py +++ b/src/koopmans/workflows/_workflow.py @@ -102,7 +102,7 @@ class Workflow(utils.HasDirectory, ABC): calculator_parameters: Dict[str, settings.SettingsDict] name: str kpoints: Kpoints - _pseudopotentials: OrderedDict[str, str] + _pseudopotentials: Dict[str, str] pseudo_dir: Path projections: ProjectionBlocks ml_model: Optional[AbstractMLModel] @@ -466,13 +466,15 @@ def output_model(self) -> Type[outputs.OutputModel]: ... @property - def pseudopotentials(self) -> Dict[str, str]: - return self._pseudopotentials + def pseudopotentials(self) -> OrderedDict[str, str]: + # Always return the pseudopotentials in alphabetical order + out = OrderedDict() + for k in sorted(self._pseudopotentials): + out[k] = self._pseudopotentials[k] + return out @pseudopotentials.setter - def pseudopotentials(self, value: Union[Dict[str, str], OrderedDict[str, str]]): - if not isinstance(value, OrderedDict): - value = OrderedDict(value) + def pseudopotentials(self, value: Dict[str, str]): self._pseudopotentials = value def get_step_by_uuid(self, uuid: str):