diff --git a/deepmd/pt/model/atomic_model/linear_atomic_model.py b/deepmd/pt/model/atomic_model/linear_atomic_model.py index 68705049ae..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 / 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)