[docs]classUnitConverter(GraphPESModel):r""" A wrapper that converts the units of the energy, forces and stress predictions of an underlying model. Parameters ---------- model The underlying model. energy_to_eV The conversion factor for energy, such that the ``model.predict_energy(graph) * energy_to_eV`` gives the energy prediction in eV. length_to_A The conversion factor for length, such that the ``model.predict_forces(graph) * (energy_to_eV / length_to_A)`` gives the force prediction in eV/Å. """def__init__(self,model:GraphPESModel,energy_to_eV:float,length_to_A:float):super().__init__(cutoff=model.cutoff.item(),implemented_properties=model.implemented_properties,)self._model=modelself._energy_to_eV=energy_to_eVself._length_to_A=length_to_Adefforward(self,graph:AtomicGraph)->dict[PropertyKey,torch.Tensor]:predictions=self._model(graph)forkeyinpredictions:ifkeyin["energy","virial"]:predictions[key]*=self._energy_to_eVelifkey=="forces":predictions[key]*=self._energy_to_eV/self._length_to_Aelifkey=="stress":predictions[key]*=self._energy_to_eV/self._length_to_A**3returnpredictions