From e276434b2894625997934cf69c70413e2a809f4d Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Wed, 30 Dec 2020 11:27:25 +0100
Subject: [PATCH] make mol.mm.simulation unit test more permissive

The test_simulation_energy_calculations unit test compares the potential
energy of crambin after 200 steps steepest descent with a reference value.
Depending on OpenMM version / hardware, we might get slight differences
that propagate through the minimization.
---
 modules/mol/mm/tests/test_simulation.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/mol/mm/tests/test_simulation.cc b/modules/mol/mm/tests/test_simulation.cc
index ba9c282d6..4e46c5fc5 100644
--- a/modules/mol/mm/tests/test_simulation.cc
+++ b/modules/mol/mm/tests/test_simulation.cc
@@ -173,9 +173,13 @@ BOOST_AUTO_TEST_CASE(test_simulation_energy_calculations){
   //Gromacs writes down the positions using nm instead of A, but
   //also has a precision of 3 digits.
 
-  BOOST_CHECK_CLOSE(sim.GetPotentialEnergy(), -2381.24, Real(1e-3));
+  // Threshold is relatively permissive (1e-1->0.1% difference) depending on
+  // OpenMM version / Hardware you might get slightly different results. 
+  // Error propagates when performing 200 steps steepest descent (minimizes from
+  // roughly 1981 down to -2381).
+  BOOST_CHECK_CLOSE(sim.GetPotentialEnergy(), -2381.24, Real(1e-1));
 }
 
 
 
-BOOST_AUTO_TEST_SUITE_END();
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END();
-- 
GitLab