Unverified Commit e5e2d9c9 authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #2215 from peastman/test

Improvements to testInstallation script
parents 6aeccb40 5f6a4b65
...@@ -27,6 +27,10 @@ def run_tests(): ...@@ -27,6 +27,10 @@ def run_tests():
between them for a test system. If a problem is detected, TestingError is between them for a test system. If a problem is detected, TestingError is
raised. raised.
""" """
print()
print('OpenMM Version:', Platform.getOpenMMVersion())
print('Git Revision:', version.git_revision)
print()
# Create a System for the tests. # Create a System for the tests.
data_dir = os.path.join(os.path.abspath(os.path.split(__file__)[0]), 'openmm', 'app', 'data') data_dir = os.path.join(os.path.abspath(os.path.split(__file__)[0]), 'openmm', 'app', 'data')
...@@ -63,6 +67,7 @@ def run_tests(): ...@@ -63,6 +67,7 @@ def run_tests():
# See how well the platforms agree. # See how well the platforms agree.
errorsOk = True
if numPlatforms > 1: if numPlatforms > 1:
print() print()
print("Median difference in forces between platforms:") print("Median difference in forces between platforms:")
...@@ -75,9 +80,17 @@ def run_tests(): ...@@ -75,9 +80,17 @@ def run_tests():
d = f1-f2 d = f1-f2
error = sqrt((d[0]*d[0]+d[1]*d[1]+d[2]*d[2])/(f1[0]*f1[0]+f1[1]*f1[1]+f1[2]*f1[2])) error = sqrt((d[0]*d[0]+d[1]*d[1]+d[2]*d[2])/(f1[0]*f1[0]+f1[1]*f1[1]+f1[2]*f1[2]))
errors.append(error) errors.append(error)
print("{0} vs. {1}: {2:g}".format(Platform.getPlatform(j).getName(), median = sorted(errors)[len(errors)//2]
Platform.getPlatform(i).getName(), if median < 1e-4:
sorted(errors)[len(errors)//2])) message = ''
else:
message = ' *** LARGE DIFFERENCE **'
errorsOk = False
print("{0} vs. {1}: {2:g}{3}".format(Platform.getPlatform(j).getName(),
Platform.getPlatform(i).getName(), median, message))
if errorsOk:
print()
print('All differences are within tolerance.')
def main(): def main():
......
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