From 5445b0757d3fc1a710913ce6e0e874ea669aa0bc Mon Sep 17 00:00:00 2001 From: Pablo Zubieta <8410335+pabloferz@users.noreply.github.com> Date: Fri, 15 Oct 2021 18:49:10 -0500 Subject: [PATCH] Eliminate deprecation warning for OpenMM 7.6 --- Dockerfile | 1 + wrappers/python/DLExtForce.i | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0c32dd7..062bfe6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,3 +2,4 @@ FROM ssages/pysages-hoomd:latest COPY . openmm-dlext RUN cd openmm-dlext && mkdir build && cd build && cmake .. && make install +RUN python -c "import openmm_dlext" diff --git a/wrappers/python/DLExtForce.i b/wrappers/python/DLExtForce.i index cd94089..359daea 100644 --- a/wrappers/python/DLExtForce.i +++ b/wrappers/python/DLExtForce.i @@ -1,6 +1,15 @@ %module dlpack_extension_swig -%import(module = "simtk.openmm") "OpenMMForce.i" +%pythoncode +%{ +from importlib import import_module +try: + openmm = import_module("openmm") +except: + openmm = import_module("simtk.openmm") +%} + +%import(module = "openmm") "OpenMMForce.i" %include "std_string.i" %{