From 503654572c64a9c0e100d5cca3bad37b36919ffb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:20:25 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deepmd/entrypoints/test.py | 2 +- deepmd/pt/model/atomic_model/base_atomic_model.py | 6 +++++- deepmd/pt/utils/stat.py | 12 +++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/deepmd/entrypoints/test.py b/deepmd/entrypoints/test.py index 1d79e1d9bc..9c06549c24 100644 --- a/deepmd/entrypoints/test.py +++ b/deepmd/entrypoints/test.py @@ -876,7 +876,7 @@ def test_property( if has_atom_property: for ii in range(numb_test): - test_out = test_data[f"atom_property"][ii].reshape(-1, 1) + test_out = test_data["atom_property"][ii].reshape(-1, 1) pred_out = aproperty[ii].reshape(-1, 1) frame_output = np.hstack((test_out, pred_out)) diff --git a/deepmd/pt/model/atomic_model/base_atomic_model.py b/deepmd/pt/model/atomic_model/base_atomic_model.py index 602ac61163..25d43ee678 100644 --- a/deepmd/pt/model/atomic_model/base_atomic_model.py +++ b/deepmd/pt/model/atomic_model/base_atomic_model.py @@ -459,7 +459,11 @@ def change_out_bias( ) self._store_out_stat(delta_bias, out_std, add=True) elif bias_adjust_mode == "set-by-statistic": - property_name = self.fitting_net.property_name if "property_name" in vars(self.fitting_net) else None + property_name = ( + self.fitting_net.property_name + if "property_name" in vars(self.fitting_net) + else None + ) bias_out, std_out = compute_output_stats( sample_merged, self.get_ntypes(), diff --git a/deepmd/pt/utils/stat.py b/deepmd/pt/utils/stat.py index 93fcf96a28..b6662247f0 100644 --- a/deepmd/pt/utils/stat.py +++ b/deepmd/pt/utils/stat.py @@ -482,10 +482,12 @@ def compute_output_stats_global( if kk in stats_input: if property_name is not None: assert len(keys) == 1 - bias_atom_e["property"], std_atom_e["property"] = compute_stats_property( - stats_input[kk], - merged_natoms[kk], - assigned_bias=assigned_atom_ener[kk], + bias_atom_e["property"], std_atom_e["property"] = ( + compute_stats_property( + stats_input[kk], + merged_natoms[kk], + assigned_bias=assigned_atom_ener[kk], + ) ) return bias_atom_e, std_atom_e else: @@ -498,7 +500,7 @@ def compute_output_stats_global( else: # this key does not have global labels, skip it. continue - + bias_atom_e, std_atom_e = _post_process_stat(bias_atom_e, std_atom_e) # unbias_e is only used for print rmse