From 0a2806c506f1f41a7a3e1da63764b34978d1236c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 03:36:18 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- deepmd/dpmodel/atomic_model/dp_atomic_model.py | 1 + deepmd/dpmodel/atomic_model/linear_atomic_model.py | 8 +------- deepmd/dpmodel/atomic_model/pairtab_atomic_model.py | 1 + deepmd/pt/model/atomic_model/dp_atomic_model.py | 1 + deepmd/pt/model/atomic_model/linear_atomic_model.py | 8 +------- deepmd/pt/model/atomic_model/pairtab_atomic_model.py | 1 + 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/deepmd/dpmodel/atomic_model/dp_atomic_model.py b/deepmd/dpmodel/atomic_model/dp_atomic_model.py index e9d8b8ac09..4907483d1d 100644 --- a/deepmd/dpmodel/atomic_model/dp_atomic_model.py +++ b/deepmd/dpmodel/atomic_model/dp_atomic_model.py @@ -25,6 +25,7 @@ BaseAtomicModel, ) + @BaseAtomicModel.register("standard") class DPAtomicModel(BaseAtomicModel): """Model give atomic prediction of some physical property. diff --git a/deepmd/dpmodel/atomic_model/linear_atomic_model.py b/deepmd/dpmodel/atomic_model/linear_atomic_model.py index b775c8d4d5..abf0a038de 100644 --- a/deepmd/dpmodel/atomic_model/linear_atomic_model.py +++ b/deepmd/dpmodel/atomic_model/linear_atomic_model.py @@ -1,9 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import copy -import sys -from abc import ( - abstractmethod, -) from typing import ( Dict, List, @@ -353,9 +349,7 @@ def deserialize(cls, data) -> "DPZBLLinearEnergyAtomicModel": sw_rmin = data.pop("sw_rmin") sw_rmax = data.pop("sw_rmax") smin_alpha = data.pop("smin_alpha") - linear_model = LinearEnergyAtomicModel.deserialize( - data.pop("models") - ) + linear_model = LinearEnergyAtomicModel.deserialize(data.pop("models")) dp_model, zbl_model = linear_model.models type_map = linear_model.type_map diff --git a/deepmd/dpmodel/atomic_model/pairtab_atomic_model.py b/deepmd/dpmodel/atomic_model/pairtab_atomic_model.py index bd2c1ccbdb..99b8ec1eff 100644 --- a/deepmd/dpmodel/atomic_model/pairtab_atomic_model.py +++ b/deepmd/dpmodel/atomic_model/pairtab_atomic_model.py @@ -24,6 +24,7 @@ BaseAtomicModel, ) + @BaseAtomicModel.register("pairtab") class PairTabAtomicModel(BaseAtomicModel): """Pairwise tabulation energy model. diff --git a/deepmd/pt/model/atomic_model/dp_atomic_model.py b/deepmd/pt/model/atomic_model/dp_atomic_model.py index 7a3bf4ac72..5bfe70a5e8 100644 --- a/deepmd/pt/model/atomic_model/dp_atomic_model.py +++ b/deepmd/pt/model/atomic_model/dp_atomic_model.py @@ -32,6 +32,7 @@ log = logging.getLogger(__name__) + @BaseAtomicModel.register("standard") class DPAtomicModel(torch.nn.Module, BaseAtomicModel): """Model give atomic prediction of some physical property. diff --git a/deepmd/pt/model/atomic_model/linear_atomic_model.py b/deepmd/pt/model/atomic_model/linear_atomic_model.py index d9ed15b7a6..f91c5e1d08 100644 --- a/deepmd/pt/model/atomic_model/linear_atomic_model.py +++ b/deepmd/pt/model/atomic_model/linear_atomic_model.py @@ -1,9 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import copy -import sys -from abc import ( - abstractmethod, -) from typing import ( Dict, List, @@ -420,9 +416,7 @@ def deserialize(cls, data) -> "DPZBLLinearEnergyAtomicModel": sw_rmin = data.pop("sw_rmin") sw_rmax = data.pop("sw_rmax") smin_alpha = data.pop("smin_alpha") - linear_model = LinearEnergyAtomicModel.deserialize( - data.pop("models") - ) + linear_model = LinearEnergyAtomicModel.deserialize(data.pop("models")) dp_model, zbl_model = linear_model.models type_map = linear_model.type_map diff --git a/deepmd/pt/model/atomic_model/pairtab_atomic_model.py b/deepmd/pt/model/atomic_model/pairtab_atomic_model.py index b9fcbfef8b..90326956b0 100644 --- a/deepmd/pt/model/atomic_model/pairtab_atomic_model.py +++ b/deepmd/pt/model/atomic_model/pairtab_atomic_model.py @@ -34,6 +34,7 @@ BaseAtomicModel, ) + @BaseAtomicModel.register("pairtab") class PairTabAtomicModel(torch.nn.Module, BaseAtomicModel): """Pairwise tabulation energy model.