diff --git a/sci-physics/espresso/files/0001-allow-building-test-deps-without-running-ctest-indir.patch b/sci-physics/espresso/files/0001-allow-building-test-deps-without-running-ctest-indir.patch new file mode 100644 index 0000000000000..9ae60e5cbdb1c --- /dev/null +++ b/sci-physics/espresso/files/0001-allow-building-test-deps-without-running-ctest-indir.patch @@ -0,0 +1,40 @@ +From e0852a7cc236c500cfcd155dd1a58838dbdc438a Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Tue, 2 Sep 2025 19:47:46 -0400 +Subject: [PATCH] allow building test deps without running ctest indirectly + +--- + src/CMakeLists.txt | 3 +-- + testsuite/python/CMakeLists.txt | 3 +-- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 2b80d67..abb251b 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -20,8 +20,7 @@ + + # Target for the unit tests + add_custom_target( +- check_unit_tests COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${TEST_TIMEOUT} +- ${CTEST_ARGS} --output-on-failure) ++ check_unit_tests ) + + if(WITH_TESTS) + # Run unit tests on check +diff --git a/testsuite/python/CMakeLists.txt b/testsuite/python/CMakeLists.txt +index bb057cd..e2107e0 100644 +--- a/testsuite/python/CMakeLists.txt ++++ b/testsuite/python/CMakeLists.txt +@@ -340,7 +340,6 @@ add_custom_target( + add_dependencies(check_python_skip_long pypresso python_test_data) + + add_custom_target( +- check_python COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${TEST_TIMEOUT} +- ${CTEST_ARGS} --output-on-failure) ++ check_python ) + add_dependencies(check_python pypresso python_test_data) + add_dependencies(check check_python) +-- +2.49.1 + diff --git a/sci-physics/espresso/files/espresso-4.2.0-test-deprecations.patch b/sci-physics/espresso/files/espresso-4.2.0-test-deprecations.patch new file mode 100644 index 0000000000000..e721fb199765a --- /dev/null +++ b/sci-physics/espresso/files/espresso-4.2.0-test-deprecations.patch @@ -0,0 +1,112 @@ +From 111283a0e0184e1674ef29ec0bd873a099574096 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= +Date: Tue, 18 Apr 2023 10:46:51 +0200 +Subject: [PATCH] python: Update deprecated setuptools functionality + +Starting with setuptools v67.3.0, the pkg_resources module is being +progressively phased out from the setuptools main module. +--- + doc/tutorials/constant_pH/constant_pH.ipynb | 4 ++-- + maintainer/benchmarks/mc_acid_base_reservoir.py | 4 ++-- + testsuite/python/unittest_decorators.py | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/doc/tutorials/constant_pH/constant_pH.ipynb b/doc/tutorials/constant_pH/constant_pH.ipynb +index bcfd5bdf993..ca4029465a4 100644 +--- a/doc/tutorials/constant_pH/constant_pH.ipynb ++++ b/doc/tutorials/constant_pH/constant_pH.ipynb +@@ -137,10 +137,10 @@ + "plt.rcParams.update({'font.size': 18})\n", + "\n", + "import numpy as np\n", +- "import setuptools\n", ++ "import pkg_resources\n", + "import pint # module for working with units and dimensions\n", + "import time\n", +- "assert setuptools.version.pkg_resources.packaging.specifiers.SpecifierSet('>=0.10.1').contains(pint.__version__), \\\n", ++ "assert pkg_resources.packaging.specifiers.SpecifierSet('>=0.10.1').contains(pint.__version__), \\\n", + " f'pint version {pint.__version__} is too old: several numpy operations can cast away the unit'\n", + "\n", + "import espressomd\n", +diff --git a/maintainer/benchmarks/mc_acid_base_reservoir.py b/maintainer/benchmarks/mc_acid_base_reservoir.py +index 97e465e8c70..a7a7a965f73 100644 +--- a/maintainer/benchmarks/mc_acid_base_reservoir.py ++++ b/maintainer/benchmarks/mc_acid_base_reservoir.py +@@ -24,7 +24,7 @@ + import espressomd + import espressomd.electrostatics + import espressomd.reaction_methods +-import setuptools ++import pkg_resources + import argparse + + parser = argparse.ArgumentParser(description="Benchmark MC simulations in the grand-reaction ensemble. " +@@ -45,7 +45,7 @@ + # process and check arguments + assert args.particles_per_core >= 100, "you need to use at least 100 particles per core to avoid finite-size effects in the simulation" + espressomd.assert_features(['WCA', 'ELECTROSTATICS']) +-assert setuptools.version.pkg_resources.packaging.specifiers.SpecifierSet('>=0.10.1').contains(pint.__version__), \ ++assert pkg_resources.packaging.specifiers.SpecifierSet('>=0.10.1').contains(pint.__version__), \ + f'pint version {pint.__version__} is too old: several numpy operations can cast away the unit' + + +diff --git a/testsuite/python/unittest_decorators.py b/testsuite/python/unittest_decorators.py +index 109f89cc8d7..a9a0e5200c4 100644 +--- a/testsuite/python/unittest_decorators.py ++++ b/testsuite/python/unittest_decorators.py +@@ -19,7 +19,7 @@ + + import sys + import importlib +-import setuptools ++import pkg_resources + import unittest + + import espressomd +@@ -74,7 +74,7 @@ def skipIfUnmetModuleVersionRequirement(module, version_requirement): + _module = importlib.import_module(module) + except ImportError: + return skipIfMissingModules(module) +- if not setuptools.version.pkg_resources.packaging.specifiers.SpecifierSet( ++ if not pkg_resources.packaging.specifiers.SpecifierSet( + version_requirement).contains(_module.__version__): + return unittest.skip( + "Skipping test: version requirement not met for module {}".format(module)) +From bff5e2703d4371f06f281d48181431558066d566 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= +Date: Tue, 20 Dec 2022 19:36:34 +0100 +Subject: [PATCH] tests: Replace deprecated numpy option + +Option 'normed' in numpy.histogramdd was deprecated since 1.15 and +removed in 1.24. +--- + testsuite/python/observable_profile.py | 2 +- + testsuite/python/observable_profileLB.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/testsuite/python/observable_profile.py b/testsuite/python/observable_profile.py +index 9692449185b..0a7b7eafff5 100644 +--- a/testsuite/python/observable_profile.py ++++ b/testsuite/python/observable_profile.py +@@ -51,7 +51,7 @@ def test_density_profile(self): + obs_bin_centers = density_profile.bin_centers() + np_hist, np_edges = tests_common.get_histogram( + np.copy(self.system.part.all().pos), self.kwargs, 'cartesian', +- normed=True) ++ density=True) + np_hist *= len(self.system.part) + np.testing.assert_array_almost_equal(obs_data, np_hist) + for i in range(3): +diff --git a/testsuite/python/observable_profileLB.py b/testsuite/python/observable_profileLB.py +index 4a3527035da..6770cea8e50 100644 +--- a/testsuite/python/observable_profileLB.py ++++ b/testsuite/python/observable_profileLB.py +@@ -91,7 +91,7 @@ def test_velocity_profile(self): + obs_edges = obs.call_method("edges") + _, np_edges = tests_common.get_histogram( + np.zeros([1, 3]), LB_VELOCITY_PROFILE_PARAMS, 'cartesian', +- normed=True) ++ density=True) + for i in range(3): + np.testing.assert_array_almost_equal(obs_edges[i], np_edges[i]) + for x in range(obs_data.shape[0]): diff --git a/sci-physics/espresso/files/espresso-4.2.0-test-rounding.patch b/sci-physics/espresso/files/espresso-4.2.0-test-rounding.patch new file mode 100644 index 0000000000000..80be45f4647f1 --- /dev/null +++ b/sci-physics/espresso/files/espresso-4.2.0-test-rounding.patch @@ -0,0 +1,201 @@ +Several files were removed from this patch due to not applying. + +Only Ellipsoid_test.cpp actually failed for me without it. + +From 18aeab318cbf2df7450d8c2e5e3634802345454c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= +Date: Mon, 17 Apr 2023 11:58:09 +0200 +Subject: [PATCH] tests: Decrease sensitivity to rounding errors + +Expressions involving multiple multiplications can lead to rounding +errors in the order of 1.5 machine precision, triggering assertions +on architectures that don't support double extended precision, or +when fast-math mode is enabled. +--- + .../tests/ReactionAlgorithm_test.cpp | 2 +- + .../tests/SingleReaction_test.cpp | 4 ++-- + .../tests/reaction_methods_utils_test.cpp | 2 +- + .../unit_tests/EspressoSystemStandAlone_test.cpp | 2 +- + src/core/unit_tests/Verlet_list_test.cpp | 2 +- + src/core/unit_tests/p3m_test.cpp | 2 +- + src/core/unit_tests/periodic_fold_test.cpp | 4 ++-- + src/core/unit_tests/specfunc_test.cpp | 2 +- + src/core/unit_tests/thermostats_test.cpp | 2 +- + src/particle_observables/tests/algorithms.cpp | 2 +- + src/shapes/unit_tests/Ellipsoid_test.cpp | 2 +- + src/shapes/unit_tests/Sphere_test.cpp | 2 +- + src/utils/tests/Vector_test.cpp | 5 +++-- + src/utils/tests/interpolation_test.cpp | 3 ++- + src/utils/tests/matrix_vector_product.cpp | 5 +++-- + src/utils/tests/vec_rotate_test.cpp | 2 +- + testsuite/python/analyze_chains.py | 15 ++++++++++----- + testsuite/python/integrator_npt_stats.py | 2 +- + 18 files changed, 34 insertions(+), 26 deletions(-) + +diff --git a/src/core/reaction_methods/tests/SingleReaction_test.cpp b/src/core/reaction_methods/tests/SingleReaction_test.cpp +index aeae253cec1..41a27b03ae9 100644 +--- a/src/core/reaction_methods/tests/SingleReaction_test.cpp ++++ b/src/core/reaction_methods/tests/SingleReaction_test.cpp +@@ -32,7 +32,7 @@ + // and the configurational move probability for a given system state. + BOOST_AUTO_TEST_CASE(SingleReaction_test) { + using namespace ReactionMethods; +- constexpr double tol = 100 * std::numeric_limits::epsilon(); ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + + // create a reaction A -> 3 B + 4 C + int const type_A = 0; +@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(SingleReaction_test) { + std::unordered_map{{type_A, i}, {type_B, j}, {type_C, k}}; + auto const val = calculate_factorial_expression(reaction, p_numbers); + auto const ref = g(i, -1) * g(j, 3) * g(k, 4); +- BOOST_CHECK_CLOSE(val, ref, 5 * tol); ++ BOOST_CHECK_CLOSE(val, ref, 5. * tol); + } + } + } +diff --git a/src/core/unit_tests/periodic_fold_test.cpp b/src/core/unit_tests/periodic_fold_test.cpp +index 7346b472c0e..49d69777c94 100644 +--- a/src/core/unit_tests/periodic_fold_test.cpp ++++ b/src/core/unit_tests/periodic_fold_test.cpp +@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(with_image_count) { + BOOST_CHECK(res.first >= 0.); + BOOST_CHECK(res.first <= box); + BOOST_CHECK(std::abs(res.first - x + res.second * box) <= +- std::numeric_limits::epsilon()); ++ 4. * std::numeric_limits::epsilon()); + } + + /* Corner right */ +@@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(with_image_count) { + BOOST_CHECK(res.first >= 0.); + BOOST_CHECK(res.first < box); + BOOST_CHECK(std::abs(res.first - x + res.second * box) <= +- std::numeric_limits::epsilon()); ++ 4. * std::numeric_limits::epsilon()); + } + } + +diff --git a/src/core/unit_tests/thermostats_test.cpp b/src/core/unit_tests/thermostats_test.cpp +index 0edd7f47a44..16d5cbf992c 100644 +--- a/src/core/unit_tests/thermostats_test.cpp ++++ b/src/core/unit_tests/thermostats_test.cpp +@@ -42,7 +42,7 @@ + + // multiply by 100 because BOOST_CHECK_CLOSE takes a percentage tolerance, + // and by 6 to account for error accumulation in thermostat functions +-constexpr auto tol = 6 * 100 * std::numeric_limits::epsilon(); ++auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + + Particle particle_factory() { + Particle p{}; +diff --git a/src/particle_observables/tests/algorithms.cpp b/src/particle_observables/tests/algorithms.cpp +index 4a1cef824cf..7fabb7c3ef4 100644 +--- a/src/particle_observables/tests/algorithms.cpp ++++ b/src/particle_observables/tests/algorithms.cpp +@@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(algorithms_integer) { + } + + BOOST_AUTO_TEST_CASE(algorithms_double) { +- auto constexpr tol = 100 * std::numeric_limits::epsilon(); ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + std::vector const values{1., 2., 3., 4.}; + { + auto const res = WeightedAverage()(values); +diff --git a/src/shapes/unit_tests/Ellipsoid_test.cpp b/src/shapes/unit_tests/Ellipsoid_test.cpp +index 2f4331a6147..d9d41874bf7 100644 +--- a/src/shapes/unit_tests/Ellipsoid_test.cpp ++++ b/src/shapes/unit_tests/Ellipsoid_test.cpp +@@ -34,7 +34,7 @@ + + BOOST_AUTO_TEST_CASE(dist_function) { + // multiply by 100 because BOOST_REQUIRE_CLOSE takes a percentage tolerance +- auto constexpr tol = std::numeric_limits::epsilon() * 100; ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + double const semiaxes[3] = {3.1, 2.2, 1.3}; + + Shapes::Ellipsoid e; +diff --git a/src/shapes/unit_tests/Sphere_test.cpp b/src/shapes/unit_tests/Sphere_test.cpp +index e6eb19aa2f7..61fb916ce7f 100644 +--- a/src/shapes/unit_tests/Sphere_test.cpp ++++ b/src/shapes/unit_tests/Sphere_test.cpp +@@ -34,7 +34,7 @@ void check_distance_function(Shapes::Sphere &s) { + Utils::Vector3d vec; + double dist; + // multiply by 100 because BOOST_REQUIRE_CLOSE takes a percentage tolerance +- auto const tol = std::numeric_limits::epsilon() * 100; ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + + s.rad() = 1.0; + pos = {0., 0., 0.}; +diff --git a/src/utils/tests/Vector_test.cpp b/src/utils/tests/Vector_test.cpp +index 88bb0ad0ceb..a29709ecfc6 100644 +--- a/src/utils/tests/Vector_test.cpp ++++ b/src/utils/tests/Vector_test.cpp +@@ -119,10 +119,11 @@ BOOST_AUTO_TEST_CASE(test_norm2) { + } + + BOOST_AUTO_TEST_CASE(normalize) { +- Utils::Vector3d v{1, 2, 3}; ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); ++ Utils::Vector3d v{1., 2., 3.}; + v.normalize(); + +- BOOST_CHECK((v.norm2() - 1.0) <= std::numeric_limits::epsilon()); ++ BOOST_CHECK_CLOSE(v.norm2(), 1.0, tol); + } + + BOOST_AUTO_TEST_CASE(comparison_operators) { +diff --git a/src/utils/tests/interpolation_test.cpp b/src/utils/tests/interpolation_test.cpp +index 701a7456c89..b452ab32e9d 100644 +--- a/src/utils/tests/interpolation_test.cpp ++++ b/src/utils/tests/interpolation_test.cpp +@@ -135,6 +135,7 @@ BOOST_AUTO_TEST_CASE(sum_of_weights_odd) { + } + + BOOST_AUTO_TEST_CASE(nearest_point) { ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + std::array nmp; + double weight; + auto save_ind = [&nmp, &weight](const std::array &ind, double w) { +@@ -145,7 +146,7 @@ BOOST_AUTO_TEST_CASE(nearest_point) { + bspline_3d<1>({.1, .2, .3}, save_ind, {0.5, 0.5, 0.5}, {}); + + BOOST_CHECK((std::array{{0, 0, 1}} == nmp)); +- BOOST_CHECK_CLOSE(weight, 1., 100. * std::numeric_limits::epsilon()); ++ BOOST_CHECK_CLOSE(weight, 1., tol); + } + + BOOST_AUTO_TEST_CASE(interpolation_points_3) { +diff --git a/src/utils/tests/matrix_vector_product.cpp b/src/utils/tests/matrix_vector_product.cpp +index 8f7d8f1fdec..f98d0f5bd4f 100644 +--- a/src/utils/tests/matrix_vector_product.cpp ++++ b/src/utils/tests/matrix_vector_product.cpp +@@ -32,10 +32,11 @@ static constexpr std::array, 3> matrix{ + {{{1, 2, 9}}, {{8, 41, 6}}, {{31, 15, 99}}}}; + + BOOST_AUTO_TEST_CASE(inner_product) { ++ auto constexpr tol = 8. * 100. * std::numeric_limits::epsilon(); + const std::array vector{{0.5, 1.25, 3.1}}; + auto const result = Utils::matrix_vector_product(vector); + for (int i = 0; i < 3; ++i) { +- BOOST_CHECK_CLOSE(result[i], boost::inner_product(matrix[i], vector, 0.0), +- 100. * std::numeric_limits::epsilon()); ++ auto const ref = boost::inner_product(matrix[i], vector, 0.0); ++ BOOST_CHECK_CLOSE(result[i], ref, tol); + } + } +diff --git a/src/utils/tests/vec_rotate_test.cpp b/src/utils/tests/vec_rotate_test.cpp +index c1ad10eabb7..88b2af17983 100644 +--- a/src/utils/tests/vec_rotate_test.cpp ++++ b/src/utils/tests/vec_rotate_test.cpp +@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(rotation) { + auto const is = Utils::vec_rotate(k, t, v); + auto const rel_diff = (expected - is).norm() / expected.norm(); + +- BOOST_CHECK(rel_diff < std::numeric_limits::epsilon()); ++ BOOST_CHECK(rel_diff < 8. * std::numeric_limits::epsilon()); + } + + BOOST_AUTO_TEST_CASE(angle_between) { +