From 4179764e87670a6c7e1eaf03e1b1a6b9ebf3c79a Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Mon, 12 Sep 2022 09:57:43 +0200 Subject: [PATCH] Convert pressure always to array --- pyiron_atomistics/interactive/scipy_minimizer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyiron_atomistics/interactive/scipy_minimizer.py b/pyiron_atomistics/interactive/scipy_minimizer.py index d3f837c34..2b5dee833 100644 --- a/pyiron_atomistics/interactive/scipy_minimizer.py +++ b/pyiron_atomistics/interactive/scipy_minimizer.py @@ -102,7 +102,7 @@ def run_static(self): self.ref_job.run(delete_existing_job=self._delete_existing_job) self.status.running = True if self.input.pressure is not None: - x0 = np.zeros(sum(np.asarray(self.input.pressure) != None)) + x0 = np.zeros(sum(self.input.pressure != None)) if not self.input.volume_only: x0 = np.append( x0, self.ref_job.structure.get_scaled_positions().flatten() @@ -350,9 +350,12 @@ def pressure_tolerance(self, value: float): self.storage.pressure_tolerance = value @property - def pressure(self) -> List[float]: + def pressure(self): """float: target pressure""" - return self.storage.pressure + if isinstance(self.storage.pressure, Iterable): + return np.asarray(self.storage.pressure) + else: + return self.storage.pressure @pressure.setter def pressure(self, value: Iterable[float]):