must lower test epsilon with single precision FFTs and pppm used

This commit is contained in:
Axel Kohlmeyer
2023-07-21 12:12:53 -04:00
parent cccc362b3f
commit 21d4be321a
2 changed files with 11 additions and 1 deletions

View File

@ -199,6 +199,9 @@ add_executable(test_fix_timestep test_fix_timestep.cpp)
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(test_fix_timestep PRIVATE USING_STATIC_LIBS=1) target_compile_definitions(test_fix_timestep PRIVATE USING_STATIC_LIBS=1)
endif() endif()
if(FFT_SINGLE)
target_compile_definitions(test_fix_timestep PRIVATE -DFFT_SINGLE)
endif()
target_link_libraries(test_fix_timestep PRIVATE lammps style_tests) target_link_libraries(test_fix_timestep PRIVATE lammps style_tests)
# tests for timestep related fixes (time integration, thermostat, force manipulation, constraints/restraints) # tests for timestep related fixes (time integration, thermostat, force manipulation, constraints/restraints)

View File

@ -279,6 +279,10 @@ TEST(FixTimestep, plain)
ASSERT_EQ(lmp->atom->natoms, nlocal); ASSERT_EQ(lmp->atom->natoms, nlocal);
double epsilon = test_config.epsilon; double epsilon = test_config.epsilon;
// relax test precision when using pppm and single precision FFTs
#if defined(FFT_SINGLE)
if (lmp->force->kspace && utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
#endif
ErrorStats stats; ErrorStats stats;
@ -411,7 +415,6 @@ TEST(FixTimestep, plain)
ifix = lmp->modify->find_fix("test"); ifix = lmp->modify->find_fix("test");
if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") && if (!utils::strmatch(lmp->modify->fix[ifix]->style, "^rigid") &&
!utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")) { !utils::strmatch(lmp->modify->fix[ifix]->style, "^nve/limit")) {
if (!verbose) ::testing::internal::CaptureStdout(); if (!verbose) ::testing::internal::CaptureStdout();
cleanup_lammps(lmp, test_config); cleanup_lammps(lmp, test_config);
if (!verbose) ::testing::internal::GetCapturedStdout(); if (!verbose) ::testing::internal::GetCapturedStdout();
@ -579,6 +582,10 @@ TEST(FixTimestep, omp)
ASSERT_EQ(lmp->atom->natoms, nlocal); ASSERT_EQ(lmp->atom->natoms, nlocal);
double epsilon = test_config.epsilon; double epsilon = test_config.epsilon;
// relax test precision when using pppm and single precision FFTs
#if defined(FFT_SINGLE)
if (lmp->force->kspace && utils::strmatch(lmp->force->kspace_style, "^pppm")) epsilon *= 2.0e8;
#endif
ErrorStats stats; ErrorStats stats;