"wrappers/python/vscode:/vscode.git/clone" did not exist on "8bcff367565b896f7468161480f4d446254a8a13"
Commit 9b2b0cad authored by Peter Eastman's avatar Peter Eastman
Browse files

Modified some stochastic test cases to fail less often

parent 0529f325
...@@ -241,9 +241,9 @@ void testWithThermostat() { ...@@ -241,9 +241,9 @@ void testWithThermostat() {
const int numParticles = 8; const int numParticles = 8;
const double temp = 100.0; const double temp = 100.0;
const double collisionFreq = 20.0; const double collisionFreq = 20.0;
const int numSteps = 10000; const int numSteps = 5000;
System system; System system;
CustomIntegrator integrator(0.005); CustomIntegrator integrator(0.003);
integrator.addUpdateContextState(); integrator.addUpdateContextState();
integrator.addComputePerDof("v", "v+dt*f/m"); integrator.addComputePerDof("v", "v+dt*f/m");
integrator.addComputePerDof("x", "x+dt*v"); integrator.addComputePerDof("x", "x+dt*v");
...@@ -260,6 +260,7 @@ void testWithThermostat() { ...@@ -260,6 +260,7 @@ void testWithThermostat() {
for (int i = 0; i < numParticles; ++i) for (int i = 0; i < numParticles; ++i)
positions[i] = Vec3((i%2 == 0 ? 2 : -2), (i%4 < 2 ? 2 : -2), (i < 4 ? 2 : -2)); positions[i] = Vec3((i%2 == 0 ? 2 : -2), (i%4 < 2 ? 2 : -2), (i < 4 ? 2 : -2));
context.setPositions(positions); context.setPositions(positions);
context.setVelocitiesToTemperature(temp);
// Let it equilibrate. // Let it equilibrate.
...@@ -271,11 +272,11 @@ void testWithThermostat() { ...@@ -271,11 +272,11 @@ void testWithThermostat() {
for (int i = 0; i < numSteps; ++i) { for (int i = 0; i < numSteps; ++i) {
State state = context.getState(State::Energy); State state = context.getState(State::Energy);
ke += state.getKineticEnergy(); ke += state.getKineticEnergy();
integrator.step(1); integrator.step(10);
} }
ke /= numSteps; ke /= numSteps;
double expected = 0.5*numParticles*3*BOLTZ*temp; double expected = 0.5*numParticles*3*BOLTZ*temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 6/std::sqrt((double) numSteps)); ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.1);
} }
/** /**
......
...@@ -241,9 +241,9 @@ void testWithThermostat() { ...@@ -241,9 +241,9 @@ void testWithThermostat() {
const int numParticles = 8; const int numParticles = 8;
const double temp = 100.0; const double temp = 100.0;
const double collisionFreq = 10.0; const double collisionFreq = 10.0;
const int numSteps = 10000; const int numSteps = 5000;
System system; System system;
CustomIntegrator integrator(0.005); CustomIntegrator integrator(0.003);
integrator.addUpdateContextState(); integrator.addUpdateContextState();
integrator.addComputePerDof("v", "v+dt*f/m"); integrator.addComputePerDof("v", "v+dt*f/m");
integrator.addComputePerDof("x", "x+dt*v"); integrator.addComputePerDof("x", "x+dt*v");
...@@ -260,6 +260,7 @@ void testWithThermostat() { ...@@ -260,6 +260,7 @@ void testWithThermostat() {
for (int i = 0; i < numParticles; ++i) for (int i = 0; i < numParticles; ++i)
positions[i] = Vec3((i%2 == 0 ? 2 : -2), (i%4 < 2 ? 2 : -2), (i < 4 ? 2 : -2)); positions[i] = Vec3((i%2 == 0 ? 2 : -2), (i%4 < 2 ? 2 : -2), (i < 4 ? 2 : -2));
context.setPositions(positions); context.setPositions(positions);
context.setVelocitiesToTemperature(temp);
// Let it equilibrate. // Let it equilibrate.
...@@ -271,11 +272,11 @@ void testWithThermostat() { ...@@ -271,11 +272,11 @@ void testWithThermostat() {
for (int i = 0; i < numSteps; ++i) { for (int i = 0; i < numSteps; ++i) {
State state = context.getState(State::Energy); State state = context.getState(State::Energy);
ke += state.getKineticEnergy(); ke += state.getKineticEnergy();
integrator.step(1); integrator.step(10);
} }
ke /= numSteps; ke /= numSteps;
double expected = 0.5*numParticles*3*BOLTZ*temp; double expected = 0.5*numParticles*3*BOLTZ*temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 6/std::sqrt((double) numSteps)); ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.1);
} }
/** /**
......
...@@ -229,10 +229,10 @@ void testWithThermostat() { ...@@ -229,10 +229,10 @@ void testWithThermostat() {
const int numParticles = 8; const int numParticles = 8;
const double temp = 100.0; const double temp = 100.0;
const double collisionFreq = 10.0; const double collisionFreq = 10.0;
const int numSteps = 10000; const int numSteps = 5000;
ReferencePlatform platform; ReferencePlatform platform;
System system; System system;
CustomIntegrator integrator(0.005); CustomIntegrator integrator(0.003);
integrator.addUpdateContextState(); integrator.addUpdateContextState();
integrator.addComputePerDof("v", "v+dt*f/m"); integrator.addComputePerDof("v", "v+dt*f/m");
integrator.addComputePerDof("x", "x+dt*v"); integrator.addComputePerDof("x", "x+dt*v");
...@@ -249,6 +249,7 @@ void testWithThermostat() { ...@@ -249,6 +249,7 @@ void testWithThermostat() {
for (int i = 0; i < numParticles; ++i) for (int i = 0; i < numParticles; ++i)
positions[i] = Vec3((i%2 == 0 ? 2 : -2), (i%4 < 2 ? 2 : -2), (i < 4 ? 2 : -2)); positions[i] = Vec3((i%2 == 0 ? 2 : -2), (i%4 < 2 ? 2 : -2), (i < 4 ? 2 : -2));
context.setPositions(positions); context.setPositions(positions);
context.setVelocitiesToTemperature(temp);
// Let it equilibrate. // Let it equilibrate.
...@@ -260,11 +261,11 @@ void testWithThermostat() { ...@@ -260,11 +261,11 @@ void testWithThermostat() {
for (int i = 0; i < numSteps; ++i) { for (int i = 0; i < numSteps; ++i) {
State state = context.getState(State::Energy); State state = context.getState(State::Energy);
ke += state.getKineticEnergy(); ke += state.getKineticEnergy();
integrator.step(1); integrator.step(10);
} }
ke /= numSteps; ke /= numSteps;
double expected = 0.5*numParticles*3*BOLTZ*temp; double expected = 0.5*numParticles*3*BOLTZ*temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 6/std::sqrt((double) numSteps)); ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.1);
} }
/** /**
......
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