"""Wrapper for MACE model in TorchSim.This module re-exports the MACE package's torch-sim integration for convenientimporting. The actual implementation is maintained in the `mace` package.References: - MACE Package: https://github.com/ACEsuit/mace"""importtracebackimportwarningsfromtypingimportAnyfromtorch_sim.models.interfaceimportModelInterfacetry:frommace.calculators.mace_torchsimimportMaceTorchSimModelexceptImportErrorasexc:warnings.warn(f"MACE import failed: {traceback.format_exc()}",stacklevel=2)classMaceModel(ModelInterface):"""Dummy MACE model wrapper for torch-sim to enable safe imports. NOTE: This class is a placeholder when `mace` is not installed. It raises an ImportError if accessed. """def__init__(self,err:ImportError=exc,*_args:Any,**_kwargs:Any)->None:"""Dummy init for type checking."""raiseerrelse:# Create a backwards-compatible wrapper around MaceTorchSimModel
[docs]classMaceModel(MaceTorchSimModel):"""Computes energies for multiple systems using a MACE model. This class wraps the MACE first-party TorchSim interface, providing backwards compatibility with the previous torch-sim implementation. This class wraps a MACE model to compute energies, forces, and stresses for atomic systems within the TorchSim framework. It supports batched calculations for multiple systems and handles the necessary transformations between TorchSim's data structures and MACE's expected inputs. """