File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ ase = ["ase>=3.23.0"]
6565# tblite py3.12 support tracked in https://github.com/tblite/tblite/issues/198
6666ase-ext = [" tblite>=0.3.0; python_version < '3.12'" ]
6767openmm = [
68- " mdanalysis>=2.7 .0" ,
68+ " mdanalysis>=2.8 .0" ,
6969 " openmm-mdanalysis-reporter>=0.1.0" ,
7070 " openmm>=8.1.0" ,
7171]
Original file line number Diff line number Diff line change @@ -36,17 +36,30 @@ class written by Harry Moore. The nnpops_nl function
3636import numpy as np
3737import openmm
3838import openmm .app
39- import openmmtorch
4039import torch
4140from e3nn .util import jit
4241from mace .tools import atomic_numbers_to_indices , to_one_hot , utils
4342
4443try :
4544 from NNPOps .neighbors import getNeighborPairs
46- except ImportError as err :
47- raise ImportError (
48- "NNPOps is not installed. Please install it from conda-forge."
49- ) from err
45+ except ImportError :
46+
47+ def getNeighborPairs (* args , ** kwargs ) -> None : # noqa: N802, ARG001
48+ """Raise ImportError if NNPOps is not installed."""
49+ raise ImportError (
50+ "NNPOps is not installed. Please install it from conda-forge."
51+ )
52+
53+
54+ try :
55+ from openmmtorch import TorchForce
56+ except ImportError :
57+
58+ def TorchForce (* args , ** kwargs ) -> None : # noqa: N802, ARG001
59+ """Raise ImportError if openmmtorch is not installed."""
60+ raise ImportError (
61+ "openmmtorch is not installed. Please install it from conda-forge."
62+ )
5063
5164
5265class MaceForce (torch .nn .Module ):
@@ -314,7 +327,7 @@ def add_forces(
314327 module = torch .jit .script (maceforce )
315328
316329 # Create the TorchForce and add it to the System.
317- force = openmmtorch . TorchForce (module )
330+ force = TorchForce (module )
318331 force .setForceGroup (0 )
319332 force .setUsesPeriodicBoundaryConditions (periodic )
320333 system .addForce (force )
You can’t perform that action at this time.
0 commit comments