Commit 26574a3e authored by Jason Swails's avatar Jason Swails
Browse files

Add error checking for the input GB radii in the GBn methods. The radii must be

between 1 and 2 Angstroms, or they fall outside the bounds of the neck lookup
tables.

At least on my Mac, this results in a C++ exception that does not get translated
into a Python exception (i.e., it is not catchable and crashes the application)
parent b51e05a8
...@@ -564,6 +564,12 @@ class PrmtopLoader(object): ...@@ -564,6 +564,12 @@ class PrmtopLoader(object):
screen[i] = 0.602256336067 screen[i] = 0.602256336067
else: else:
screen[i] = 0.5 screen[i] = 0.5
# radii is currently in Angstroms right now. GBn lookup tables
# only support radii between 1.0 and 2.0
if radii[r] < 1.0 or radii[r] > 2.0:
raise ValueError('GBn requires intrinsic radii between 1 and '
'2 Angstroms (%.3f found for atom %d)' %
(radii[r], i))
if gbmodel == 'GBn2': if gbmodel == 'GBn2':
if elements is None: if elements is None:
raise Exception('GBn2 model requires element information') raise Exception('GBn2 model requires element information')
...@@ -598,6 +604,12 @@ class PrmtopLoader(object): ...@@ -598,6 +604,12 @@ class PrmtopLoader(object):
alpha[i] = 1.0 alpha[i] = 1.0
beta[i] = 0.8 beta[i] = 0.8
gamma[i] = 4.85 gamma[i] = 4.85
# radii is currently in Angstroms right now. GBn lookup tables
# only support radii between 1.0 and 2.0
if radii[r] < 1.0 or radii[r] > 2.0:
raise ValueError('GBn2 requires intrinsic radii between 1 and '
'2 Angstroms (%.3f found for atom %d)' %
(radii[r], i))
lengthConversionFactor = units.angstrom.conversion_factor_to(units.nanometer) lengthConversionFactor = units.angstrom.conversion_factor_to(units.nanometer)
if gbmodel == 'GBn2': if gbmodel == 'GBn2':
for rad, scr, alp, bet, gam in zip(radii, screen, alpha, beta, gamma): for rad, scr, alp, bet, gam in zip(radii, screen, alpha, beta, gamma):
......
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