Commit f2958043 authored by peastman's avatar peastman
Browse files

Minor changes to speed up some test cases

parent 1c271535
......@@ -77,10 +77,10 @@ void testHarmonicBonds() {
}
void testLargeSystem() {
const int numMolecules = 50;
const int numMolecules = 25;
const int numParticles = numMolecules*2;
const double cutoff = 2.0;
const double boxSize = 5.0;
const double boxSize = 4.0;
const double tolerance = 5;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
......@@ -134,10 +134,10 @@ void testLargeSystem() {
}
void testVirtualSites() {
const int numMolecules = 50;
const int numMolecules = 25;
const int numParticles = numMolecules*3;
const double cutoff = 2.0;
const double boxSize = 5.0;
const double boxSize = 4.0;
const double tolerance = 5;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
......
......@@ -296,7 +296,7 @@ void testArgonBox() {
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(nonbonded);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-5);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-4);
Context context(system, integrator, platform);
context.setPositions(positions);
context.setVelocitiesToTemperature(temp);
......@@ -308,13 +308,13 @@ void testArgonBox() {
// Make sure the temperature is correct.
double ke = 0.0;
for (int i = 0; i < 2000; ++i) {
double t = 2.0 + 0.01 * (i + 1);
for (int i = 0; i < 1000; ++i) {
double t = 2.0 + 0.02 * (i + 1);
integrator.stepTo(t);
State state = context.getState(State::Energy);
ke += state.getKineticEnergy();
}
ke /= 2000;
ke /= 1000;
double expected = 1.5 * numParticles * BOLTZ * temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.01);
}
......
......@@ -77,10 +77,10 @@ void testHarmonicBonds() {
}
void testLargeSystem() {
const int numMolecules = 50;
const int numMolecules = 25;
const int numParticles = numMolecules*2;
const double cutoff = 2.0;
const double boxSize = 5.0;
const double boxSize = 4.0;
const double tolerance = 5;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
......@@ -134,10 +134,10 @@ void testLargeSystem() {
}
void testVirtualSites() {
const int numMolecules = 50;
const int numMolecules = 25;
const int numParticles = numMolecules*3;
const double cutoff = 2.0;
const double boxSize = 5.0;
const double boxSize = 4.0;
const double tolerance = 5;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
......
......@@ -296,7 +296,7 @@ void testArgonBox() {
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(nonbonded);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-5);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-4);
Context context(system, integrator, platform);
context.setPositions(positions);
context.setVelocitiesToTemperature(temp);
......@@ -308,13 +308,13 @@ void testArgonBox() {
// Make sure the temperature is correct.
double ke = 0.0;
for (int i = 0; i < 2000; ++i) {
double t = 2.0 + 0.01 * (i + 1);
for (int i = 0; i < 1000; ++i) {
double t = 2.0 + 0.02 * (i + 1);
integrator.stepTo(t);
State state = context.getState(State::Energy);
ke += state.getKineticEnergy();
}
ke /= 2000;
ke /= 1000;
double expected = 1.5 * numParticles * BOLTZ * temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.01);
}
......
......@@ -383,12 +383,12 @@ void testContinuous3DFunction() {
const int xsize = 10;
const int ysize = 11;
const int zsize = 12;
const double xmin = 0.4;
const double xmin = 0.6;
const double xmax = 1.1;
const double ymin = 0.0;
const double ymax = 0.9;
const double ymax = 0.7;
const double zmin = 0.2;
const double zmax = 1.3;
const double zmax = 0.9;
ReferencePlatform platform;
System system;
system.addParticle(1.0);
......
......@@ -76,10 +76,10 @@ void testHarmonicBonds() {
}
void testLargeSystem() {
const int numMolecules = 50;
const int numMolecules = 25;
const int numParticles = numMolecules*2;
const double cutoff = 2.0;
const double boxSize = 5.0;
const double boxSize = 4.0;
const double tolerance = 5;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
......@@ -134,10 +134,10 @@ void testLargeSystem() {
}
void testVirtualSites() {
const int numMolecules = 50;
const int numMolecules = 25;
const int numParticles = numMolecules*3;
const double cutoff = 2.0;
const double boxSize = 5.0;
const double boxSize = 4.0;
const double tolerance = 5;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
......
......@@ -300,7 +300,7 @@ void testArgonBox() {
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(nonbonded);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-5);
VariableLangevinIntegrator integrator(temp, 6.0, 1e-4);
Context context(system, integrator, platform);
context.setPositions(positions);
context.setVelocitiesToTemperature(temp);
......@@ -312,13 +312,13 @@ void testArgonBox() {
// Make sure the temperature is correct.
double ke = 0.0;
for (int i = 0; i < 2000; ++i) {
double t = 2.0 + 0.01 * (i + 1);
for (int i = 0; i < 1000; ++i) {
double t = 2.0 + 0.02 * (i + 1);
integrator.stepTo(t);
State state = context.getState(State::Energy);
ke += state.getKineticEnergy();
}
ke /= 2000;
ke /= 1000;
double expected = 1.5 * numParticles * BOLTZ * temp;
ASSERT_USUALLY_EQUAL_TOL(expected, ke, 0.01);
}
......
......@@ -99,7 +99,7 @@ void testWater() {
// Create a box of SWM4-NDP water molecules. This involves constraints, virtual sites,
// and Drude particles.
const int gridSize = 4;
const int gridSize = 3;
const int numMolecules = gridSize*gridSize*gridSize;
const double spacing = 0.6;
const double boxSize = spacing*(gridSize+1);
......
......@@ -54,7 +54,7 @@ void testWater() {
// Create a box of SWM4-NDP water molecules. This involves constraints, virtual sites,
// and Drude particles.
const int gridSize = 4;
const int gridSize = 3;
const int numMolecules = gridSize*gridSize*gridSize;
const double spacing = 0.6;
const double boxSize = spacing*(gridSize+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