"platforms/cuda/src/CudaForceInfo.cpp" did not exist on "ad4e12035451b108334fe1fdad549d55a4ce4892"
Commit 0699dea8 authored by Andy Simmonett's avatar Andy Simmonett
Browse files

CUDA Extrapolated polaraization test now obeys precision argument, and handles...

CUDA Extrapolated polaraization test now obeys precision argument, and handles finite difference checks appropriately.
parent 1a2cf81e
......@@ -284,8 +284,9 @@ vector<Vec3> setupWaterDimer(System& system, AmoebaMultipoleForce* amoebaMultip
static void check_finite_differences(vector<Vec3> analytic_forces, Context &context, vector<Vec3> positions)
{
// This is a bad test in single precision, due to roundoff errors; skip it in this case.
if(Platform::getPlatformByName("CUDA").getPropertyValue(context, "Precision") != "double") return;
double tol = 1e-5;
// We allow more permissive testing for single precision.
if(Platform::getPlatformByName("CUDA").getPropertyValue(context, "Precision") != "double") tol = 5e-4;
// Take a small step in the direction of the energy gradient and see whether the potential energy changes by the expected amount.
double norm = 0.0;
......@@ -305,7 +306,7 @@ static void check_finite_differences(vector<Vec3> analytic_forces, Context &cont
State state2 = context.getState(State::Energy);
context.setPositions(positions3);
State state3 = context.getState(State::Energy);
ASSERT_EQUAL_TOL(norm, (state2.getPotentialEnergy()-state3.getPotentialEnergy())/stepSize, 1e-4);
ASSERT_EQUAL_TOL(norm, (state2.getPotentialEnergy()-state3.getPotentialEnergy())/stepSize, tol);
}
......@@ -495,6 +496,8 @@ int main(int numberOfArguments, char* argv[]) {
try {
registerAmoebaCudaKernelFactories();
if (numberOfArguments > 1)
Platform::getPlatformByName("CUDA").setPropertyDefaultValue("Precision", std::string(argv[1]));
/*
* Water dimer energy / force tests under various conditions.
......
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