From 08e06b5c01fc79315b048926f20fb6fdd7232a83 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:45:51 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.1.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.1.0...v5.0.0) - [github.com/kynan/nbstripout: 0.6.1 → 0.8.1](https://github.com/kynan/nbstripout/compare/0.6.1...0.8.1) - [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.9.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.1...v0.9.3) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b3abffa3..3760f45f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v5.0.0 hooks: - id: check-json - id: check-yaml @@ -15,12 +15,12 @@ repos: exclude: *exclude_pre_commit_hooks - repo: https://github.com/kynan/nbstripout - rev: 0.6.1 + rev: 0.8.1 hooks: - id: nbstripout - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.1 + rev: v0.9.3 hooks: - id: ruff-format exclude: &exclude_ruff > From 07c35d229ca3e68f68a5654d91b1a975a093a114 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:45:57 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../calculations/calculate_bands_distance.py | 21 ++++++++++--------- src/aiida_sssp_workflow/cli/inspect.py | 2 +- src/aiida_sssp_workflow/utils/utils.py | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/aiida_sssp_workflow/calculations/calculate_bands_distance.py b/src/aiida_sssp_workflow/calculations/calculate_bands_distance.py index 94096003..bfd69e04 100644 --- a/src/aiida_sssp_workflow/calculations/calculate_bands_distance.py +++ b/src/aiida_sssp_workflow/calculations/calculate_bands_distance.py @@ -119,9 +119,9 @@ def calculate_eta_and_max_diff( weight_a = bandsdata_a.get("weights") weight_b = bandsdata_b.get("weights") weight = weight_a - assert np.allclose( - weight_a, weight_b - ), "Different weight of kpoints of two calculation." + assert np.allclose(weight_a, weight_b), ( + "Different weight of kpoints of two calculation." + ) bands_a = bandsdata_a.get("bands") bands_b = bandsdata_b.get("bands") @@ -205,10 +205,11 @@ def get_bands_distance( # swap to make sure a is less electrons pseudo bandsdata_a, bandsdata_b = bandsdata_b, bandsdata_a - assert ( - int(bandsdata_b["number_of_electrons"]) - >= int(bandsdata_a["number_of_electrons"]) - ), f"Need to be less num_bands in a {bandsdata_a['number_of_electrons']} than b {bandsdata_b['number_of_electrons']}" + assert int(bandsdata_b["number_of_electrons"]) >= int( + bandsdata_a["number_of_electrons"] + ), ( + f"Need to be less num_bands in a {bandsdata_a['number_of_electrons']} than b {bandsdata_b['number_of_electrons']}" + ) num_electrons_a = int(bandsdata_a["number_of_electrons"]) num_electrons_b = int(bandsdata_b["number_of_electrons"]) @@ -238,9 +239,9 @@ def get_bands_distance( # after cut and align in retrive band, the shapes are same now # import ipdb; ipdb.set_trace() - assert np.shape(bandsdata_a["bands"]) == np.shape( - bandsdata_b["bands"] - ), f'{np.shape(bandsdata_a["bands"])} != {np.shape(bandsdata_b["bands"])}' + assert np.shape(bandsdata_a["bands"]) == np.shape(bandsdata_b["bands"]), ( + f"{np.shape(bandsdata_a['bands'])} != {np.shape(bandsdata_b['bands'])}" + ) # eta_v fermi_shift_v = 0.0 diff --git a/src/aiida_sssp_workflow/cli/inspect.py b/src/aiida_sssp_workflow/cli/inspect.py index b94a9b40..cca5d4ef 100644 --- a/src/aiida_sssp_workflow/cli/inspect.py +++ b/src/aiida_sssp_workflow/cli/inspect.py @@ -469,7 +469,7 @@ def inspect(node, output): color = "red" if wfc_scan_healthy != 1 or rho_scan_healthy != 1 else "green" click.secho( - f"Convergence scan healthy check for {property}: wavefunction scan = {round(wfc_scan_healthy*100, 2)}%, charge density scan = {round(rho_scan_healthy*100, 2)}%", + f"Convergence scan healthy check for {property}: wavefunction scan = {round(wfc_scan_healthy * 100, 2)}%, charge density scan = {round(rho_scan_healthy * 100, 2)}%", fg=color, ) diff --git a/src/aiida_sssp_workflow/utils/utils.py b/src/aiida_sssp_workflow/utils/utils.py index a73f5046..6da82931 100644 --- a/src/aiida_sssp_workflow/utils/utils.py +++ b/src/aiida_sssp_workflow/utils/utils.py @@ -164,7 +164,7 @@ def get_magnetic_inputs(structure: orm.StructureData): if kind_name in ["Mn", "O", "Cr"]: for i, site in enumerate(structure.sites): mag_structure.append_atom( - position=site.position, symbols=kind_name, name=f"{kind_name}{i+1}" + position=site.position, symbols=kind_name, name=f"{kind_name}{i + 1}" ) if kind_name == "Mn":