diff --git a/distopia/tests/test_distopia.py b/distopia/tests/test_distopia.py index 402cd757..b1906e33 100644 --- a/distopia/tests/test_distopia.py +++ b/distopia/tests/test_distopia.py @@ -341,9 +341,9 @@ def test_dihedrals(self, dtype, positions): dihedrals = distopia.calc_dihedrals_no_box(a, b, c, d) # Check calculated values assert_equal(len(dihedrals), 4, err_msg="calc_dihedrals results have wrong length") - # FIXME: BROKEN assert np.isnan(dihedrals[0]), "Zero length dihedral failed" - # FIXME: BROKEN assert np.isnan(dihedrals[1]), "Straight line dihedral failed" - # FIXME: BROKEN assert_almost_equal(dihedrals[2], np.pi, self.prec, err_msg="180 degree dihedral failed") + assert np.isnan(dihedrals[0]), "Zero length dihedral failed" + assert np.isnan(dihedrals[1]), "Straight line dihedral failed" + assert_almost_equal(dihedrals[2], -np.pi, self.prec, err_msg="180 degree dihedral failed") # np.pi in MDAnalysis assert_almost_equal(dihedrals[3], -0.50714064, self.prec, err_msg="arbitrary dihedral angle failed") diff --git a/libdistopia/src/distopia.cpp b/libdistopia/src/distopia.cpp index 92b93ed2..86862460 100644 --- a/libdistopia/src/distopia.cpp +++ b/libdistopia/src/distopia.cpp @@ -498,6 +498,11 @@ namespace distopia { // apply mask to set NAN where x and y are both zero auto fin = hn::IfThenElse(mask, hn::Set(d, NAN), res); + + // check where it is exactly -np.pi and set to np.pi for compliance with mda code + // auto mask2 = hn::Eq(fin, hn::Set(d, -M_PI)); + // fin = hn::IfThenElse(mask2, hn::Set(d, M_PI), fin); + return fin; } diff --git a/libdistopia/test/test_mda_match.cpp b/libdistopia/test/test_mda_match.cpp index 31ae085a..6dee7ff2 100644 --- a/libdistopia/test/test_mda_match.cpp +++ b/libdistopia/test/test_mda_match.cpp @@ -14,7 +14,7 @@ typedef Types ScalarTypes; // constants constexpr int BOXSIZE = 30; -constexpr int NRESULTS = 10; +constexpr int NRESULTS = 1000; constexpr int NINDICIES = 5; constexpr double abs_err = 1.0e-4;