From d5a81620d2b25fee9b8fa2daa30b481a4fc2b6d7 Mon Sep 17 00:00:00 2001 From: Maximilian Kuhn Date: Tue, 17 Jan 2023 23:54:03 +0100 Subject: [PATCH 1/2] :memo: Add new exception for calc_minimize. Add a new exception to the calc_minimize method that is raised when pressure is about to be calculated while the rotation_matrix is None. This would raise an exception anyways, but with a more generic message. --- pyiron_atomistics/lammps/control.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyiron_atomistics/lammps/control.py b/pyiron_atomistics/lammps/control.py index 21c7bf6a6..f0943af0c 100644 --- a/pyiron_atomistics/lammps/control.py +++ b/pyiron_atomistics/lammps/control.py @@ -246,6 +246,9 @@ def calc_minimize( ionic_force_tolerance *= force_units if pressure is not None: + if rotation_matrix is None: + raise ValueError("No rotation matrix given while trying to convert pressure. " + "This is most likely due to no structure being defined.") self._force_skewed = False pressure = self.pressure_to_lammps(pressure, rotation_matrix) if np.isscalar(pressure): From 1fad7d24a2e3e99cf82c072f17d2940c8a2222f6 Mon Sep 17 00:00:00 2001 From: Maximilian Kuhn Date: Wed, 18 Jan 2023 00:11:13 +0100 Subject: [PATCH 2/2] :memo: Reformat exception string Reformat exception to fit style guide --- pyiron_atomistics/lammps/control.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyiron_atomistics/lammps/control.py b/pyiron_atomistics/lammps/control.py index f0943af0c..7d4be45b7 100644 --- a/pyiron_atomistics/lammps/control.py +++ b/pyiron_atomistics/lammps/control.py @@ -247,8 +247,10 @@ def calc_minimize( if pressure is not None: if rotation_matrix is None: - raise ValueError("No rotation matrix given while trying to convert pressure. " - "This is most likely due to no structure being defined.") + raise ValueError( + "No rotation matrix given while trying to convert pressure. " + "This is most likely due to no structure being defined." + ) self._force_skewed = False pressure = self.pressure_to_lammps(pressure, rotation_matrix) if np.isscalar(pressure):