Commit a4020466 authored by Peter Eastman's avatar Peter Eastman
Browse files

Renamed OpenMMContext to Context

parent 95b8dbd6
...@@ -125,7 +125,7 @@ void BrookUpdateTimeKernel::initialize( const System& system ){ ...@@ -125,7 +125,7 @@ void BrookUpdateTimeKernel::initialize( const System& system ){
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
double BrookUpdateTimeKernel::getTime(const OpenMMContextImpl& context) const { double BrookUpdateTimeKernel::getTime(const ContextImpl& context) const {
return _openMMBrookInterface.getTime(); return _openMMBrookInterface.getTime();
} }
...@@ -136,6 +136,6 @@ double BrookUpdateTimeKernel::getTime(const OpenMMContextImpl& context) const { ...@@ -136,6 +136,6 @@ double BrookUpdateTimeKernel::getTime(const OpenMMContextImpl& context) const {
* @param time the time * @param time the time
*/ */
void BrookUpdateTimeKernel::setTime(OpenMMContextImpl& context, double time) { void BrookUpdateTimeKernel::setTime(ContextImpl& context, double time) {
_openMMBrookInterface.setTime(time); _openMMBrookInterface.setTime(time);
} }
...@@ -57,7 +57,7 @@ class BrookUpdateTimeKernel : public UpdateTimeKernel { ...@@ -57,7 +57,7 @@ class BrookUpdateTimeKernel : public UpdateTimeKernel {
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
double getTime(const OpenMMContextImpl& context) const; double getTime(const ContextImpl& context) const;
/** /**
* Set the current time (in picoseconds). * Set the current time (in picoseconds).
...@@ -66,7 +66,7 @@ class BrookUpdateTimeKernel : public UpdateTimeKernel { ...@@ -66,7 +66,7 @@ class BrookUpdateTimeKernel : public UpdateTimeKernel {
* @param time the time * @param time the time
*/ */
void setTime(OpenMMContextImpl& context, double time); void setTime(ContextImpl& context, double time);
/** /**
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
#include "BrookStreamImpl.h" #include "BrookStreamImpl.h"
...@@ -514,7 +514,7 @@ BrookGbsa& OpenMMBrookInterface::getBrookGbsa( void ){ ...@@ -514,7 +514,7 @@ BrookGbsa& OpenMMBrookInterface::getBrookGbsa( void ){
* *
*/ */
void OpenMMBrookInterface::zeroForces( OpenMMContextImpl& context ){ void OpenMMBrookInterface::zeroForces( ContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -537,7 +537,7 @@ void OpenMMBrookInterface::zeroForces( OpenMMContextImpl& context ){ ...@@ -537,7 +537,7 @@ void OpenMMBrookInterface::zeroForces( OpenMMContextImpl& context ){
* *
*/ */
void OpenMMBrookInterface::computeForces( OpenMMContextImpl& context ){ void OpenMMBrookInterface::computeForces( ContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -640,7 +640,7 @@ void OpenMMBrookInterface::computeForces( OpenMMContextImpl& context ){ ...@@ -640,7 +640,7 @@ void OpenMMBrookInterface::computeForces( OpenMMContextImpl& context ){
* *
*/ */
void OpenMMBrookInterface::printForcesToFile( OpenMMContextImpl& context ){ void OpenMMBrookInterface::printForcesToFile( ContextImpl& context ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -755,7 +755,7 @@ void OpenMMBrookInterface::printForcesToFile( OpenMMContextImpl& context ){ ...@@ -755,7 +755,7 @@ void OpenMMBrookInterface::printForcesToFile( OpenMMContextImpl& context ){
* *
*/ */
double OpenMMBrookInterface::computeEnergy( OpenMMContextImpl& context, System& system ){ double OpenMMBrookInterface::computeEnergy( ContextImpl& context, System& system ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -768,7 +768,7 @@ double OpenMMBrookInterface::computeEnergy( OpenMMContextImpl& context, System& ...@@ -768,7 +768,7 @@ double OpenMMBrookInterface::computeEnergy( OpenMMContextImpl& context, System&
LangevinIntegrator integrator(0.0, 1.0, 0.0); LangevinIntegrator integrator(0.0, 1.0, 0.0);
ReferencePlatform platform; ReferencePlatform platform;
OpenMMContext refContext( system, integrator, platform ); Context refContext( system, integrator, platform );
const Stream& positions = context.getPositions(); const Stream& positions = context.getPositions();
double* posData = new double[positions.getSize()*3]; double* posData = new double[positions.getSize()*3];
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "BrookNonBonded.h" #include "BrookNonBonded.h"
#include "BrookGbsa.h" #include "BrookGbsa.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/System.h" #include "openmm/System.h"
namespace OpenMM { namespace OpenMM {
...@@ -55,11 +55,11 @@ class OpenMMBrookInterface { ...@@ -55,11 +55,11 @@ class OpenMMBrookInterface {
* *
* @param numberOfParticles number of particles * @param numberOfParticles number of particles
* *
* @return OpenMMContext * @return Context
* *
*/ */
OpenMMContext* getReferenceOpenMMContext( int numberOfParticles ); Context* getReferenceContext( int numberOfParticles );
/** /**
* Set log file reference * Set log file reference
...@@ -153,32 +153,32 @@ class OpenMMBrookInterface { ...@@ -153,32 +153,32 @@ class OpenMMBrookInterface {
/** /**
* Zero forces * Zero forces
* *
* @param context OpenMMContextImpl context * @param context ContextImpl context
* *
*/ */
void zeroForces( OpenMMContextImpl& context ); void zeroForces( ContextImpl& context );
/** /**
* Compute forces * Compute forces
* *
* @param context OpenMMContextImpl context * @param context ContextImpl context
* *
*/ */
void computeForces( OpenMMContextImpl& context ); void computeForces( ContextImpl& context );
/** /**
* Compute energy * Compute energy
* *
* @param context OpenMMContextImpl context * @param context ContextImpl context
* @param system system reference * @param system system reference
* *
* @return potential energy * @return potential energy
* *
*/ */
double computeEnergy( OpenMMContextImpl& context, System& system ); double computeEnergy( ContextImpl& context, System& system );
/** /**
* Set trigger Force Kernel * Set trigger Force Kernel
...@@ -401,7 +401,7 @@ class OpenMMBrookInterface { ...@@ -401,7 +401,7 @@ class OpenMMBrookInterface {
* *
*/ */
void printForcesToFile( OpenMMContextImpl& context ); void printForcesToFile( ContextImpl& context );
private: private:
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/HarmonicAngleForce.h" #include "openmm/HarmonicAngleForce.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
...@@ -72,7 +72,7 @@ fprintf( stderr, "%s xxxx\n", methodName.c_str() ); fflush( stderr ); ...@@ -72,7 +72,7 @@ fprintf( stderr, "%s xxxx\n", methodName.c_str() ); fflush( stderr );
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(numberOfParticles); vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3(0, 1, 0); positions[0] = Vec3(0, 1, 0);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -88,7 +88,7 @@ void testMotionRemoval( FILE* log ) { ...@@ -88,7 +88,7 @@ void testMotionRemoval( FILE* log ) {
CMMotionRemover* remover = new CMMotionRemover( 1 ); CMMotionRemover* remover = new CMMotionRemover( 1 );
system.addForce(remover); system.addForce(remover);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numberOfParticles); vector<Vec3> positions(numberOfParticles);
vector<Vec3> velocities(numberOfParticles); vector<Vec3> velocities(numberOfParticles);
init_gen_rand(0); init_gen_rand(0);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
...@@ -69,7 +69,7 @@ void testBrookBonds( FILE* log ){ ...@@ -69,7 +69,7 @@ void testBrookBonds( FILE* log ){
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);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonBondedForce.h" #include "openmm/NonBondedForce.h"
#include "openmm/CMMotionRemover.h" #include "openmm/CMMotionRemover.h"
...@@ -43,7 +43,7 @@ using namespace std; ...@@ -43,7 +43,7 @@ using namespace std;
const double TOL = 1e-5; const double TOL = 1e-5;
static OpenMMContext* testLangevinSingleBondSetup( int brookContext, LangevinIntegrator** outIntegrator, FILE* log ){ static Context* testLangevinSingleBondSetup( int brookContext, LangevinIntegrator** outIntegrator, FILE* log ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -83,7 +83,7 @@ static OpenMMContext* testLangevinSingleBondSetup( int brookContext, LangevinInt ...@@ -83,7 +83,7 @@ static OpenMMContext* testLangevinSingleBondSetup( int brookContext, LangevinInt
forceField->addBond(0, 1, 1.5, 1); forceField->addBond(0, 1, 1.5, 1);
system->addForce(forceField); system->addForce(forceField);
OpenMMContext* context = new OpenMMContext( *system, *integrator, *platform ); Context* context = new Context( *system, *integrator, *platform );
vector<Vec3> positions(2); vector<Vec3> positions(2);
positions[0] = Vec3(-1, 0, 0); positions[0] = Vec3(-1, 0, 0);
...@@ -109,7 +109,7 @@ void testLangevinSingleBond( FILE* log ){ ...@@ -109,7 +109,7 @@ void testLangevinSingleBond( FILE* log ){
} }
LangevinIntegrator* langevinIntegrator; LangevinIntegrator* langevinIntegrator;
OpenMMContext* context = testLangevinSingleBondSetup( 1, &langevinIntegrator, log ); Context* context = testLangevinSingleBondSetup( 1, &langevinIntegrator, log );
// This is simply a damped harmonic oscillator, so compare it to the analytical solution. // This is simply a damped harmonic oscillator, so compare it to the analytical solution.
...@@ -218,7 +218,7 @@ void testLangevinTemperature( FILE* log ){ ...@@ -218,7 +218,7 @@ void testLangevinTemperature( FILE* log ){
CMMotionRemover* remover = new CMMotionRemover( 10 ); CMMotionRemover* remover = new CMMotionRemover( 10 );
system.addForce(remover); system.addForce(remover);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numberOfParticles); vector<Vec3> positions(numberOfParticles);
for (int i = 0; i < numberOfParticles; ++i){ for (int i = 0; i < numberOfParticles; ++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));
...@@ -319,7 +319,7 @@ void testLangevinConstraints( FILE* log ){ ...@@ -319,7 +319,7 @@ void testLangevinConstraints( FILE* log ){
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);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -78,7 +78,7 @@ void testBrookCoulomb( FILE* log ){ ...@@ -78,7 +78,7 @@ void testBrookCoulomb( FILE* log ){
//(void) fprintf( log, "%s: Calling context\n", methodName.c_str() ); //(void) fprintf( log, "%s: Calling context\n", methodName.c_str() );
//(void) fflush( log ); //(void) fflush( log );
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numberOfParticles); vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
...@@ -148,7 +148,7 @@ void testBrookLJ( FILE* log ){ ...@@ -148,7 +148,7 @@ void testBrookLJ( FILE* log ){
//(void) fprintf( log, "%s: Calling context\n", methodName.c_str() ); //(void) fprintf( log, "%s: Calling context\n", methodName.c_str() );
//(void) fflush( log ); //(void) fflush( log );
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numberOfParticles); vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3(0, 0, 0); positions[0] = Vec3(0, 0, 0);
...@@ -233,7 +233,7 @@ void testBrookExclusionsAnd14( FILE* log ){ ...@@ -233,7 +233,7 @@ void testBrookExclusionsAnd14( FILE* log ){
//(void) fprintf( log, "%s: Calling context\n", methodName.c_str() ); //(void) fprintf( log, "%s: Calling context\n", methodName.c_str() );
//(void) fflush( log ); //(void) fflush( log );
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
vector<Vec3> positions(numberOfParticles); vector<Vec3> positions(numberOfParticles);
const double r = 1.0; const double r = 1.0;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/PeriodicTorsionForce.h" #include "openmm/PeriodicTorsionForce.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
...@@ -78,7 +78,7 @@ void testBrookPeriodicTorsions( FILE* log ){ ...@@ -78,7 +78,7 @@ void testBrookPeriodicTorsions( FILE* log ){
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(numberOfParticles); vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3(0, 1, 0); positions[0] = Vec3(0, 1, 0);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/RBTorsionForce.h" #include "openmm/RBTorsionForce.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
...@@ -75,7 +75,7 @@ void testBrookRBTorsions( FILE* log ){ ...@@ -75,7 +75,7 @@ void testBrookRBTorsions( FILE* log ){
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(numberOfParticles); vector<Vec3> positions(numberOfParticles);
positions[0] = Vec3(0, 1, 0); positions[0] = Vec3(0, 1, 0);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/HarmonicBondForce.h" #include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h" #include "openmm/NonbondedForce.h"
#include "openmm/CMMotionRemover.h" #include "openmm/CMMotionRemover.h"
...@@ -81,7 +81,7 @@ void testVerletSingleBond( FILE* log ){ ...@@ -81,7 +81,7 @@ void testVerletSingleBond( FILE* log ){
// 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(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);
...@@ -191,7 +191,7 @@ void testVerletConstraints( FILE* log ){ ...@@ -191,7 +191,7 @@ void testVerletConstraints( FILE* log ){
//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);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "BrookPlatform.h" #include "BrookPlatform.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "openmm/GBSAOBCForce.h" #include "openmm/GBSAOBCForce.h"
#include "openmm/System.h" #include "openmm/System.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
...@@ -134,7 +134,7 @@ int tokenizeString( char* lineBuffer, StringVector& tokenArray, const std::strin ...@@ -134,7 +134,7 @@ int tokenizeString( char* lineBuffer, StringVector& tokenArray, const std::strin
return (int) tokenArray.size(); return (int) tokenArray.size();
} }
static OpenMMContext* testObcForceSetup( int numParticles, int brookContext, FILE* log ){ static Context* testObcForceSetup( int numParticles, int brookContext, FILE* log ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -161,7 +161,7 @@ static OpenMMContext* testObcForceSetup( int numParticles, int brookContext, FIL ...@@ -161,7 +161,7 @@ static OpenMMContext* testObcForceSetup( int numParticles, int brookContext, FIL
//forceField->setParticleParameters(i, i%2 == 0 ? -1 : 1, 1.5, 1); //forceField->setParticleParameters(i, i%2 == 0 ? -1 : 1, 1.5, 1);
} }
system->addForce(forceField); system->addForce(forceField);
OpenMMContext* context = new OpenMMContext( *system, *integrator, *platform ); Context* context = new Context( *system, *integrator, *platform );
// Set random positions for all the atoms. // Set random positions for all the atoms.
...@@ -224,7 +224,7 @@ static char* localStrsep( char** lineBuffer, const char* delimiter ){ ...@@ -224,7 +224,7 @@ static char* localStrsep( char** lineBuffer, const char* delimiter ){
} }
} }
static OpenMMContext* testObcForceFileSetup( std::string fileName, int brookContext, int* numParticles, FILE* log ){ static Context* testObcForceFileSetup( std::string fileName, int brookContext, int* numParticles, FILE* log ){
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -320,7 +320,7 @@ static OpenMMContext* testObcForceFileSetup( std::string fileName, int brookCont ...@@ -320,7 +320,7 @@ static OpenMMContext* testObcForceFileSetup( std::string fileName, int brookCont
(void) fflush( log ); (void) fflush( log );
} }
system->addForce(forceField); system->addForce(forceField);
OpenMMContext* context = new OpenMMContext( *system, *integrator, *platform ); Context* context = new Context( *system, *integrator, *platform );
// Set positions for all the atoms. // Set positions for all the atoms.
...@@ -345,13 +345,13 @@ void testObcForce( FILE* log, char* testInputFileName ){ ...@@ -345,13 +345,13 @@ void testObcForce( FILE* log, char* testInputFileName ){
PrintOn = log ? PrintOn : 0; PrintOn = log ? PrintOn : 0;
log = PrintOn ? log : NULL; log = PrintOn ? log : NULL;
//OpenMMContext* context = testObcForceSetup( numParticles, 0, log ); //Context* context = testObcForceSetup( numParticles, 0, log );
//OpenMMContext* brookContext = testObcForceSetup( numParticles, 1, log ); //Context* brookContext = testObcForceSetup( numParticles, 1, log );
OpenMMContext* context = testObcForceFileSetup( std::string( testInputFileName ), 0, &numParticles, log ); Context* context = testObcForceFileSetup( std::string( testInputFileName ), 0, &numParticles, log );
//OpenMMContext* context = NULL; //Context* context = NULL;
OpenMMContext* brookContext = testObcForceFileSetup( std::string( testInputFileName ), 1, &numParticles, log ); Context* brookContext = testObcForceFileSetup( std::string( testInputFileName ), 1, &numParticles, log );
//OpenMMContext* brookContext = NULL; //Context* brookContext = NULL;
vector<Vec3> forces; vector<Vec3> forces;
if( context ){ if( context ){
...@@ -436,7 +436,7 @@ void testObcSingleParticle( FILE* log ){ ...@@ -436,7 +436,7 @@ void testObcSingleParticle( FILE* log ){
GBSAOBCForce* forceField = new GBSAOBCForce(); GBSAOBCForce* forceField = new GBSAOBCForce();
forceField->addParticle(0.5, 0.15, 1); forceField->addParticle(0.5, 0.15, 1);
system.addForce(forceField); system.addForce(forceField);
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);
...@@ -475,7 +475,7 @@ void testObcEConsistentForce( FILE* log ){ ...@@ -475,7 +475,7 @@ void testObcEConsistentForce( FILE* log ){
forceField->addParticle(i%2 == 0 ? -1 : 1, 0.15, 1); forceField->addParticle(i%2 == 0 ? -1 : 1, 0.15, 1);
} }
system.addForce(forceField); system.addForce(forceField);
OpenMMContext context(system, integrator, platform); Context context(system, integrator, platform);
// Set random positions for all the atoms. // Set random positions for all the atoms.
......
...@@ -37,7 +37,7 @@ namespace OpenMM { ...@@ -37,7 +37,7 @@ namespace OpenMM {
class CudaKernelFactory : public KernelFactory { class CudaKernelFactory : 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
......
...@@ -53,8 +53,8 @@ public: ...@@ -53,8 +53,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:
CudaStreamFactory defaultStreamFactory; CudaStreamFactory defaultStreamFactory;
}; };
......
...@@ -37,7 +37,7 @@ namespace OpenMM { ...@@ -37,7 +37,7 @@ namespace OpenMM {
class OPENMM_EXPORT CudaStreamFactory : public StreamFactory { class OPENMM_EXPORT CudaStreamFactory : 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
......
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
#include "CudaKernelFactory.h" #include "CudaKernelFactory.h"
#include "CudaKernels.h" #include "CudaKernels.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* CudaKernelFactory::createKernelImpl(std::string name, const Platform& platform, OpenMMContextImpl& context) const { KernelImpl* CudaKernelFactory::createKernelImpl(std::string name, 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 == InitializeForcesKernel::Name()) if (name == InitializeForcesKernel::Name())
return new CudaInitializeForcesKernel(name, platform); return new CudaInitializeForcesKernel(name, platform);
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include "CudaKernels.h" #include "CudaKernels.h"
#include "CudaStreamImpl.h" #include "CudaStreamImpl.h"
#include "openmm/LangevinIntegrator.h" #include "openmm/LangevinIntegrator.h"
#include "openmm/OpenMMContext.h" #include "openmm/Context.h"
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "kernels/gputypes.h" #include "kernels/gputypes.h"
#include "kernels/cudaKernels.h" #include "kernels/cudaKernels.h"
#include <cmath> #include <cmath>
...@@ -39,7 +39,7 @@ extern "C" int gpuSetConstants( gpuContext gpu ); ...@@ -39,7 +39,7 @@ extern "C" int gpuSetConstants( gpuContext gpu );
using namespace OpenMM; using namespace OpenMM;
using namespace std; using namespace std;
static void calcForces(OpenMMContextImpl& context, CudaPlatform::PlatformData& data) { static void calcForces(ContextImpl& context, CudaPlatform::PlatformData& data) {
_gpuContext* gpu = data.gpu; _gpuContext* gpu = data.gpu;
if (data.nonbondedMethod != NO_CUTOFF && data.computeForceCount%100 == 0) if (data.nonbondedMethod != NO_CUTOFF && data.computeForceCount%100 == 0)
gpuReorderAtoms(gpu); gpuReorderAtoms(gpu);
...@@ -63,13 +63,13 @@ static void calcForces(OpenMMContextImpl& context, CudaPlatform::PlatformData& d ...@@ -63,13 +63,13 @@ static void calcForces(OpenMMContextImpl& context, CudaPlatform::PlatformData& d
kReduceForces(gpu); kReduceForces(gpu);
} }
static double calcEnergy(OpenMMContextImpl& context, System& system) { static double calcEnergy(ContextImpl& context, System& system) {
// We don't currently have GPU kernels to calculate energy, so instead we have the reference // We don't currently have GPU kernels to calculate energy, so instead we have the reference
// platform do it. This is VERY slow. // platform do it. This is VERY slow.
LangevinIntegrator integrator(0.0, 1.0, 0.0); LangevinIntegrator integrator(0.0, 1.0, 0.0);
ReferencePlatform platform; ReferencePlatform platform;
OpenMMContext refContext(system, integrator, platform); Context refContext(system, integrator, platform);
const Stream& positions = context.getPositions(); const Stream& positions = context.getPositions();
double* posData = new double[positions.getSize()*3]; double* posData = new double[positions.getSize()*3];
positions.saveToArray(posData); positions.saveToArray(posData);
...@@ -84,17 +84,17 @@ static double calcEnergy(OpenMMContextImpl& context, System& system) { ...@@ -84,17 +84,17 @@ static double calcEnergy(OpenMMContextImpl& context, System& system) {
void CudaInitializeForcesKernel::initialize(const System& system) { void CudaInitializeForcesKernel::initialize(const System& system) {
} }
void CudaInitializeForcesKernel::execute(OpenMMContextImpl& context) { void CudaInitializeForcesKernel::execute(ContextImpl& context) {
} }
void CudaUpdateTimeKernel::initialize(const System& system) { void CudaUpdateTimeKernel::initialize(const System& system) {
} }
double CudaUpdateTimeKernel::getTime(const OpenMMContextImpl& context) const { double CudaUpdateTimeKernel::getTime(const ContextImpl& context) const {
return data.time; return data.time;
} }
void CudaUpdateTimeKernel::setTime(OpenMMContextImpl& context, double time) { void CudaUpdateTimeKernel::setTime(ContextImpl& context, double time) {
data.time = time; data.time = time;
} }
...@@ -119,12 +119,12 @@ void CudaCalcHarmonicBondForceKernel::initialize(const System& system, const Har ...@@ -119,12 +119,12 @@ void CudaCalcHarmonicBondForceKernel::initialize(const System& system, const Har
gpuSetBondParameters(data.gpu, particle1, particle2, length, k); gpuSetBondParameters(data.gpu, particle1, particle2, length, k);
} }
void CudaCalcHarmonicBondForceKernel::executeForces(OpenMMContextImpl& context) { void CudaCalcHarmonicBondForceKernel::executeForces(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
calcForces(context, data); calcForces(context, data);
} }
double CudaCalcHarmonicBondForceKernel::executeEnergy(OpenMMContextImpl& context) { double CudaCalcHarmonicBondForceKernel::executeEnergy(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
return calcEnergy(context, system); return calcEnergy(context, system);
return 0.0; return 0.0;
...@@ -153,12 +153,12 @@ void CudaCalcHarmonicAngleForceKernel::initialize(const System& system, const Ha ...@@ -153,12 +153,12 @@ void CudaCalcHarmonicAngleForceKernel::initialize(const System& system, const Ha
gpuSetBondAngleParameters(data.gpu, particle1, particle2, particle3, angle, k); gpuSetBondAngleParameters(data.gpu, particle1, particle2, particle3, angle, k);
} }
void CudaCalcHarmonicAngleForceKernel::executeForces(OpenMMContextImpl& context) { void CudaCalcHarmonicAngleForceKernel::executeForces(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
calcForces(context, data); calcForces(context, data);
} }
double CudaCalcHarmonicAngleForceKernel::executeEnergy(OpenMMContextImpl& context) { double CudaCalcHarmonicAngleForceKernel::executeEnergy(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
return calcEnergy(context, system); return calcEnergy(context, system);
return 0.0; return 0.0;
...@@ -189,12 +189,12 @@ void CudaCalcPeriodicTorsionForceKernel::initialize(const System& system, const ...@@ -189,12 +189,12 @@ void CudaCalcPeriodicTorsionForceKernel::initialize(const System& system, const
gpuSetDihedralParameters(data.gpu, particle1, particle2, particle3, particle4, k, phase, periodicity); gpuSetDihedralParameters(data.gpu, particle1, particle2, particle3, particle4, k, phase, periodicity);
} }
void CudaCalcPeriodicTorsionForceKernel::executeForces(OpenMMContextImpl& context) { void CudaCalcPeriodicTorsionForceKernel::executeForces(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
calcForces(context, data); calcForces(context, data);
} }
double CudaCalcPeriodicTorsionForceKernel::executeEnergy(OpenMMContextImpl& context) { double CudaCalcPeriodicTorsionForceKernel::executeEnergy(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
return calcEnergy(context, system); return calcEnergy(context, system);
return 0.0; return 0.0;
...@@ -231,12 +231,12 @@ void CudaCalcRBTorsionForceKernel::initialize(const System& system, const RBTors ...@@ -231,12 +231,12 @@ void CudaCalcRBTorsionForceKernel::initialize(const System& system, const RBTors
gpuSetRbDihedralParameters(data.gpu, particle1, particle2, particle3, particle4, c0, c1, c2, c3, c4, c5); gpuSetRbDihedralParameters(data.gpu, particle1, particle2, particle3, particle4, c0, c1, c2, c3, c4, c5);
} }
void CudaCalcRBTorsionForceKernel::executeForces(OpenMMContextImpl& context) { void CudaCalcRBTorsionForceKernel::executeForces(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
calcForces(context, data); calcForces(context, data);
} }
double CudaCalcRBTorsionForceKernel::executeEnergy(OpenMMContextImpl& context) { double CudaCalcRBTorsionForceKernel::executeEnergy(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
return calcEnergy(context, system); return calcEnergy(context, system);
return 0.0; return 0.0;
...@@ -347,12 +347,12 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon ...@@ -347,12 +347,12 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
} }
} }
void CudaCalcNonbondedForceKernel::executeForces(OpenMMContextImpl& context) { void CudaCalcNonbondedForceKernel::executeForces(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
calcForces(context, data); calcForces(context, data);
} }
double CudaCalcNonbondedForceKernel::executeEnergy(OpenMMContextImpl& context) { double CudaCalcNonbondedForceKernel::executeEnergy(ContextImpl& context) {
if (data.primaryKernel == this) if (data.primaryKernel == this)
return calcEnergy(context, system); return calcEnergy(context, system);
return 0.0; return 0.0;
...@@ -378,7 +378,7 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF ...@@ -378,7 +378,7 @@ void CudaCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOBCF
gpuSetObcParameters(gpu, (float) force.getSoluteDielectric(), (float) force.getSolventDielectric(), radius, scale, charge); gpuSetObcParameters(gpu, (float) force.getSoluteDielectric(), (float) force.getSolventDielectric(), radius, scale, charge);
} }
void CudaCalcGBSAOBCForceKernel::executeForces(OpenMMContextImpl& context) { void CudaCalcGBSAOBCForceKernel::executeForces(ContextImpl& context) {
} }
static void initializeIntegration(const System& system, CudaPlatform::PlatformData& data, const Integrator& integrator) { static void initializeIntegration(const System& system, CudaPlatform::PlatformData& data, const Integrator& integrator) {
...@@ -439,7 +439,7 @@ static void initializeIntegration(const System& system, CudaPlatform::PlatformDa ...@@ -439,7 +439,7 @@ static void initializeIntegration(const System& system, CudaPlatform::PlatformDa
cudaThreadSynchronize(); cudaThreadSynchronize();
} }
double CudaCalcGBSAOBCForceKernel::executeEnergy(OpenMMContextImpl& context) { double CudaCalcGBSAOBCForceKernel::executeEnergy(ContextImpl& context) {
return 0.0; return 0.0;
} }
...@@ -451,7 +451,7 @@ void CudaIntegrateVerletStepKernel::initialize(const System& system, const Verle ...@@ -451,7 +451,7 @@ void CudaIntegrateVerletStepKernel::initialize(const System& system, const Verle
prevStepSize = -1.0; prevStepSize = -1.0;
} }
void CudaIntegrateVerletStepKernel::execute(OpenMMContextImpl& context, const VerletIntegrator& integrator) { void CudaIntegrateVerletStepKernel::execute(ContextImpl& context, const VerletIntegrator& integrator) {
_gpuContext* gpu = data.gpu; _gpuContext* gpu = data.gpu;
double stepSize = integrator.getStepSize(); double stepSize = integrator.getStepSize();
if (stepSize != prevStepSize) { if (stepSize != prevStepSize) {
...@@ -484,7 +484,7 @@ void CudaIntegrateLangevinStepKernel::initialize(const System& system, const Lan ...@@ -484,7 +484,7 @@ void CudaIntegrateLangevinStepKernel::initialize(const System& system, const Lan
prevStepSize = -1.0; prevStepSize = -1.0;
} }
void CudaIntegrateLangevinStepKernel::execute(OpenMMContextImpl& context, const LangevinIntegrator& integrator) { void CudaIntegrateLangevinStepKernel::execute(ContextImpl& context, const LangevinIntegrator& integrator) {
_gpuContext* gpu = data.gpu; _gpuContext* gpu = data.gpu;
double temperature = integrator.getTemperature(); double temperature = integrator.getTemperature();
double friction = integrator.getFriction(); double friction = integrator.getFriction();
...@@ -526,7 +526,7 @@ void CudaIntegrateBrownianStepKernel::initialize(const System& system, const Bro ...@@ -526,7 +526,7 @@ void CudaIntegrateBrownianStepKernel::initialize(const System& system, const Bro
prevStepSize = -1.0; prevStepSize = -1.0;
} }
void CudaIntegrateBrownianStepKernel::execute(OpenMMContextImpl& context, const BrownianIntegrator& integrator) { void CudaIntegrateBrownianStepKernel::execute(ContextImpl& context, const BrownianIntegrator& integrator) {
_gpuContext* gpu = data.gpu; _gpuContext* gpu = data.gpu;
double temperature = integrator.getTemperature(); double temperature = integrator.getTemperature();
double friction = integrator.getFriction(); double friction = integrator.getFriction();
...@@ -562,7 +562,7 @@ void CudaIntegrateVariableVerletStepKernel::initialize(const System& system, con ...@@ -562,7 +562,7 @@ void CudaIntegrateVariableVerletStepKernel::initialize(const System& system, con
prevErrorTol = -1.0; prevErrorTol = -1.0;
} }
void CudaIntegrateVariableVerletStepKernel::execute(OpenMMContextImpl& context, const VariableVerletIntegrator& integrator, double maxTime) { void CudaIntegrateVariableVerletStepKernel::execute(ContextImpl& context, const VariableVerletIntegrator& integrator, double maxTime) {
_gpuContext* gpu = data.gpu; _gpuContext* gpu = data.gpu;
double errorTol = integrator.getErrorTolerance(); double errorTol = integrator.getErrorTolerance();
if (errorTol != prevErrorTol) { if (errorTol != prevErrorTol) {
...@@ -599,7 +599,7 @@ void CudaApplyAndersenThermostatKernel::initialize(const System& system, const A ...@@ -599,7 +599,7 @@ void CudaApplyAndersenThermostatKernel::initialize(const System& system, const A
prevStepSize = -1.0; prevStepSize = -1.0;
} }
void CudaApplyAndersenThermostatKernel::execute(OpenMMContextImpl& context) { void CudaApplyAndersenThermostatKernel::execute(ContextImpl& context) {
_gpuContext* gpu = data.gpu; _gpuContext* gpu = data.gpu;
double temperature = context.getParameter(AndersenThermostat::Temperature()); double temperature = context.getParameter(AndersenThermostat::Temperature());
double frequency = context.getParameter(AndersenThermostat::CollisionFrequency()); double frequency = context.getParameter(AndersenThermostat::CollisionFrequency());
...@@ -624,7 +624,7 @@ void CudaCalcKineticEnergyKernel::initialize(const System& system) { ...@@ -624,7 +624,7 @@ void CudaCalcKineticEnergyKernel::initialize(const System& system) {
masses[i] = system.getParticleMass(i); masses[i] = system.getParticleMass(i);
} }
double CudaCalcKineticEnergyKernel::execute(OpenMMContextImpl& context) { double CudaCalcKineticEnergyKernel::execute(ContextImpl& context) {
// We don't currently have a GPU kernel to do this, so we retrieve the velocities and calculate the energy // We don't currently have a GPU kernel to do this, so we retrieve the velocities and calculate the energy
// on the CPU. // on the CPU.
...@@ -643,5 +643,5 @@ void CudaRemoveCMMotionKernel::initialize(const System& system, const CMMotionRe ...@@ -643,5 +643,5 @@ void CudaRemoveCMMotionKernel::initialize(const System& system, const CMMotionRe
data.cmMotionFrequency = force.getFrequency(); data.cmMotionFrequency = force.getFrequency();
} }
void CudaRemoveCMMotionKernel::execute(OpenMMContextImpl& context) { void CudaRemoveCMMotionKernel::execute(ContextImpl& context) {
} }
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void execute(OpenMMContextImpl& context); void execute(ContextImpl& context);
}; };
/** /**
...@@ -79,13 +79,13 @@ public: ...@@ -79,13 +79,13 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
double getTime(const OpenMMContextImpl& context) const; double getTime(const ContextImpl& context) const;
/** /**
* Set the current time (in picoseconds). * Set the current time (in picoseconds).
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void setTime(OpenMMContextImpl& context, double time); void setTime(ContextImpl& context, double time);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
}; };
...@@ -110,14 +110,14 @@ public: ...@@ -110,14 +110,14 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void executeForces(OpenMMContextImpl& context); void executeForces(ContextImpl& context);
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @return the potential energy due to the HarmonicBondForce * @return the potential energy due to the HarmonicBondForce
*/ */
double executeEnergy(OpenMMContextImpl& context); double executeEnergy(ContextImpl& context);
private: private:
int numBonds; int numBonds;
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
...@@ -144,14 +144,14 @@ public: ...@@ -144,14 +144,14 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void executeForces(OpenMMContextImpl& context); void executeForces(ContextImpl& context);
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @return the potential energy due to the HarmonicAngleForce * @return the potential energy due to the HarmonicAngleForce
*/ */
double executeEnergy(OpenMMContextImpl& context); double executeEnergy(ContextImpl& context);
private: private:
int numAngles; int numAngles;
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
...@@ -178,14 +178,14 @@ public: ...@@ -178,14 +178,14 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void executeForces(OpenMMContextImpl& context); void executeForces(ContextImpl& context);
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @return the potential energy due to the PeriodicTorsionForce * @return the potential energy due to the PeriodicTorsionForce
*/ */
double executeEnergy(OpenMMContextImpl& context); double executeEnergy(ContextImpl& context);
private: private:
int numTorsions; int numTorsions;
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
...@@ -212,14 +212,14 @@ public: ...@@ -212,14 +212,14 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void executeForces(OpenMMContextImpl& context); void executeForces(ContextImpl& context);
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @return the potential energy due to the RBTorsionForce * @return the potential energy due to the RBTorsionForce
*/ */
double executeEnergy(OpenMMContextImpl& context); double executeEnergy(ContextImpl& context);
private: private:
int numTorsions; int numTorsions;
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
...@@ -246,14 +246,14 @@ public: ...@@ -246,14 +246,14 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void executeForces(OpenMMContextImpl& context); void executeForces(ContextImpl& context);
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @return the potential energy due to the NonbondedForce * @return the potential energy due to the NonbondedForce
*/ */
double executeEnergy(OpenMMContextImpl& context); double executeEnergy(ContextImpl& context);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
int numParticles, num14; int numParticles, num14;
...@@ -280,14 +280,14 @@ public: ...@@ -280,14 +280,14 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void executeForces(OpenMMContextImpl& context); void executeForces(ContextImpl& context);
/** /**
* Execute the kernel to calculate the energy. * Execute the kernel to calculate the energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @return the potential energy due to the GBSAOBCForce * @return the potential energy due to the GBSAOBCForce
*/ */
double executeEnergy(OpenMMContextImpl& context); double executeEnergy(ContextImpl& context);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
}; };
...@@ -313,7 +313,7 @@ public: ...@@ -313,7 +313,7 @@ public:
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param integrator the VerletIntegrator this kernel is being used for * @param integrator the VerletIntegrator this kernel is being used for
*/ */
void execute(OpenMMContextImpl& context, const VerletIntegrator& integrator); void execute(ContextImpl& context, const VerletIntegrator& integrator);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
double prevStepSize; double prevStepSize;
...@@ -340,7 +340,7 @@ public: ...@@ -340,7 +340,7 @@ public:
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param integrator the LangevinIntegrator this kernel is being used for * @param integrator the LangevinIntegrator this kernel is being used for
*/ */
void execute(OpenMMContextImpl& context, const LangevinIntegrator& integrator); void execute(ContextImpl& context, const LangevinIntegrator& integrator);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
double prevTemp, prevFriction, prevStepSize; double prevTemp, prevFriction, prevStepSize;
...@@ -367,7 +367,7 @@ public: ...@@ -367,7 +367,7 @@ public:
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param integrator the BrownianIntegrator this kernel is being used for * @param integrator the BrownianIntegrator this kernel is being used for
*/ */
void execute(OpenMMContextImpl& context, const BrownianIntegrator& integrator); void execute(ContextImpl& context, const BrownianIntegrator& integrator);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
double prevTemp, prevFriction, prevStepSize; double prevTemp, prevFriction, prevStepSize;
...@@ -395,7 +395,7 @@ public: ...@@ -395,7 +395,7 @@ public:
* @param integrator the VerletIntegrator this kernel is being used for * @param integrator the VerletIntegrator this kernel is being used for
* @param maxTime the maximum time beyond which the simulation should not be advanced * @param maxTime the maximum time beyond which the simulation should not be advanced
*/ */
void execute(OpenMMContextImpl& context, const VariableVerletIntegrator& integrator, double maxTime); void execute(ContextImpl& context, const VariableVerletIntegrator& integrator, double maxTime);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
double prevErrorTol; double prevErrorTol;
...@@ -421,7 +421,7 @@ public: ...@@ -421,7 +421,7 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void execute(OpenMMContextImpl& context); void execute(ContextImpl& context);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
double prevTemp, prevFrequency, prevStepSize; double prevTemp, prevFrequency, prevStepSize;
...@@ -445,7 +445,7 @@ public: ...@@ -445,7 +445,7 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
double execute(OpenMMContextImpl& context); double execute(ContextImpl& context);
private: private:
std::vector<double> masses; std::vector<double> masses;
}; };
...@@ -469,7 +469,7 @@ public: ...@@ -469,7 +469,7 @@ public:
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
*/ */
void execute(OpenMMContextImpl& context); void execute(ContextImpl& context);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
}; };
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "CudaKernelFactory.h" #include "CudaKernelFactory.h"
#include "CudaKernels.h" #include "CudaKernels.h"
#include "openmm/PluginInitializer.h" #include "openmm/PluginInitializer.h"
#include "openmm/internal/OpenMMContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "kernels/gputypes.h" #include "kernels/gputypes.h"
#include "openmm/System.h" #include "openmm/System.h"
...@@ -66,13 +66,13 @@ const StreamFactory& CudaPlatform::getDefaultStreamFactory() const { ...@@ -66,13 +66,13 @@ const StreamFactory& CudaPlatform::getDefaultStreamFactory() const {
return defaultStreamFactory; return defaultStreamFactory;
} }
void CudaPlatform::contextCreated(OpenMMContextImpl& context) const { void CudaPlatform::contextCreated(ContextImpl& context) const {
int numParticles = context.getSystem().getNumParticles(); int numParticles = context.getSystem().getNumParticles();
_gpuContext* gpu = (_gpuContext*) gpuInit(numParticles); _gpuContext* gpu = (_gpuContext*) gpuInit(numParticles);
context.setPlatformData(new PlatformData(gpu)); context.setPlatformData(new PlatformData(gpu));
} }
void CudaPlatform::contextDestroyed(OpenMMContextImpl& context) const { void CudaPlatform::contextDestroyed(ContextImpl& context) const {
PlatformData* data = reinterpret_cast<PlatformData*>(context.getPlatformData()); PlatformData* data = reinterpret_cast<PlatformData*>(context.getPlatformData());
gpuShutDown(data->gpu); gpuShutDown(data->gpu);
delete data; delete data;
......
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