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