From 12364847859309332f0706afbd6eb5c116664d8b Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Sat, 4 Jul 2026 08:18:16 +0100 Subject: [PATCH] Separate EMLE and MACEEMLE NNPOps checks. --- emle/models/_mace.py | 14 +++++++++----- emle/models/_utils.py | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/emle/models/_mace.py b/emle/models/_mace.py index 30c9a08..a3d0963 100644 --- a/emle/models/_mace.py +++ b/emle/models/_mace.py @@ -34,8 +34,8 @@ from typing import List, Dict, Optional from ._emle import EMLE as _EMLE -from ._emle import _has_nnpops from ._utils import _get_neighbor_pairs +from ._utils import _has_neighbor_pairs from torch import Tensor @@ -172,8 +172,10 @@ def __init__( ) if not _has_e3nn: raise ImportError("e3nn is required to compile the MACEmodel.") - if not _has_nnpops: - raise ImportError("NNPOps is required to use the MACEEMLE model.") + if not _has_neighbor_pairs: + raise ImportError( + "NNPOps.neighbors.getNeighborPairs is required to use the MACEEMLE model." + ) if device is not None: if not isinstance(device, _torch.device): @@ -805,8 +807,10 @@ def __init__( ) if not _has_e3nn: raise ImportError("e3nn is required to compile the MACEmodel.") - if not _has_nnpops: - raise ImportError("NNPOps is required to use the MACEEMLE model.") + if not _has_neighbor_pairs: + raise ImportError( + "NNPOps.neighbors.getNeighborPairs is required to use the MACEEMLE model." + ) if device is not None: if not isinstance(device, _torch.device): diff --git a/emle/models/_utils.py b/emle/models/_utils.py index 46999eb..deb1dda 100644 --- a/emle/models/_utils.py +++ b/emle/models/_utils.py @@ -32,9 +32,11 @@ from typing import Optional, Tuple try: - import NNPOps.neighbors.getNeighborPairs as _getNeighborPairs + from NNPOps.neighbors import getNeighborPairs as _getNeighborPairs + + _has_neighbor_pairs = True except: - pass + _has_neighbor_pairs = False _DEPRECATED_ALPHA_MODES = {"species": "fixed", "reference": "flexible"}