"docs-source/vscode:/vscode.git/clone" did not exist on "61ca19f84647e8ff26a6f86666e0700383823d0a"
Unverified Commit cb293447 authored by Sander Roet's avatar Sander Roet Committed by GitHub
Browse files

resolve scipy 1.8.0 io.netcdf deprecation warning (#3451)

parent 129cece9
......@@ -790,7 +790,7 @@ def readAmberSystem(topology, prmtop_filename=None, prmtop_loader=None, shake=No
for (iAtom, jAtom, k, rMin) in prmtop.getBondsNoH():
force.addBond(iAtom, jAtom, rMin, 2*k)
system.addForce(force)
# Add Urey-Bradley terms.
if len(prmtop.getUreyBradleys()) > 0:
if verbose: print("Adding Urey-Bradley terms...")
......@@ -1434,9 +1434,14 @@ class AmberNetcdfRestart(object):
"""
def __init__(self, filename, asNumpy=False):
try:
from scipy.io.netcdf import NetCDFFile
from scipy.io import NetCDFFile
except ImportError:
raise ImportError('scipy is necessary to parse NetCDF restarts')
# scipy < 1.8.0
try:
from scipy.io.netcdf import NetCDFFile
except ImportError:
raise ImportError('scipy is necessary to parse NetCDF '
'restarts')
self.filename = filename
self.velocities = self.boxVectors = self.time = None
......
......@@ -5,11 +5,15 @@ from openmm import *
from openmm.unit import *
import openmm.app.element as elem
try:
from scipy.io import netcdf
from scipy.io import NetCDFFile
SCIPY_IMPORT_FAILED = False
except:
SCIPY_IMPORT_FAILED = True
except ImportError:
try:
# scipy < 1.8.0
from scipy.io import netcdf
SCIPY_IMPORT_FAILED = False
except:
SCIPY_IMPORT_FAILED = True
def compareByElement(array1, array2, cmp):
for x, y in zip(array1, array2):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment