From 34affa3f9748dd4c28b549dc3aa301161f71de19 Mon Sep 17 00:00:00 2001 From: mafshari Date: Wed, 31 Jul 2024 16:19:59 +0200 Subject: [PATCH] fixes --- .../__init__.py | 0 .../thomasfermi.py | 0 .../interaction/ionization/fieldionization/BSI.py | 13 +++++++------ lib/python/picongpu/picmi/simulation.py | 2 +- .../pypicongpu/species/constant/constant.py | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) rename lib/python/picongpu/picmi/interaction/ionization/{electroniccollisonalequilibrium => electroniccollisionalequilibrium}/__init__.py (100%) rename lib/python/picongpu/picmi/interaction/ionization/{electroniccollisonalequilibrium => electroniccollisionalequilibrium}/thomasfermi.py (100%) diff --git a/lib/python/picongpu/picmi/interaction/ionization/electroniccollisonalequilibrium/__init__.py b/lib/python/picongpu/picmi/interaction/ionization/electroniccollisionalequilibrium/__init__.py similarity index 100% rename from lib/python/picongpu/picmi/interaction/ionization/electroniccollisonalequilibrium/__init__.py rename to lib/python/picongpu/picmi/interaction/ionization/electroniccollisionalequilibrium/__init__.py diff --git a/lib/python/picongpu/picmi/interaction/ionization/electroniccollisonalequilibrium/thomasfermi.py b/lib/python/picongpu/picmi/interaction/ionization/electroniccollisionalequilibrium/thomasfermi.py similarity index 100% rename from lib/python/picongpu/picmi/interaction/ionization/electroniccollisonalequilibrium/thomasfermi.py rename to lib/python/picongpu/picmi/interaction/ionization/electroniccollisionalequilibrium/thomasfermi.py diff --git a/lib/python/picongpu/picmi/interaction/ionization/fieldionization/BSI.py b/lib/python/picongpu/picmi/interaction/ionization/fieldionization/BSI.py index 60634fee8d0..153a6477e75 100644 --- a/lib/python/picongpu/picmi/interaction/ionization/fieldionization/BSI.py +++ b/lib/python/picongpu/picmi/interaction/ionization/fieldionization/BSI.py @@ -30,19 +30,20 @@ class BSI(FieldIonization): MODEL_NAME: str = "BSI" - BSI_extensions: list[BSIExtension] + BSI_extensions: tuple[BSIExtension] """extension to the BSI model""" def get_as_pypicongpu(self) -> pypicongpu.species.constant.ionizationmodel.IonizationModel: if self.BSI_extensions == []: return ionizationmodel.BSI(ionization_current=None_()) - if self.BSI_extensions == [BSIExtension.StarkShift]: - return ionizationmodel.BSIStarkShifted(ionization_current=None_()) - if self.BSI_extensions == [BSIExtension.EffectiveZ]: - return ionizationmodel.BSIEffectiveZ(ionization_current=None_()) - if len(self.BSI_extensions) > 1: pypicongpu.util.unsupported("more than one BSI_extension") else: pypicongpu.util.unsupported(f"unknown BSI_extension {self.BSI_extensions[0]}") + + if self.BSI_extensions[0] is BSIExtension.StarkShift: + return ionizationmodel.BSIStarkShifted(ionization_current=None_()) + if self.BSI_extensions[0] is BSIExtension.EffectiveZ: + return ionizationmodel.BSIEffectiveZ(ionization_current=None_()) + raise ValueError("unknown BSI extension") diff --git a/lib/python/picongpu/picmi/simulation.py b/lib/python/picongpu/picmi/simulation.py index 5f1840601c6..5f6c559463a 100644 --- a/lib/python/picongpu/picmi/simulation.py +++ b/lib/python/picongpu/picmi/simulation.py @@ -368,7 +368,7 @@ def write_input_file( def picongpu_add_custom_user_input(self, custom_user_input: pypicongpu.customuserinput.InterfaceCustomUserInput): """add custom user input to previously stored input""" - self.picongpu_custom_user_input = (self.picongpu_custom_user_input + []) + [custom_user_input] + self.picongpu_custom_user_input = (self.picongpu_custom_user_input or []) + [custom_user_input] def add_interaction(self, interaction) -> None: pypicongpu.util.unsupported( diff --git a/lib/python/picongpu/pypicongpu/species/constant/constant.py b/lib/python/picongpu/pypicongpu/species/constant/constant.py index 01910842ebf..9b50c52bf73 100644 --- a/lib/python/picongpu/pypicongpu/species/constant/constant.py +++ b/lib/python/picongpu/pypicongpu/species/constant/constant.py @@ -51,8 +51,8 @@ def __eq__(self, other) -> bool: if key not in other.__dict__: return False - for key, value in self.__dict__: - if self.value != other.__dict__[key]: + for key, value in self.__dict__.items(): + if value != other.__dict__[key]: return False return True