From c409e041a86dbfd45c7c3d7104f167c2b3e3c4d3 Mon Sep 17 00:00:00 2001 From: anyangml Date: Mon, 11 Mar 2024 10:13:49 +0000 Subject: [PATCH 1/2] fix: zbl null test --- deepmd/pt/model/atomic_model/linear_atomic_model.py | 2 +- source/tests/pt/model/test_null_input.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/deepmd/pt/model/atomic_model/linear_atomic_model.py b/deepmd/pt/model/atomic_model/linear_atomic_model.py index 5e1a80087e..e22d8a9db0 100644 --- a/deepmd/pt/model/atomic_model/linear_atomic_model.py +++ b/deepmd/pt/model/atomic_model/linear_atomic_model.py @@ -484,7 +484,7 @@ def _compute_weight( dim=-1, ) # handle masked nnei. - sigma = numerator / denominator # nfrmes, nloc + sigma = numerator / torch.clamp(denominator,1e-20) # nfrmes, nloc u = (sigma - self.sw_rmin) / (self.sw_rmax - self.sw_rmin) coef = torch.zeros_like(u) left_mask = sigma < self.sw_rmin diff --git a/source/tests/pt/model/test_null_input.py b/source/tests/pt/model/test_null_input.py index c8f4307d52..d5cf2475fb 100644 --- a/source/tests/pt/model/test_null_input.py +++ b/source/tests/pt/model/test_null_input.py @@ -125,7 +125,6 @@ def setUp(self): self.model = get_model(model_params).to(env.DEVICE) -@unittest.skip("FAILED at the moment") class TestEnergyModelZBL(unittest.TestCase, NullTest): def setUp(self): model_params = copy.deepcopy(model_zbl) From a864025be655bc7c5e173f4f8c6dc78c1833f6d0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:16:42 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deepmd/pt/model/atomic_model/linear_atomic_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepmd/pt/model/atomic_model/linear_atomic_model.py b/deepmd/pt/model/atomic_model/linear_atomic_model.py index efdce10ca7..66d19c0a02 100644 --- a/deepmd/pt/model/atomic_model/linear_atomic_model.py +++ b/deepmd/pt/model/atomic_model/linear_atomic_model.py @@ -486,7 +486,7 @@ def _compute_weight( dim=-1, ) # handle masked nnei. - sigma = numerator / torch.clamp(denominator,1e-20) # nfrmes, nloc + sigma = numerator / torch.clamp(denominator, 1e-20) # nfrmes, nloc u = (sigma - self.sw_rmin) / (self.sw_rmax - self.sw_rmin) coef = torch.zeros_like(u) left_mask = sigma < self.sw_rmin