From b50fae4c3568ff40ef21e02242ecbf66eb7d4b29 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 21:11:48 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ace045eb..18a52804e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.1 hooks: - id: ruff name: ruff lint From e1b9ae894057987d03bf390d24f9749ec1d50ccc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 21:12:00 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../integration/InteractiveOutputTest.ipynb | 24 +++++++++---------- pyiron_atomistics/sphinx/base.py | 24 +++++++++---------- pyiron_atomistics/sphinx/output_parser.py | 4 ++-- tests/atomic/master/test_murnaghan.py | 2 +- tests/vasp/test_vasp.py | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/notebooks/integration/InteractiveOutputTest.ipynb b/notebooks/integration/InteractiveOutputTest.ipynb index 1dfd449e8..b68680a2b 100644 --- a/notebooks/integration/InteractiveOutputTest.ipynb +++ b/notebooks/integration/InteractiveOutputTest.ipynb @@ -125,12 +125,12 @@ ], "source": [ "for i in range(10):\n", - " assert (\n", - " j.output.forces.shape[0] == i + 1\n", - " ), \"Forces shape does not match number of taken steps\"\n", - " assert (\n", - " j.output.cells.shape[0] == i + 1\n", - " ), \"Cells shape does not match number of taken steps\"\n", + " assert j.output.forces.shape[0] == i + 1, (\n", + " \"Forces shape does not match number of taken steps\"\n", + " )\n", + " assert j.output.cells.shape[0] == i + 1, (\n", + " \"Cells shape does not match number of taken steps\"\n", + " )\n", " j.structure.positions[0, :] += [0.1, 0.1, 0.1]\n", " j.run()" ] @@ -213,12 +213,12 @@ "metadata": {}, "outputs": [], "source": [ - "assert (\n", - " j.output.forces.shape == jl.output.forces.shape\n", - "), \"Forces shape not identical after re-loading the job\"\n", - "assert (\n", - " j.output.cells.shape == jl.output.cells.shape\n", - "), \"Cells shape not identical after re-loading the job\"" + "assert j.output.forces.shape == jl.output.forces.shape, (\n", + " \"Forces shape not identical after re-loading the job\"\n", + ")\n", + "assert j.output.cells.shape == jl.output.cells.shape, (\n", + " \"Cells shape not identical after re-loading the job\"\n", + ")" ] } ], diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index b2d42ae6e..e5669b637 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1032,15 +1032,15 @@ def set_convergence_precision( ionic_force_tolerance = ionic_forces if ionic_energy is not None: ionic_energy_tolerance = ionic_energy - assert ( - ionic_energy_tolerance is None or ionic_energy_tolerance > 0 - ), "ionic_energy_tolerance must be a positive float" - assert ( - ionic_force_tolerance is None or ionic_force_tolerance > 0 - ), "ionic_force_tolerance must be a positive float" - assert ( - electronic_energy is None or electronic_energy > 0 - ), "electronic_energy must be a positive float" + assert ionic_energy_tolerance is None or ionic_energy_tolerance > 0, ( + "ionic_energy_tolerance must be a positive float" + ) + assert ionic_force_tolerance is None or ionic_force_tolerance > 0, ( + "ionic_force_tolerance must be a positive float" + ) + assert electronic_energy is None or electronic_energy > 0, ( + "electronic_energy must be a positive float" + ) if ionic_energy_tolerance is not None or ionic_force_tolerance is not None: # self.input["dE"] = ionic_energy_tolerance # self.input["dF"] = ionic_force_tolerance @@ -1312,9 +1312,9 @@ def _get_potential_path( potential_path = potentials.find_potential_file( path=potentials.find_default(new_element)["Filename"].values[0][0] ) - assert os.path.isfile( - potential_path - ), "such a file does not exist in the pp directory" + assert os.path.isfile(potential_path), ( + "such a file does not exist in the pp directory" + ) elif elem in modified_elements.keys(): new_element = modified_elements[elem] if os.path.isabs(new_element): diff --git a/pyiron_atomistics/sphinx/output_parser.py b/pyiron_atomistics/sphinx/output_parser.py index ea4ddcd18..2b6894ae7 100644 --- a/pyiron_atomistics/sphinx/output_parser.py +++ b/pyiron_atomistics/sphinx/output_parser.py @@ -511,8 +511,8 @@ def get_psi_rec(self, i, ispin, ik, compact=False): ispin = np.arange(self.n_spin)[ispin] off = self._n_gk[ik] * (i + ispin * self.n_states) - psire = self.wfile[f"psi-{ik+1}.re"][off : off + self._n_gk[ik]] - psiim = self.wfile[f"psi-{ik+1}.im"][off : off + self._n_gk[ik]] + psire = self.wfile[f"psi-{ik + 1}.re"][off : off + self._n_gk[ik]] + psiim = self.wfile[f"psi-{ik + 1}.im"][off : off + self._n_gk[ik]] compact_wave = psire + 1j * psiim if compact: return compact_wave diff --git a/tests/atomic/master/test_murnaghan.py b/tests/atomic/master/test_murnaghan.py index 29d44b28f..e93387949 100644 --- a/tests/atomic/master/test_murnaghan.py +++ b/tests/atomic/master/test_murnaghan.py @@ -120,7 +120,7 @@ def test_fitting_routines(self): ax=ax, plot_kwargs={"color": "black", "label": f"plot{i}", "marker": "x"}, ) - ax.set_title(f"Axis {i+1}") + ax.set_title(f"Axis {i + 1}") self.assertEqual(len(ax.lines), 2) with self.subTest(msg="standard polynomial fit"): self.assertAlmostEqual(-90.71969974284912, murn.equilibrium_energy) diff --git a/tests/vasp/test_vasp.py b/tests/vasp/test_vasp.py index 12c1d4806..2dbab42f2 100644 --- a/tests/vasp/test_vasp.py +++ b/tests/vasp/test_vasp.py @@ -547,7 +547,7 @@ def test_kspacing(self): self.assertNotIn( "KPOINTS", job_kspace.files.list(), - "'KPOINTS' file written even when " "KPACING tag is present in INCAR", + "'KPOINTS' file written even when KPACING tag is present in INCAR", ) self.assertTrue(len(w) <= 2) From 94bf9821b75a658f3db80ed135e6e331aa751cd0 Mon Sep 17 00:00:00 2001 From: pyiron-runner Date: Tue, 14 Jan 2025 05:52:00 +0000 Subject: [PATCH 3/5] Format black --- pyiron_atomistics/sphinx/base.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index e5669b637..b2d42ae6e 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1032,15 +1032,15 @@ def set_convergence_precision( ionic_force_tolerance = ionic_forces if ionic_energy is not None: ionic_energy_tolerance = ionic_energy - assert ionic_energy_tolerance is None or ionic_energy_tolerance > 0, ( - "ionic_energy_tolerance must be a positive float" - ) - assert ionic_force_tolerance is None or ionic_force_tolerance > 0, ( - "ionic_force_tolerance must be a positive float" - ) - assert electronic_energy is None or electronic_energy > 0, ( - "electronic_energy must be a positive float" - ) + assert ( + ionic_energy_tolerance is None or ionic_energy_tolerance > 0 + ), "ionic_energy_tolerance must be a positive float" + assert ( + ionic_force_tolerance is None or ionic_force_tolerance > 0 + ), "ionic_force_tolerance must be a positive float" + assert ( + electronic_energy is None or electronic_energy > 0 + ), "electronic_energy must be a positive float" if ionic_energy_tolerance is not None or ionic_force_tolerance is not None: # self.input["dE"] = ionic_energy_tolerance # self.input["dF"] = ionic_force_tolerance @@ -1312,9 +1312,9 @@ def _get_potential_path( potential_path = potentials.find_potential_file( path=potentials.find_default(new_element)["Filename"].values[0][0] ) - assert os.path.isfile(potential_path), ( - "such a file does not exist in the pp directory" - ) + assert os.path.isfile( + potential_path + ), "such a file does not exist in the pp directory" elif elem in modified_elements.keys(): new_element = modified_elements[elem] if os.path.isabs(new_element): From 1f5cdcd5534f9eea47284b8666730766d4a14f32 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 05:52:27 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyiron_atomistics/sphinx/base.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index b2d42ae6e..e5669b637 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1032,15 +1032,15 @@ def set_convergence_precision( ionic_force_tolerance = ionic_forces if ionic_energy is not None: ionic_energy_tolerance = ionic_energy - assert ( - ionic_energy_tolerance is None or ionic_energy_tolerance > 0 - ), "ionic_energy_tolerance must be a positive float" - assert ( - ionic_force_tolerance is None or ionic_force_tolerance > 0 - ), "ionic_force_tolerance must be a positive float" - assert ( - electronic_energy is None or electronic_energy > 0 - ), "electronic_energy must be a positive float" + assert ionic_energy_tolerance is None or ionic_energy_tolerance > 0, ( + "ionic_energy_tolerance must be a positive float" + ) + assert ionic_force_tolerance is None or ionic_force_tolerance > 0, ( + "ionic_force_tolerance must be a positive float" + ) + assert electronic_energy is None or electronic_energy > 0, ( + "electronic_energy must be a positive float" + ) if ionic_energy_tolerance is not None or ionic_force_tolerance is not None: # self.input["dE"] = ionic_energy_tolerance # self.input["dF"] = ionic_force_tolerance @@ -1312,9 +1312,9 @@ def _get_potential_path( potential_path = potentials.find_potential_file( path=potentials.find_default(new_element)["Filename"].values[0][0] ) - assert os.path.isfile( - potential_path - ), "such a file does not exist in the pp directory" + assert os.path.isfile(potential_path), ( + "such a file does not exist in the pp directory" + ) elif elem in modified_elements.keys(): new_element = modified_elements[elem] if os.path.isabs(new_element): From 44d24260d208314da75f29d0658dc9710d778561 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 14 Jan 2025 07:06:37 +0100 Subject: [PATCH 5/5] Update base.py --- pyiron_atomistics/sphinx/base.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/pyiron_atomistics/sphinx/base.py b/pyiron_atomistics/sphinx/base.py index e5669b637..69a854493 100644 --- a/pyiron_atomistics/sphinx/base.py +++ b/pyiron_atomistics/sphinx/base.py @@ -1032,15 +1032,12 @@ def set_convergence_precision( ionic_force_tolerance = ionic_forces if ionic_energy is not None: ionic_energy_tolerance = ionic_energy - assert ionic_energy_tolerance is None or ionic_energy_tolerance > 0, ( - "ionic_energy_tolerance must be a positive float" - ) - assert ionic_force_tolerance is None or ionic_force_tolerance > 0, ( - "ionic_force_tolerance must be a positive float" - ) - assert electronic_energy is None or electronic_energy > 0, ( - "electronic_energy must be a positive float" - ) + cond = ionic_energy_tolerance is None or ionic_energy_tolerance > 0 + assert cond, "ionic_energy_tolerance must be a positive float" + cond = ionic_force_tolerance is None or ionic_force_tolerance > 0 + assert cond, "ionic_force_tolerance must be a positive float" + cond = electronic_energy is None or electronic_energy > 0 + assert cond, "electronic_energy must be a positive float" if ionic_energy_tolerance is not None or ionic_force_tolerance is not None: # self.input["dE"] = ionic_energy_tolerance # self.input["dF"] = ionic_force_tolerance @@ -1312,9 +1309,8 @@ def _get_potential_path( potential_path = potentials.find_potential_file( path=potentials.find_default(new_element)["Filename"].values[0][0] ) - assert os.path.isfile(potential_path), ( - "such a file does not exist in the pp directory" - ) + cond = os.path.isfile(potential_path) + assert cond, "such a file does not exist in the pp directory" elif elem in modified_elements.keys(): new_element = modified_elements[elem] if os.path.isabs(new_element):