Commit 71d33617 authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Merge remote-tracking branch 'upstream/master'

parents eb232608 9da36463
......@@ -51,6 +51,8 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
Vec3 computeDelta(const Vec3& pos1, const Vec3& pos2, bool periodic, const Vec3* periodicBoxVectors) {
......@@ -93,7 +95,6 @@ void validateAxilrodTeller(CustomManyParticleForce* force, const vector<Vec3>& p
ASSERT(!system.usesPeriodicBoundaryConditions());
}
VerletIntegrator integrator(0.001);
ReferencePlatform platform;
Context context(system, integrator, platform);
context.setPositions(positions);
State state1 = context.getState(State::Forces | State::Energy);
......@@ -155,7 +156,6 @@ void validateStillingerWeber(CustomManyParticleForce* force, const vector<Vec3>&
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(force);
VerletIntegrator integrator(0.001);
ReferencePlatform platform;
Context context(system, integrator, platform);
context.setPositions(positions);
State state1 = context.getState(State::Forces | State::Energy);
......@@ -340,7 +340,6 @@ void testExclusions() {
void testAllTerms() {
int numParticles = 4;
ReferencePlatform platform;
// Create a system with a CustomManyParticleForce.
......@@ -424,7 +423,6 @@ void testParameters() {
}
system.addForce(force);
VerletIntegrator integrator(0.001);
ReferencePlatform platform;
Context context(system, integrator, platform);
context.setPositions(positions);
......@@ -510,7 +508,6 @@ void testTabulatedFunctions() {
}
system.addForce(force);
VerletIntegrator integrator(0.001);
ReferencePlatform platform;
Context context(system, integrator, platform);
context.setPositions(positions);
......@@ -562,7 +559,6 @@ void testTypeFilters() {
force->setTypeFilter(2, f2);
system.addForce(force);
VerletIntegrator integrator(0.001);
ReferencePlatform platform;
Context context(system, integrator, platform);
context.setPositions(positions);
......
......@@ -53,10 +53,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testSimpleExpression() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -79,7 +80,6 @@ void testSimpleExpression() {
}
void testParameters() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -140,7 +140,6 @@ void testParameters() {
}
void testExclusions() {
ReferencePlatform platform;
System system;
VerletIntegrator integrator(0.01);
CustomNonbondedForce* nonbonded = new CustomNonbondedForce("a*r; a=a1+a2");
......@@ -171,7 +170,6 @@ void testExclusions() {
}
void testCutoff() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -201,7 +199,6 @@ void testCutoff() {
}
void testPeriodic() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -232,7 +229,6 @@ void testPeriodic() {
}
void testTriclinic() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -292,7 +288,6 @@ void testTriclinic() {
}
void testContinuous1DFunction() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -337,7 +332,6 @@ void testContinuous2DFunction() {
const double xmax = 1.5;
const double ymin = 0.0;
const double ymax = 2.1;
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -389,7 +383,6 @@ void testContinuous3DFunction() {
const double ymax = 0.7;
const double zmin = 0.2;
const double zmax = 0.9;
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -439,7 +432,6 @@ void testContinuous3DFunction() {
}
void testDiscrete1DFunction() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -469,7 +461,6 @@ void testDiscrete1DFunction() {
void testDiscrete2DFunction() {
const int xsize = 10;
const int ysize = 5;
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -503,7 +494,6 @@ void testDiscrete3DFunction() {
const int xsize = 8;
const int ysize = 5;
const int zsize = 6;
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -540,7 +530,6 @@ void testCoulombLennardJones() {
const int numMolecules = 300;
const int numParticles = numMolecules*2;
const double boxSize = 20.0;
ReferencePlatform platform;
// Create two systems: one with a NonbondedForce, and one using a CustomNonbondedForce to implement the same interaction.
......@@ -614,7 +603,6 @@ void testCoulombLennardJones() {
}
void testSwitchingFunction() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -673,7 +661,6 @@ void testLongRangeCorrection() {
int numParticles = gridSize*gridSize*gridSize;
double boxSize = gridSize*0.7;
double cutoff = boxSize/3;
ReferencePlatform platform;
System standardSystem;
System customSystem;
VerletIntegrator integrator1(0.01);
......@@ -748,7 +735,6 @@ void testLongRangeCorrection() {
void testInteractionGroups() {
const int numParticles = 6;
ReferencePlatform platform;
System system;
VerletIntegrator integrator(0.01);
CustomNonbondedForce* nonbonded = new CustomNonbondedForce("v1+v2");
......@@ -790,7 +776,6 @@ void testLargeInteractionGroup() {
// Create a large system.
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
for (int i = 0; i < numParticles; i++)
......@@ -868,7 +853,6 @@ void testInteractionGroupLongRangeCorrection() {
const int numParticles = 10;
const double boxSize = 10.0;
const double cutoff = 0.5;
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
CustomNonbondedForce* nonbonded = new CustomNonbondedForce("c1*c2*r^-4");
......
......@@ -50,11 +50,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testTorsions() {
ReferencePlatform platform;
// Create a system using a CustomTorsionForce.
System customSystem;
......@@ -141,7 +141,6 @@ void testTorsions() {
}
void testRange() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......
......@@ -48,6 +48,8 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double EWALD_TOL = 1e-5;
const double PME_TOL = 5e-5;
......@@ -59,9 +61,7 @@ void testEwaldExact() {
const double cutoff = 1.0;
const double boxSize = 2.82;
ReferencePlatform platform;
System system;
for (int i = 0; i < numParticles/2; i++)
system.addParticle(22.99);
for (int i = 0; i < numParticles/2; i++)
......@@ -112,7 +112,6 @@ void testEwaldPME() {
// Use amorphous NaCl system
// The particles are simple charges, no VdW interactions
ReferencePlatform platform;
System system;
for (int i = 0; i < numParticles/2; i++)
system.addParticle(22.99);
......@@ -217,7 +216,6 @@ void testEwaldPME() {
}
void testEwald2Ions() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -244,7 +242,6 @@ void testEwald2Ions() {
}
void testWaterSystem() {
ReferencePlatform platform;
System system;
static int numParticles = 648;
const double boxSize = 1.86206;
......@@ -305,7 +302,6 @@ void testWaterSystem() {
void testTriclinic() {
// Create a triclinic box containing eight particles.
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(2.5, 0, 0), Vec3(0.5, 3.0, 0), Vec3(0.7, 0.9, 3.5));
for (int i = 0; i < 8; i++)
......@@ -373,7 +369,6 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
positions[i] = Vec3(boxWidth*genrand_real2(sfmt), boxWidth*genrand_real2(sfmt), boxWidth*genrand_real2(sfmt));
}
force->setNonbondedMethod(method);
ReferencePlatform platform;
// For various values of the cutoff and error tolerance, see if the actual error is reasonable.
......@@ -425,7 +420,6 @@ void testPMEParameters() {
positions[i] = Vec3(boxWidth*genrand_real2(sfmt), boxWidth*genrand_real2(sfmt), boxWidth*genrand_real2(sfmt));
}
force->setNonbondedMethod(NonbondedForce::PME);
ReferencePlatform platform;
// Compute the energy with an error tolerance of 1e-3.
......
......@@ -48,10 +48,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testSingleParticle() {
ReferencePlatform platform;
System system;
system.addParticle(2.0);
LangevinIntegrator integrator(0, 0.1, 0.01);
......@@ -85,7 +86,6 @@ void testSingleParticle() {
}
void testGlobalSettings() {
ReferencePlatform platform;
System system;
system.addParticle(2.0);
LangevinIntegrator integrator(0, 0.1, 0.01);
......@@ -114,7 +114,6 @@ void testGlobalSettings() {
}
void testCutoffAndPeriodic() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -183,7 +182,6 @@ void testCutoffAndPeriodic() {
}
void testForce() {
ReferencePlatform platform;
const int numParticles = 10;
System system;
LangevinIntegrator integrator(0, 0.1, 0.01);
......
......@@ -50,10 +50,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testSingleParticle() {
ReferencePlatform platform;
System system;
system.addParticle(2.0);
LangevinIntegrator integrator(0, 0.1, 0.01);
......@@ -89,8 +90,6 @@ void testSingleParticle() {
}
void testEnergyEthane(int applyBornRadiiScaling) {
ReferencePlatform platform;
const int numParticles = 8;
System system;
LangevinIntegrator integrator(0, 0.1, 0.01);
......
......@@ -46,10 +46,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testAngles() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......
......@@ -46,10 +46,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testBonds() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......
......@@ -44,10 +44,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testCalcKE() {
ReferencePlatform platform;
System system;
for (int i = 0; i < 4; ++i)
system.addParticle(i+1);
......
......@@ -48,10 +48,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testSingleBond() {
ReferencePlatform platform;
System system;
system.addParticle(2.0);
system.addParticle(2.0);
......@@ -97,7 +98,6 @@ void testSingleBond() {
void testTemperature() {
const int numParticles = 8;
const double temp = 100.0;
ReferencePlatform platform;
System system;
LangevinIntegrator integrator(temp, 2.0, 0.01);
NonbondedForce* forceField = new NonbondedForce();
......@@ -132,7 +132,6 @@ void testTemperature() {
void testConstraints() {
const int numParticles = 8;
const double temp = 100.0;
ReferencePlatform platform;
System system;
LangevinIntegrator integrator(temp, 2.0, 0.01);
integrator.setConstraintTolerance(1e-5);
......@@ -172,7 +171,6 @@ void testConstraints() {
}
void testConstrainedMasslessParticles() {
ReferencePlatform platform;
System system;
system.addParticle(0.0);
system.addParticle(1.0);
......@@ -207,7 +205,6 @@ void testRandomSeed() {
const int numParticles = 8;
const double temp = 100.0;
const double collisionFreq = 10.0;
ReferencePlatform platform;
System system;
LangevinIntegrator integrator(temp, 2.0, 0.01);
NonbondedForce* forceField = new NonbondedForce();
......
......@@ -45,6 +45,8 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
void testHarmonicBonds() {
const int numParticles = 10;
System system;
......@@ -64,7 +66,6 @@ void testHarmonicBonds() {
// Minimize it and check that all bonds are at their equilibrium distances.
VerletIntegrator integrator(0.01);
ReferencePlatform platform;
Context context(system, integrator, platform);
context.setPositions(positions);
LocalEnergyMinimizer::minimize(context, 1e-5);
......@@ -105,7 +106,6 @@ void testLargeSystem() {
// Minimize it and verify that the energy has decreased.
ReferencePlatform platform;
VerletIntegrator integrator(0.01);
Context context(system, integrator, platform);
context.setPositions(positions);
......@@ -167,7 +167,6 @@ void testVirtualSites() {
// Minimize it and verify that the energy has decreased.
ReferencePlatform platform;
VerletIntegrator integrator(0.01);
Context context(system, integrator, platform);
context.setPositions(positions);
......
......@@ -51,6 +51,8 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
void testIdealGas() {
const int numParticles = 64;
const int frequency = 10;
......@@ -63,7 +65,6 @@ void testIdealGas() {
// Create a gas of noninteracting particles.
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(initialLength, 0, 0), Vec3(0, 0.5*initialLength, 0), Vec3(0, 0, 2*initialLength));
vector<Vec3> positions(numParticles);
......@@ -124,7 +125,6 @@ void testIdealGasAxis(int axis) {
// Create a gas of noninteracting particles.
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(initialLength, 0, 0), Vec3(0, 0.5*initialLength, 0), Vec3(0, 0, 2*initialLength));
vector<Vec3> positions(numParticles);
......@@ -182,7 +182,6 @@ void testRandomSeed() {
const int numParticles = 8;
const double temp = 100.0;
const double pressure = 1.5;
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(8, 0, 0), Vec3(0, 8, 0), Vec3(0, 0, 8));
VerletIntegrator integrator(0.01);
......@@ -255,7 +254,6 @@ void testTriclinic() {
// Create a gas of noninteracting particles.
ReferencePlatform platform;
System system;
Vec3 initialBox[3];
initialBox[0] = Vec3(initialLength, 0, 0);
......@@ -347,7 +345,6 @@ void testEinsteinCrystal() {
const double pres3[] = {2.0, 8.0, 15.0};
const double initialVolume = numParticles*BOLTZ*temp/pressureInMD;
const double initialLength = std::pow(initialVolume, 1.0/3.0);
ReferencePlatform platform;
vector<double> initialPositions(3);
vector<double> results;
// Run four groups of anisotropic simulations; scaling just x, y, z, then all three.
......
......@@ -49,8 +49,9 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
void testChangingBoxSize() {
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 5, 0), Vec3(0, 0, 6));
system.addParticle(1.0);
......@@ -100,7 +101,6 @@ void testIdealGas() {
// Create a gas of noninteracting particles.
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(initialLength, 0, 0), Vec3(0, 0.5*initialLength, 0), Vec3(0, 0, 2*initialLength));
vector<Vec3> positions(numParticles);
......@@ -148,7 +148,6 @@ void testRandomSeed() {
const int numParticles = 8;
const double temp = 100.0;
const double pressure = 1.5;
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(8, 0, 0), Vec3(0, 8, 0), Vec3(0, 0, 8));
VerletIntegrator integrator(0.01);
......
......@@ -49,6 +49,8 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
void testIdealGas(MonteCarloMembraneBarostat::XYMode xymode, MonteCarloMembraneBarostat::ZMode zmode) {
const int numParticles = 64;
const int frequency = 1;
......@@ -63,7 +65,6 @@ void testIdealGas(MonteCarloMembraneBarostat::XYMode xymode, MonteCarloMembraneB
// Create a gas of noninteracting particles.
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(initialLength, 0, 0), Vec3(0, 0.5*initialLength, 0), Vec3(0, 0, 2*initialLength));
vector<Vec3> positions(numParticles);
......@@ -121,7 +122,6 @@ void testRandomSeed() {
const double temp = 100.0;
const double pressure = 1.5;
const double tension = 0.3;
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(8, 0, 0), Vec3(0, 8, 0), Vec3(0, 0, 8));
VerletIntegrator integrator(0.01);
......
......@@ -48,10 +48,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testCoulomb() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -76,7 +77,6 @@ void testCoulomb() {
}
void testLJ() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -103,7 +103,6 @@ void testLJ() {
}
void testExclusionsAnd14() {
ReferencePlatform platform;
System system;
VerletIntegrator integrator(0.01);
NonbondedForce* nonbonded = new NonbondedForce();
......@@ -190,7 +189,6 @@ void testExclusionsAnd14() {
}
void testCutoff() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -229,7 +227,6 @@ void testCutoff() {
}
void testCutoff14() {
ReferencePlatform platform;
System system;
VerletIntegrator integrator(0.01);
NonbondedForce* nonbonded = new NonbondedForce();
......@@ -326,7 +323,6 @@ void testCutoff14() {
}
void testPeriodic() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -363,7 +359,6 @@ void testPeriodic() {
}
void testTriclinic() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......@@ -432,7 +427,6 @@ void testDispersionCorrection() {
int numParticles = gridSize*gridSize*gridSize;
double boxSize = gridSize*0.7;
double cutoff = boxSize/3;
ReferencePlatform platform;
System system;
VerletIntegrator integrator(0.01);
NonbondedForce* nonbonded = new NonbondedForce();
......@@ -496,7 +490,6 @@ void testDispersionCorrection() {
}
void testSwitchingFunction(NonbondedForce::NonbondedMethod method) {
ReferencePlatform platform;
System system;
system.setDefaultPeriodicBoxVectors(Vec3(6, 0, 0), Vec3(0, 6, 0), Vec3(0, 0, 6));
system.addParticle(1.0);
......
......@@ -46,10 +46,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testPeriodicTorsions() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......
......@@ -46,10 +46,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testRBTorsions() {
ReferencePlatform platform;
System system;
system.addParticle(1.0);
system.addParticle(1.0);
......
......@@ -43,6 +43,8 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
void testGaussian() {
const int numValues = 10000000;
double mean = 0.0;
......@@ -74,7 +76,6 @@ void testRandomVelocities() {
const int numParticles = 10000;
const double temperture = 100.0;
ReferencePlatform platform;
System system;
VerletIntegrator integrator(0.01);
for (int i = 0; i < numParticles; ++i)
......
......@@ -47,12 +47,13 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
void testConstraints() {
const int numMolecules = 10;
const int numParticles = numMolecules*3;
const int numConstraints = numMolecules*3;
const double temp = 100.0;
ReferencePlatform platform;
System system;
LangevinIntegrator integrator(temp, 2.0, 0.001);
integrator.setConstraintTolerance(1e-5);
......
......@@ -48,10 +48,11 @@
using namespace OpenMM;
using namespace std;
ReferencePlatform platform;
const double TOL = 1e-5;
void testSingleBond() {
ReferencePlatform platform;
System system;
system.addParticle(2.0);
system.addParticle(2.0);
......@@ -97,7 +98,6 @@ void testSingleBond() {
void testTemperature() {
const int numParticles = 8;
const double temp = 100.0;
ReferencePlatform platform;
System system;
VariableLangevinIntegrator integrator(temp, 5.0, 5e-5);
NonbondedForce* forceField = new NonbondedForce();
......@@ -133,7 +133,6 @@ void testTemperature() {
void testConstraints() {
const int numParticles = 8;
const double temp = 100.0;
ReferencePlatform platform;
System system;
VariableLangevinIntegrator integrator(temp, 2.0, 1e-5);
integrator.setConstraintTolerance(1e-5);
......@@ -174,7 +173,6 @@ void testConstraints() {
}
void testConstrainedMasslessParticles() {
ReferencePlatform platform;
System system;
system.addParticle(0.0);
system.addParticle(1.0);
......@@ -208,7 +206,6 @@ void testConstrainedMasslessParticles() {
void testRandomSeed() {
const int numParticles = 8;
const double temp = 100.0;
ReferencePlatform platform;
System system;
VariableLangevinIntegrator integrator(temp, 2.0, 1e-5);
NonbondedForce* forceField = new NonbondedForce();
......@@ -276,7 +273,6 @@ void testArgonBox() {
// Create a box of argon atoms.
ReferencePlatform platform;
System system;
NonbondedForce* nonbonded = new NonbondedForce();
vector<Vec3> positions;
......
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