diff --git a/deepmd/pt/model/model/ener_model.py b/deepmd/pt/model/model/ener_model.py index 560ba12e84..8064d3eac7 100644 --- a/deepmd/pt/model/model/ener_model.py +++ b/deepmd/pt/model/model/ener_model.py @@ -23,7 +23,6 @@ ) DPEnergyModel_ = make_model(DPEnergyAtomicModel) -DPEnergyModel_ = make_hessian_model(DPEnergyModel_) @BaseModel.register("ener") @@ -40,6 +39,8 @@ def __init__( self._hessian_enabled = False def enable_hessian(self): + self.__class__ = make_hessian_model(type(self)) + self.hess_fitting_def = super(type(self), self).atomic_output_def() self.requires_hessian("energy") self._hessian_enabled = True