"platforms/cpu/tests/TestCpuGayBerneForce.cpp" did not exist on "1763a7647ad427e8abde790bf6d0a3d856d824c2"
Commit a4020466 authored by Peter Eastman's avatar Peter Eastman
Browse files

Renamed OpenMMContext to Context

parent 95b8dbd6
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
#include "CudaStreamFactory.h" #include "CudaStreamFactory.h"
#include "CudaStreamImpl.h" #include "CudaStreamImpl.h"
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "kernels/gputypes.h" #include "kernels/gputypes.h"
using namespace OpenMM; using namespace OpenMM;
StreamImpl* CudaStreamFactory::createStreamImpl(std::string name, int size, Stream::DataType type, const Platform& platform, OpenMMContextImpl& context) const { StreamImpl* CudaStreamFactory::createStreamImpl(std::string name, int size, Stream::DataType type, const Platform& platform, ContextImpl& context) const {
CudaPlatform::PlatformData& data = *static_cast<CudaPlatform::PlatformData*>(context.getPlatformData()); CudaPlatform::PlatformData& data = *static_cast<CudaPlatform::PlatformData*>(context.getPlatformData());
if (name == "particlePositions") { if (name == "particlePositions") {
float padding[] = {100000.0f, 100000.0f, 100000.0f, 0.2f}; float padding[] = {100000.0f, 100000.0f, 100000.0f, 0.2f};
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/AndersenThermostat.h" #include "openmm/AndersenThermostat.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -63,7 +63,7 @@ void testTemperature() { ...@@ -63,7 +63,7 @@ void testTemperature() {
system.addForce(forceField); system.addForce(forceField);
AndersenThermostat* thermstat = new AndersenThermostat(temp, collisionFreq); AndersenThermostat* thermstat = new AndersenThermostat(temp, collisionFreq);
system.addForce(thermstat); system.addForce(thermstat);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
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));
...@@ -111,7 +111,7 @@ void testRandomSeed() { ...@@ -111,7 +111,7 @@ void testRandomSeed() {
// Try twice with the same random seed. // Try twice with the same random seed.
thermostat->setRandomNumberSeed(5); thermostat->setRandomNumberSeed(5);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
context.setPositions(positions); context.setPositions(positions);
context.setVelocities(velocities); context.setVelocities(velocities);
integrator.step(10); integrator.step(10);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
...@@ -63,7 +63,7 @@ void testSingleBond() { ...@@ -63,7 +63,7 @@ void testSingleBond() {
HarmonicBondForce* forceField = new HarmonicBondForce(); HarmonicBondForce* forceField = new HarmonicBondForce();
forceField->addBond(0, 1, 1.5, 1); forceField->addBond(0, 1, 1.5, 1);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(-1, 0, 0); positions[0] = Vec3(-1, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
...@@ -100,7 +100,7 @@ void testTemperature() { ...@@ -100,7 +100,7 @@ void testTemperature() {
for (int i = 0; i < numBonds; ++i) for (int i = 0; i < numBonds; ++i)
forceField->addBond(i, i+1, 1.0, 5.0); forceField->addBond(i, i+1, 1.0, 5.0);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
for (int i = 0; i < numParticles; ++i) for (int i = 0; i < numParticles; ++i)
positions[i] = Vec3(i, 0, 0); positions[i] = Vec3(i, 0, 0);
...@@ -143,7 +143,7 @@ void testConstraints() { ...@@ -143,7 +143,7 @@ void testConstraints() {
system.addConstraint(4, 5, 1.0); system.addConstraint(4, 5, 1.0);
system.addConstraint(6, 7, 1.0); system.addConstraint(6, 7, 1.0);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
vector<Vec3> velocities(numParticles); vector<Vec3> velocities(numParticles);
init_gen_rand(0); init_gen_rand(0);
...@@ -194,7 +194,7 @@ void testRandomSeed() { ...@@ -194,7 +194,7 @@ void testRandomSeed() {
// Try twice with the same random seed. // Try twice with the same random seed.
integrator.setRandomNumberSeed(5); integrator.setRandomNumberSeed(5);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
context.setPositions(positions); context.setPositions(positions);
context.setVelocities(velocities); context.setVelocities(velocities);
integrator.step(10); integrator.step(10);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/CMMotionRemover.h" #include "openmm/CMMotionRemover.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
...@@ -75,7 +75,7 @@ void testMotionRemoval(Integrator& integrator) { ...@@ -75,7 +75,7 @@ void testMotionRemoval(Integrator& integrator) {
system.addForce(nonbonded); system.addForce(nonbonded);
CMMotionRemover* remover = new CMMotionRemover(); CMMotionRemover* remover = new CMMotionRemover();
system.addForce(remover); system.addForce(remover);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
vector<Vec3> velocities(numParticles); vector<Vec3> velocities(numParticles);
init_gen_rand(0); init_gen_rand(0);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/GBSAOBCForce.h" #include "openmm/GBSAOBCForce.h"
...@@ -62,7 +62,7 @@ void testSingleParticle() { ...@@ -62,7 +62,7 @@ void testSingleParticle() {
nonbonded->addParticle(0.5, 1, 0); nonbonded->addParticle(0.5, 1, 0);
system.addForce(gbsa); system.addForce(gbsa);
system.addForce(nonbonded); system.addForce(nonbonded);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(1); vector<Vec3> positions(1);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
context.setPositions(positions); context.setPositions(positions);
...@@ -100,7 +100,7 @@ void testCutoffAndPeriodic() { ...@@ -100,7 +100,7 @@ void testCutoffAndPeriodic() {
// Calculate the forces for both cutoff and periodic with two different atom positions. // Calculate the forces for both cutoff and periodic with two different atom positions.
nonbonded->setNonbondedMethod(NonbondedForce::CutoffNonPeriodic); nonbonded->setNonbondedMethod(NonbondedForce::CutoffNonPeriodic);
OpenMMContext context(system, integrator, cuda); Context context(system, integrator, cuda);
context.setPositions(positions); context.setPositions(positions);
State state1 = context.getState(State::Forces); State state1 = context.getState(State::Forces);
nonbonded->setNonbondedMethod(NonbondedForce::CutoffPeriodic); nonbonded->setNonbondedMethod(NonbondedForce::CutoffPeriodic);
...@@ -149,8 +149,8 @@ void testForce(int numParticles, NonbondedForce::NonbondedMethod method) { ...@@ -149,8 +149,8 @@ void testForce(int numParticles, NonbondedForce::NonbondedMethod method) {
} }
system.addForce(gbsa); system.addForce(gbsa);
system.addForce(nonbonded); system.addForce(nonbonded);
OpenMMContext context(system, integrator, cuda); Context context(system, integrator, cuda);
OpenMMContext refContext(system, integrator, reference); Context refContext(system, integrator, reference);
// Set random (but uniformly distributed) positions for all the particles. // Set random (but uniformly distributed) positions for all the particles.
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicAngleForce.h" #include "openmm/HarmonicAngleForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -60,7 +60,7 @@ void testAngles() { ...@@ -60,7 +60,7 @@ void testAngles() {
forceField->addAngle(0, 1, 2, PI_M/3, 1.1); forceField->addAngle(0, 1, 2, PI_M/3, 1.1);
forceField->addAngle(1, 2, 3, PI_M/2, 1.2); forceField->addAngle(1, 2, 3, PI_M/2, 1.2);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(4); vector<Vec3> positions(4);
positions[0] = Vec3(0, 1, 0); positions[0] = Vec3(0, 1, 0);
positions[1] = Vec3(0, 0, 0); positions[1] = Vec3(0, 0, 0);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -59,7 +59,7 @@ void testBonds() { ...@@ -59,7 +59,7 @@ void testBonds() {
forceField->addBond(0, 1, 1.5, 0.8); forceField->addBond(0, 1, 1.5, 0.8);
forceField->addBond(1, 2, 1.2, 0.7); forceField->addBond(1, 2, 1.2, 0.7);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(3); vector<Vec3> positions(3);
positions[0] = Vec3(0, 2, 0); positions[0] = Vec3(0, 2, 0);
positions[1] = Vec3(0, 0, 0); positions[1] = Vec3(0, 0, 0);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
...@@ -59,7 +59,7 @@ void testSingleBond() { ...@@ -59,7 +59,7 @@ void testSingleBond() {
HarmonicBondForce* forceField = new HarmonicBondForce(); HarmonicBondForce* forceField = new HarmonicBondForce();
forceField->addBond(0, 1, 1.5, 1); forceField->addBond(0, 1, 1.5, 1);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(-1, 0, 0); positions[0] = Vec3(-1, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
...@@ -106,7 +106,7 @@ void testTemperature() { ...@@ -106,7 +106,7 @@ void testTemperature() {
forceField->addParticle((i%2 == 0 ? 1.0 : -1.0), 1.0, 5.0); forceField->addParticle((i%2 == 0 ? 1.0 : -1.0), 1.0, 5.0);
} }
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
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));
...@@ -148,7 +148,7 @@ void testConstraints() { ...@@ -148,7 +148,7 @@ void testConstraints() {
system.addConstraint(4, 5, 1.0); system.addConstraint(4, 5, 1.0);
system.addConstraint(6, 7, 1.0); system.addConstraint(6, 7, 1.0);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
vector<Vec3> velocities(numParticles); vector<Vec3> velocities(numParticles);
init_gen_rand(0); init_gen_rand(0);
...@@ -199,7 +199,7 @@ void testRandomSeed() { ...@@ -199,7 +199,7 @@ void testRandomSeed() {
// Try twice with the same random seed. // Try twice with the same random seed.
integrator.setRandomNumberSeed(5); integrator.setRandomNumberSeed(5);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
context.setPositions(positions); context.setPositions(positions);
context.setVelocities(velocities); context.setVelocities(velocities);
integrator.step(10); integrator.step(10);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
#include "openmm/VerletIntegrator.h" #include "openmm/VerletIntegrator.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "kernels/gputypes.h" #include "kernels/gputypes.h"
#include "../src/SimTKUtilities/SimTKOpenMMRealType.h" #include "../src/SimTKUtilities/SimTKOpenMMRealType.h"
#include "../src/sfmt/SFMT.h" #include "../src/sfmt/SFMT.h"
...@@ -64,7 +64,7 @@ void testCoulomb() { ...@@ -64,7 +64,7 @@ void testCoulomb() {
forceField->addParticle(0.5, 1, 0); forceField->addParticle(0.5, 1, 0);
forceField->addParticle(-1.5, 1, 0); forceField->addParticle(-1.5, 1, 0);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(2, 0, 0); positions[1] = Vec3(2, 0, 0);
...@@ -87,7 +87,7 @@ void testLJ() { ...@@ -87,7 +87,7 @@ void testLJ() {
forceField->addParticle(0, 1.2, 1); forceField->addParticle(0, 1.2, 1);
forceField->addParticle(0, 1.4, 2); forceField->addParticle(0, 1.4, 2);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(2, 0, 0); positions[1] = Vec3(2, 0, 0);
...@@ -143,7 +143,7 @@ void testExclusionsAnd14() { ...@@ -143,7 +143,7 @@ void testExclusionsAnd14() {
nonbonded->setExceptionParameters(first14, 0, 3, 0, 1.5, i == 3 ? 0.5 : 0.0); nonbonded->setExceptionParameters(first14, 0, 3, 0, 1.5, i == 3 ? 0.5 : 0.0);
nonbonded->setExceptionParameters(second14, 1, 4, 0, 1.5, 0.0); nonbonded->setExceptionParameters(second14, 1, 4, 0, 1.5, 0.0);
positions[i] = Vec3(r, 0, 0); positions[i] = Vec3(r, 0, 0);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
context.setPositions(positions); context.setPositions(positions);
State state = context.getState(State::Forces | State::Energy); State state = context.getState(State::Forces | State::Energy);
const vector<Vec3>& forces = state.getForces(); const vector<Vec3>& forces = state.getForces();
...@@ -169,7 +169,7 @@ void testExclusionsAnd14() { ...@@ -169,7 +169,7 @@ void testExclusionsAnd14() {
nonbonded->setParticleParameters(i, 2, 1.5, 0); nonbonded->setParticleParameters(i, 2, 1.5, 0);
nonbonded->setExceptionParameters(first14, 0, 3, i == 3 ? 4/1.2 : 0, 1.5, 0); nonbonded->setExceptionParameters(first14, 0, 3, i == 3 ? 4/1.2 : 0, 1.5, 0);
nonbonded->setExceptionParameters(second14, 1, 4, 0, 1.5, 0); nonbonded->setExceptionParameters(second14, 1, 4, 0, 1.5, 0);
OpenMMContext context2(system, integrator, platform); Context context2(system, integrator, platform);
context2.setPositions(positions); context2.setPositions(positions);
state = context2.getState(State::Forces | State::Energy); state = context2.getState(State::Forces | State::Energy);
const vector<Vec3>& forces2 = state.getForces(); const vector<Vec3>& forces2 = state.getForces();
...@@ -206,7 +206,7 @@ void testCutoff() { ...@@ -206,7 +206,7 @@ void testCutoff() {
const double eps = 50.0; const double eps = 50.0;
forceField->setReactionFieldDielectric(eps); forceField->setReactionFieldDielectric(eps);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(3); vector<Vec3> positions(3);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(0, 2, 0); positions[1] = Vec3(0, 2, 0);
...@@ -257,7 +257,7 @@ void testCutoff14() { ...@@ -257,7 +257,7 @@ void testCutoff14() {
second14 = i; second14 = i;
} }
system.addForce(nonbonded); system.addForce(nonbonded);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(5); vector<Vec3> positions(5);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
...@@ -341,7 +341,7 @@ void testPeriodic() { ...@@ -341,7 +341,7 @@ void testPeriodic() {
nonbonded->setCutoffDistance(cutoff); nonbonded->setCutoffDistance(cutoff);
nonbonded->setPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 4, 0), Vec3(0, 0, 4)); nonbonded->setPeriodicBoxVectors(Vec3(4, 0, 0), Vec3(0, 4, 0), Vec3(0, 0, 4));
system.addForce(nonbonded); system.addForce(nonbonded);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(3); vector<Vec3> positions(3);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(2, 0, 0); positions[1] = Vec3(2, 0, 0);
...@@ -374,7 +374,7 @@ void testEwald() { ...@@ -374,7 +374,7 @@ void testEwald() {
nonbonded->setEwaldErrorTolerance(TOL); nonbonded->setEwaldErrorTolerance(TOL);
nonbonded->setPeriodicBoxVectors(Vec3(6, 0, 0), Vec3(0, 6, 0), Vec3(0, 0, 6)); nonbonded->setPeriodicBoxVectors(Vec3(6, 0, 0), Vec3(0, 6, 0), Vec3(0, 0, 6));
system.addForce(nonbonded); system.addForce(nonbonded);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(3.048000,2.764000,3.156000); positions[0] = Vec3(3.048000,2.764000,3.156000);
positions[1] = Vec3(2.809000,2.888000,2.571000); positions[1] = Vec3(2.809000,2.888000,2.571000);
...@@ -428,8 +428,8 @@ void testLargeSystem() { ...@@ -428,8 +428,8 @@ void testLargeSystem() {
nonbonded->setCutoffDistance(cutoff); nonbonded->setCutoffDistance(cutoff);
system.addForce(nonbonded); system.addForce(nonbonded);
system.addForce(bonds); system.addForce(bonds);
OpenMMContext cudaContext(system, integrator, cuda); Context cudaContext(system, integrator, cuda);
OpenMMContext referenceContext(system, integrator, reference); Context referenceContext(system, integrator, reference);
cudaContext.setPositions(positions); cudaContext.setPositions(positions);
cudaContext.setVelocities(velocities); cudaContext.setVelocities(velocities);
referenceContext.setPositions(positions); referenceContext.setPositions(positions);
...@@ -484,10 +484,10 @@ void testBlockInteractions(bool periodic) { ...@@ -484,10 +484,10 @@ void testBlockInteractions(bool periodic) {
nonbonded->setCutoffDistance(cutoff); nonbonded->setCutoffDistance(cutoff);
nonbonded->setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize)); nonbonded->setPeriodicBoxVectors(Vec3(boxSize, 0, 0), Vec3(0, boxSize, 0), Vec3(0, 0, boxSize));
system.addForce(nonbonded); system.addForce(nonbonded);
OpenMMContext context(system, integrator, cuda); Context context(system, integrator, cuda);
context.setPositions(positions); context.setPositions(positions);
State state = context.getState(State::Positions | State::Velocities | State::Forces); State state = context.getState(State::Positions | State::Velocities | State::Forces);
OpenMMContextImpl* contextImpl = *reinterpret_cast<OpenMMContextImpl**>(&context); ContextImpl* contextImpl = *reinterpret_cast<ContextImpl**>(&context);
CudaPlatform::PlatformData& data = *static_cast<CudaPlatform::PlatformData*>(contextImpl->getPlatformData()); CudaPlatform::PlatformData& data = *static_cast<CudaPlatform::PlatformData*>(contextImpl->getPlatformData());
// Verify that the bounds of each block were calculated correctly. // Verify that the bounds of each block were calculated correctly.
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/PeriodicTorsionForce.h" #include "openmm/PeriodicTorsionForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -59,7 +59,7 @@ void testPeriodicTorsions() { ...@@ -59,7 +59,7 @@ void testPeriodicTorsions() {
PeriodicTorsionForce* forceField = new PeriodicTorsionForce(); PeriodicTorsionForce* forceField = new PeriodicTorsionForce();
forceField->addTorsion(0, 1, 2, 3, 2, PI_M/3, 1.1); forceField->addTorsion(0, 1, 2, 3, 2, PI_M/3, 1.1);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(4); vector<Vec3> positions(4);
positions[0] = Vec3(0, 1, 0); positions[0] = Vec3(0, 1, 0);
positions[1] = Vec3(0, 0, 0); positions[1] = Vec3(0, 0, 0);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/RBTorsionForce.h" #include "openmm/RBTorsionForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -59,7 +59,7 @@ void testRBTorsions() { ...@@ -59,7 +59,7 @@ void testRBTorsions() {
RBTorsionForce* forceField = new RBTorsionForce(); RBTorsionForce* forceField = new RBTorsionForce();
forceField->addTorsion(0, 1, 2, 3, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6); forceField->addTorsion(0, 1, 2, 3, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(4); vector<Vec3> positions(4);
positions[0] = Vec3(0, 1, 0); positions[0] = Vec3(0, 1, 0);
positions[1] = Vec3(0, 0, 0); positions[1] = Vec3(0, 0, 0);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -69,7 +69,7 @@ void testConstraints() { ...@@ -69,7 +69,7 @@ void testConstraints() {
system.addConstraint(i*3+1, i*3+2, 0.163); system.addConstraint(i*3+1, i*3+2, 0.163);
} }
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
vector<Vec3> velocities(numParticles); vector<Vec3> velocities(numParticles);
init_gen_rand(0); init_gen_rand(0);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/Stream.h" #include "openmm/Stream.h"
#include "openmm/VerletIntegrator.h" #include "openmm/VerletIntegrator.h"
#include <iostream> #include <iostream>
...@@ -53,8 +53,8 @@ void testStream(Stream::DataType type, T scale) { ...@@ -53,8 +53,8 @@ void testStream(Stream::DataType type, T scale) {
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
system.addParticle(1.0); system.addParticle(1.0);
VerletIntegrator integrator(0.01); VerletIntegrator integrator(0.01);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
OpenMMContextImpl* impl = *reinterpret_cast<OpenMMContextImpl**>(&context); ContextImpl* impl = *reinterpret_cast<ContextImpl**>(&context);
Stream stream = platform.createStream("", size, type, *impl); Stream stream = platform.createStream("", size, type, *impl);
const int length = size*WIDTH; const int length = size*WIDTH;
T array[size*WIDTH+1]; T array[size*WIDTH+1];
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
...@@ -59,7 +59,7 @@ void testSingleBond() { ...@@ -59,7 +59,7 @@ void testSingleBond() {
HarmonicBondForce* forceField = new HarmonicBondForce(); HarmonicBondForce* forceField = new HarmonicBondForce();
forceField->addBond(0, 1, 1.5, 1); forceField->addBond(0, 1, 1.5, 1);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(-1, 0, 0); positions[0] = Vec3(-1, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
...@@ -104,7 +104,7 @@ void testConstraints() { ...@@ -104,7 +104,7 @@ void testConstraints() {
system.addConstraint(4, 5, 1.0); system.addConstraint(4, 5, 1.0);
system.addConstraint(6, 7, 1.0); system.addConstraint(6, 7, 1.0);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
vector<Vec3> velocities(numParticles); vector<Vec3> velocities(numParticles);
init_gen_rand(0); init_gen_rand(0);
...@@ -169,7 +169,7 @@ void testConstrainedClusters() { ...@@ -169,7 +169,7 @@ void testConstrainedClusters() {
system.addConstraint(3, 4, sqrt(2.0)); system.addConstraint(3, 4, sqrt(2.0));
system.addConstraint(5, 6, sqrt(2.0)); system.addConstraint(5, 6, sqrt(2.0));
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
*/ */
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
...@@ -59,7 +59,7 @@ void testSingleBond() { ...@@ -59,7 +59,7 @@ void testSingleBond() {
HarmonicBondForce* forceField = new HarmonicBondForce(); HarmonicBondForce* forceField = new HarmonicBondForce();
forceField->addBond(0, 1, 1.5, 1); forceField->addBond(0, 1, 1.5, 1);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(-1, 0, 0); positions[0] = Vec3(-1, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
...@@ -104,7 +104,7 @@ void testConstraints() { ...@@ -104,7 +104,7 @@ void testConstraints() {
system.addConstraint(4, 5, 1.0); system.addConstraint(4, 5, 1.0);
system.addConstraint(6, 7, 1.0); system.addConstraint(6, 7, 1.0);
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
vector<Vec3> velocities(numParticles); vector<Vec3> velocities(numParticles);
init_gen_rand(0); init_gen_rand(0);
...@@ -161,7 +161,7 @@ void testConstrainedClusters() { ...@@ -161,7 +161,7 @@ void testConstrainedClusters() {
system.addConstraint(3, 4, sqrt(2.0)); system.addConstraint(3, 4, sqrt(2.0));
system.addConstraint(5, 6, sqrt(2.0)); system.addConstraint(5, 6, sqrt(2.0));
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numParticles); vector<Vec3> positions(numParticles);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
positions[1] = Vec3(1, 0, 0); positions[1] = Vec3(1, 0, 0);
......
...@@ -42,7 +42,7 @@ namespace OpenMM { ...@@ -42,7 +42,7 @@ namespace OpenMM {
class ReferenceKernelFactory : public KernelFactory { class ReferenceKernelFactory : public KernelFactory {
public: public:
KernelImpl* createKernelImpl(std::string name, const Platform& platform, OpenMMContextImpl& context) const; KernelImpl* createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -55,8 +55,8 @@ public: ...@@ -55,8 +55,8 @@ public:
} }
bool supportsDoublePrecision() const; bool supportsDoublePrecision() const;
const StreamFactory& getDefaultStreamFactory() const; const StreamFactory& getDefaultStreamFactory() const;
void contextCreated(OpenMMContextImpl& context) const; void contextCreated(ContextImpl& context) const;
void contextDestroyed(OpenMMContextImpl& context) const; void contextDestroyed(ContextImpl& context) const;
private: private:
ReferenceStreamFactory defaultStreamFactory; ReferenceStreamFactory defaultStreamFactory;
}; };
......
...@@ -43,7 +43,7 @@ namespace OpenMM { ...@@ -43,7 +43,7 @@ namespace OpenMM {
class OPENMM_EXPORT ReferenceStreamFactory : public StreamFactory { class OPENMM_EXPORT ReferenceStreamFactory : public StreamFactory {
public: public:
StreamImpl* createStreamImpl(std::string name, int size, Stream::DataType type, const Platform& platform, OpenMMContextImpl& context) const; StreamImpl* createStreamImpl(std::string name, int size, Stream::DataType type, const Platform& platform, ContextImpl& context) const;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -31,12 +31,12 @@ ...@@ -31,12 +31,12 @@
#include "ReferenceKernelFactory.h" #include "ReferenceKernelFactory.h"
#include "ReferenceKernels.h" #include "ReferenceKernels.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
using namespace OpenMM; using namespace OpenMM;
KernelImpl* ReferenceKernelFactory::createKernelImpl(std::string name, const Platform& platform, OpenMMContextImpl& context) const { KernelImpl* ReferenceKernelFactory::createKernelImpl(std::string name, const Platform& platform, ContextImpl& context) const {
ReferencePlatform::PlatformData& data = *static_cast<ReferencePlatform::PlatformData*>(context.getPlatformData()); ReferencePlatform::PlatformData& data = *static_cast<ReferencePlatform::PlatformData*>(context.getPlatformData());
if (name == InitializeForcesKernel::Name()) if (name == InitializeForcesKernel::Name())
return new ReferenceInitializeForcesKernel(name, platform); return new ReferenceInitializeForcesKernel(name, platform);
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include "SimTKReference/ReferenceVerletDynamics.h" #include "SimTKReference/ReferenceVerletDynamics.h"
#include "openmm/CMMotionRemover.h" #include "openmm/CMMotionRemover.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "openmm/Integrator.h" #include "openmm/Integrator.h"
#include "SimTKUtilities/SimTKOpenMMUtilities.h" #include "SimTKUtilities/SimTKOpenMMUtilities.h"
#include <cmath> #include <cmath>
...@@ -125,7 +125,7 @@ static void findAnglesForCCMA(const System& system, vector<ReferenceCCMAAlgorith ...@@ -125,7 +125,7 @@ static void findAnglesForCCMA(const System& system, vector<ReferenceCCMAAlgorith
void ReferenceInitializeForcesKernel::initialize(const System& system) { void ReferenceInitializeForcesKernel::initialize(const System& system) {
} }
void ReferenceInitializeForcesKernel::execute(OpenMMContextImpl& context) { void ReferenceInitializeForcesKernel::execute(ContextImpl& context) {
double zero[] = {0.0, 0.0, 0.0}; double zero[] = {0.0, 0.0, 0.0};
context.getForces().fillWithValue(zero); context.getForces().fillWithValue(zero);
} }
...@@ -133,11 +133,11 @@ void ReferenceInitializeForcesKernel::execute(OpenMMContextImpl& context) { ...@@ -133,11 +133,11 @@ void ReferenceInitializeForcesKernel::execute(OpenMMContextImpl& context) {
void ReferenceUpdateTimeKernel::initialize(const System& system) { void ReferenceUpdateTimeKernel::initialize(const System& system) {
} }
double ReferenceUpdateTimeKernel::getTime(const OpenMMContextImpl& context) const { double ReferenceUpdateTimeKernel::getTime(const ContextImpl& context) const {
return data.time; return data.time;
} }
void ReferenceUpdateTimeKernel::setTime(OpenMMContextImpl& context, double time) { void ReferenceUpdateTimeKernel::setTime(ContextImpl& context, double time) {
data.time = time; data.time = time;
} }
...@@ -161,7 +161,7 @@ void ReferenceCalcHarmonicBondForceKernel::initialize(const System& system, cons ...@@ -161,7 +161,7 @@ void ReferenceCalcHarmonicBondForceKernel::initialize(const System& system, cons
} }
} }
void ReferenceCalcHarmonicBondForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcHarmonicBondForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
ReferenceBondForce refBondForce; ReferenceBondForce refBondForce;
...@@ -169,7 +169,7 @@ void ReferenceCalcHarmonicBondForceKernel::executeForces(OpenMMContextImpl& cont ...@@ -169,7 +169,7 @@ void ReferenceCalcHarmonicBondForceKernel::executeForces(OpenMMContextImpl& cont
refBondForce.calculateForce(numBonds, bondIndexArray, posData, bondParamArray, forceData, 0, 0, 0, harmonicBond); refBondForce.calculateForce(numBonds, bondIndexArray, posData, bondParamArray, forceData, 0, 0, 0, harmonicBond);
} }
double ReferenceCalcHarmonicBondForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcHarmonicBondForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3); RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3);
RealOpenMM* energyArray = new RealOpenMM[numBonds]; RealOpenMM* energyArray = new RealOpenMM[numBonds];
...@@ -205,7 +205,7 @@ void ReferenceCalcHarmonicAngleForceKernel::initialize(const System& system, con ...@@ -205,7 +205,7 @@ void ReferenceCalcHarmonicAngleForceKernel::initialize(const System& system, con
} }
} }
void ReferenceCalcHarmonicAngleForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcHarmonicAngleForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
ReferenceBondForce refBondForce; ReferenceBondForce refBondForce;
...@@ -213,7 +213,7 @@ void ReferenceCalcHarmonicAngleForceKernel::executeForces(OpenMMContextImpl& con ...@@ -213,7 +213,7 @@ void ReferenceCalcHarmonicAngleForceKernel::executeForces(OpenMMContextImpl& con
refBondForce.calculateForce(numAngles, angleIndexArray, posData, angleParamArray, forceData, 0, 0, 0, angleBond); refBondForce.calculateForce(numAngles, angleIndexArray, posData, angleParamArray, forceData, 0, 0, 0, angleBond);
} }
double ReferenceCalcHarmonicAngleForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcHarmonicAngleForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3); RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3);
RealOpenMM* energyArray = new RealOpenMM[numAngles]; RealOpenMM* energyArray = new RealOpenMM[numAngles];
...@@ -251,7 +251,7 @@ void ReferenceCalcPeriodicTorsionForceKernel::initialize(const System& system, c ...@@ -251,7 +251,7 @@ void ReferenceCalcPeriodicTorsionForceKernel::initialize(const System& system, c
} }
} }
void ReferenceCalcPeriodicTorsionForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcPeriodicTorsionForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
ReferenceBondForce refBondForce; ReferenceBondForce refBondForce;
...@@ -259,7 +259,7 @@ void ReferenceCalcPeriodicTorsionForceKernel::executeForces(OpenMMContextImpl& c ...@@ -259,7 +259,7 @@ void ReferenceCalcPeriodicTorsionForceKernel::executeForces(OpenMMContextImpl& c
refBondForce.calculateForce(numTorsions, torsionIndexArray, posData, torsionParamArray, forceData, 0, 0, 0, periodicTorsionBond); refBondForce.calculateForce(numTorsions, torsionIndexArray, posData, torsionParamArray, forceData, 0, 0, 0, periodicTorsionBond);
} }
double ReferenceCalcPeriodicTorsionForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcPeriodicTorsionForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3); RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3);
RealOpenMM* energyArray = new RealOpenMM[numTorsions]; RealOpenMM* energyArray = new RealOpenMM[numTorsions];
...@@ -300,7 +300,7 @@ void ReferenceCalcRBTorsionForceKernel::initialize(const System& system, const R ...@@ -300,7 +300,7 @@ void ReferenceCalcRBTorsionForceKernel::initialize(const System& system, const R
} }
} }
void ReferenceCalcRBTorsionForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcRBTorsionForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
ReferenceBondForce refBondForce; ReferenceBondForce refBondForce;
...@@ -308,7 +308,7 @@ void ReferenceCalcRBTorsionForceKernel::executeForces(OpenMMContextImpl& context ...@@ -308,7 +308,7 @@ void ReferenceCalcRBTorsionForceKernel::executeForces(OpenMMContextImpl& context
refBondForce.calculateForce(numTorsions, torsionIndexArray, posData, torsionParamArray, forceData, 0, 0, 0, rbTorsionBond); refBondForce.calculateForce(numTorsions, torsionIndexArray, posData, torsionParamArray, forceData, 0, 0, 0, rbTorsionBond);
} }
double ReferenceCalcRBTorsionForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcRBTorsionForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3); RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3);
RealOpenMM* energyArray = new RealOpenMM[numTorsions]; RealOpenMM* energyArray = new RealOpenMM[numTorsions];
...@@ -413,7 +413,7 @@ void ReferenceCalcNonbondedForceKernel::initialize(const System& system, const N ...@@ -413,7 +413,7 @@ void ReferenceCalcNonbondedForceKernel::initialize(const System& system, const N
rfDielectric = force.getReactionFieldDielectric(); rfDielectric = force.getReactionFieldDielectric();
} }
void ReferenceCalcNonbondedForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcNonbondedForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
ReferenceLJCoulombIxn clj; ReferenceLJCoulombIxn clj;
...@@ -438,7 +438,7 @@ void ReferenceCalcNonbondedForceKernel::executeForces(OpenMMContextImpl& context ...@@ -438,7 +438,7 @@ void ReferenceCalcNonbondedForceKernel::executeForces(OpenMMContextImpl& context
refBondForce.calculateForce(num14, bonded14IndexArray, posData, bonded14ParamArray, forceData, 0, 0, 0, nonbonded14); refBondForce.calculateForce(num14, bonded14IndexArray, posData, bonded14ParamArray, forceData, 0, 0, 0, nonbonded14);
} }
double ReferenceCalcNonbondedForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcNonbondedForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = allocateRealArray(numParticles, 3); RealOpenMM** forceData = allocateRealArray(numParticles, 3);
RealOpenMM energy = 0; RealOpenMM energy = 0;
...@@ -518,13 +518,13 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS ...@@ -518,13 +518,13 @@ void ReferenceCalcGBSAOBCForceKernel::initialize(const System& system, const GBS
obc->setIncludeAceApproximation(true); obc->setIncludeAceApproximation(true);
} }
void ReferenceCalcGBSAOBCForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcGBSAOBCForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1); obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1);
} }
double ReferenceCalcGBSAOBCForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcGBSAOBCForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3); RealOpenMM** forceData = allocateRealArray(context.getSystem().getNumParticles(), 3);
obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1); obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1);
...@@ -586,7 +586,7 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo ...@@ -586,7 +586,7 @@ void ReferenceCalcGBVIForceKernel::initialize(const System& system, const GBVIFo
} }
void ReferenceCalcGBVIForceKernel::executeForces(OpenMMContextImpl& context) { void ReferenceCalcGBVIForceKernel::executeForces(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData(); RealOpenMM** forceData = ((ReferenceFloatStreamImpl&) context.getForces().getImpl()).getData();
...@@ -596,7 +596,7 @@ void ReferenceCalcGBVIForceKernel::executeForces(OpenMMContextImpl& context) { ...@@ -596,7 +596,7 @@ void ReferenceCalcGBVIForceKernel::executeForces(OpenMMContextImpl& context) {
delete[] bornRadii; delete[] bornRadii;
} }
double ReferenceCalcGBVIForceKernel::executeEnergy(OpenMMContextImpl& context) { double ReferenceCalcGBVIForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** posData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData()); // Reference code needs to be made const correct
RealOpenMM* bornRadii = new RealOpenMM[context.getSystem().getNumParticles()]; RealOpenMM* bornRadii = new RealOpenMM[context.getSystem().getNumParticles()];
gbvi->computeBornRadii(posData, bornRadii, NULL ); gbvi->computeBornRadii(posData, bornRadii, NULL );
...@@ -636,7 +636,7 @@ void ReferenceIntegrateVerletStepKernel::initialize(const System& system, const ...@@ -636,7 +636,7 @@ void ReferenceIntegrateVerletStepKernel::initialize(const System& system, const
} }
} }
void ReferenceIntegrateVerletStepKernel::execute(OpenMMContextImpl& context, const VerletIntegrator& integrator) { void ReferenceIntegrateVerletStepKernel::execute(ContextImpl& context, const VerletIntegrator& integrator) {
double stepSize = integrator.getStepSize(); double stepSize = integrator.getStepSize();
RealOpenMM** posData = ((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData(); RealOpenMM** posData = ((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData();
RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData(); RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData();
...@@ -692,7 +692,7 @@ void ReferenceIntegrateLangevinStepKernel::initialize(const System& system, cons ...@@ -692,7 +692,7 @@ void ReferenceIntegrateLangevinStepKernel::initialize(const System& system, cons
SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) integrator.getRandomNumberSeed()); SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) integrator.getRandomNumberSeed());
} }
void ReferenceIntegrateLangevinStepKernel::execute(OpenMMContextImpl& context, const LangevinIntegrator& integrator) { void ReferenceIntegrateLangevinStepKernel::execute(ContextImpl& context, const LangevinIntegrator& integrator) {
double temperature = integrator.getTemperature(); double temperature = integrator.getTemperature();
double friction = integrator.getFriction(); double friction = integrator.getFriction();
double stepSize = integrator.getStepSize(); double stepSize = integrator.getStepSize();
...@@ -757,7 +757,7 @@ void ReferenceIntegrateBrownianStepKernel::initialize(const System& system, cons ...@@ -757,7 +757,7 @@ void ReferenceIntegrateBrownianStepKernel::initialize(const System& system, cons
SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) integrator.getRandomNumberSeed()); SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) integrator.getRandomNumberSeed());
} }
void ReferenceIntegrateBrownianStepKernel::execute(OpenMMContextImpl& context, const BrownianIntegrator& integrator) { void ReferenceIntegrateBrownianStepKernel::execute(ContextImpl& context, const BrownianIntegrator& integrator) {
double temperature = integrator.getTemperature(); double temperature = integrator.getTemperature();
double friction = integrator.getFriction(); double friction = integrator.getFriction();
double stepSize = integrator.getStepSize(); double stepSize = integrator.getStepSize();
...@@ -821,7 +821,7 @@ void ReferenceIntegrateVariableLangevinStepKernel::initialize(const System& syst ...@@ -821,7 +821,7 @@ void ReferenceIntegrateVariableLangevinStepKernel::initialize(const System& syst
SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) integrator.getRandomNumberSeed()); SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) integrator.getRandomNumberSeed());
} }
void ReferenceIntegrateVariableLangevinStepKernel::execute(OpenMMContextImpl& context, const VariableLangevinIntegrator& integrator, double maxTime) { void ReferenceIntegrateVariableLangevinStepKernel::execute(ContextImpl& context, const VariableLangevinIntegrator& integrator, double maxTime) {
double temperature = integrator.getTemperature(); double temperature = integrator.getTemperature();
double friction = integrator.getFriction(); double friction = integrator.getFriction();
double errorTol = integrator.getErrorTolerance(); double errorTol = integrator.getErrorTolerance();
...@@ -884,7 +884,7 @@ void ReferenceIntegrateVariableVerletStepKernel::initialize(const System& system ...@@ -884,7 +884,7 @@ void ReferenceIntegrateVariableVerletStepKernel::initialize(const System& system
} }
} }
void ReferenceIntegrateVariableVerletStepKernel::execute(OpenMMContextImpl& context, const VariableVerletIntegrator& integrator, double maxTime) { void ReferenceIntegrateVariableVerletStepKernel::execute(ContextImpl& context, const VariableVerletIntegrator& integrator, double maxTime) {
double errorTol = integrator.getErrorTolerance(); double errorTol = integrator.getErrorTolerance();
RealOpenMM** posData = ((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData(); RealOpenMM** posData = ((ReferenceFloatStreamImpl&) context.getPositions().getImpl()).getData();
RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData(); RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData();
...@@ -927,7 +927,7 @@ void ReferenceApplyAndersenThermostatKernel::initialize(const System& system, co ...@@ -927,7 +927,7 @@ void ReferenceApplyAndersenThermostatKernel::initialize(const System& system, co
SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) thermostat.getRandomNumberSeed()); SimTKOpenMMUtilities::setRandomNumberSeed((unsigned int) thermostat.getRandomNumberSeed());
} }
void ReferenceApplyAndersenThermostatKernel::execute(OpenMMContextImpl& context) { void ReferenceApplyAndersenThermostatKernel::execute(ContextImpl& context) {
RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData(); RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData();
thermostat->applyThermostat( thermostat->applyThermostat(
context.getVelocities().getSize(), context.getVelocities().getSize(),
...@@ -945,7 +945,7 @@ void ReferenceCalcKineticEnergyKernel::initialize(const System& system) { ...@@ -945,7 +945,7 @@ void ReferenceCalcKineticEnergyKernel::initialize(const System& system) {
masses[i] = system.getParticleMass(i); masses[i] = system.getParticleMass(i);
} }
double ReferenceCalcKineticEnergyKernel::execute(OpenMMContextImpl& context) { double ReferenceCalcKineticEnergyKernel::execute(ContextImpl& context) {
RealOpenMM** velData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData()); // Reference code needs to be made const correct RealOpenMM** velData = const_cast<RealOpenMM**>(((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData()); // Reference code needs to be made const correct
double energy = 0.0; double energy = 0.0;
for (size_t i = 0; i < masses.size(); ++i) for (size_t i = 0; i < masses.size(); ++i)
...@@ -960,7 +960,7 @@ void ReferenceRemoveCMMotionKernel::initialize(const System& system, const CMMot ...@@ -960,7 +960,7 @@ void ReferenceRemoveCMMotionKernel::initialize(const System& system, const CMMot
masses[i] = system.getParticleMass(i); masses[i] = system.getParticleMass(i);
} }
void ReferenceRemoveCMMotionKernel::execute(OpenMMContextImpl& context) { void ReferenceRemoveCMMotionKernel::execute(ContextImpl& context) {
if (data.stepCount%frequency != 0) if (data.stepCount%frequency != 0)
return; return;
RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData(); RealOpenMM** velData = ((ReferenceFloatStreamImpl&) context.getVelocities().getImpl()).getData();
......
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