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

Refactored ForceImpl, lots of KernelImpl subclasses, and other related classes...

Refactored ForceImpl, lots of KernelImpl subclasses, and other related classes to avoid redundant calculations when requesting a State with both forces and energies
parent 767ea1bd
...@@ -56,8 +56,7 @@ public: ...@@ -56,8 +56,7 @@ public:
void updateContextState(ContextImpl& context) { void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly. // This force field doesn't update the state directly.
} }
void calcForces(ContextImpl& context ); double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy);
double calcEnergy(ContextImpl& context);
std::map<std::string, double> getDefaultParameters() { std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
......
...@@ -57,8 +57,7 @@ public: ...@@ -57,8 +57,7 @@ public:
void updateContextState(ContextImpl& context) { void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly. // This force field doesn't update the state directly.
} }
void calcForces(ContextImpl& context ); double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy);
double calcEnergy(ContextImpl& context);
std::map<std::string, double> getDefaultParameters() { std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
......
...@@ -55,8 +55,7 @@ public: ...@@ -55,8 +55,7 @@ public:
void updateContextState(ContextImpl& context) { void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly. // This force field doesn't update the state directly.
} }
void calcForces(ContextImpl& context ); double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy);
double calcEnergy(ContextImpl& context);
std::map<std::string, double> getDefaultParameters() { std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
......
...@@ -56,8 +56,7 @@ public: ...@@ -56,8 +56,7 @@ public:
void updateContextState(ContextImpl& context) { void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly. // This force field doesn't update the state directly.
} }
void calcForces(ContextImpl& context ); double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy);
double calcEnergy(ContextImpl& context);
std::map<std::string, double> getDefaultParameters() { std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
......
...@@ -56,8 +56,7 @@ public: ...@@ -56,8 +56,7 @@ public:
void updateContextState(ContextImpl& context) { void updateContextState(ContextImpl& context) {
// This force field doesn't update the state directly. // This force field doesn't update the state directly.
} }
void calcForces(ContextImpl& context ); double calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy);
double calcEnergy(ContextImpl& context);
std::map<std::string, double> getDefaultParameters() { std::map<std::string, double> getDefaultParameters() {
return std::map<std::string, double>(); // This force field doesn't define any parameters. return std::map<std::string, double>(); // This force field doesn't define any parameters.
} }
......
...@@ -46,12 +46,8 @@ void AmoebaGeneralizedKirkwoodForceImpl::initialize(ContextImpl& context) { ...@@ -46,12 +46,8 @@ void AmoebaGeneralizedKirkwoodForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaGeneralizedKirkwoodForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaGeneralizedKirkwoodForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaGeneralizedKirkwoodForceImpl::calcForces(ContextImpl& context) { double AmoebaGeneralizedKirkwoodForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaGeneralizedKirkwoodForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaGeneralizedKirkwoodForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaGeneralizedKirkwoodForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaGeneralizedKirkwoodForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaGeneralizedKirkwoodForceImpl::getKernelNames() { std::vector<std::string> AmoebaGeneralizedKirkwoodForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaHarmonicAngleForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaHarmonicAngleForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaHarmonicAngleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaHarmonicAngleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaHarmonicAngleForceImpl::calcForces(ContextImpl& context ) { double AmoebaHarmonicAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaHarmonicAngleForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaHarmonicAngleForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaHarmonicAngleForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaHarmonicAngleForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaHarmonicAngleForceImpl::getKernelNames() { std::vector<std::string> AmoebaHarmonicAngleForceImpl::getKernelNames() {
......
...@@ -51,12 +51,8 @@ void AmoebaHarmonicBondForceImpl::initialize(ContextImpl& context) { ...@@ -51,12 +51,8 @@ void AmoebaHarmonicBondForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaHarmonicBondForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaHarmonicBondForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaHarmonicBondForceImpl::calcForces(ContextImpl& context ) { double AmoebaHarmonicBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaHarmonicBondForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaHarmonicBondForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaHarmonicBondForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaHarmonicBondForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaHarmonicBondForceImpl::getKernelNames() { std::vector<std::string> AmoebaHarmonicBondForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaHarmonicInPlaneAngleForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaHarmonicInPlaneAngleForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaHarmonicInPlaneAngleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaHarmonicInPlaneAngleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaHarmonicInPlaneAngleForceImpl::calcForces(ContextImpl& context ) { double AmoebaHarmonicInPlaneAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaHarmonicInPlaneAngleForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaHarmonicInPlaneAngleForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaHarmonicInPlaneAngleForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaHarmonicInPlaneAngleForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaHarmonicInPlaneAngleForceImpl::getKernelNames() { std::vector<std::string> AmoebaHarmonicInPlaneAngleForceImpl::getKernelNames() {
......
...@@ -48,12 +48,8 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) { ...@@ -48,12 +48,8 @@ void AmoebaMultipoleForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaMultipoleForceImpl::calcForces(ContextImpl& context ) { double AmoebaMultipoleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaMultipoleForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaMultipoleForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaMultipoleForceImpl::getKernelNames() { std::vector<std::string> AmoebaMultipoleForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaOutOfPlaneBendForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaOutOfPlaneBendForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaOutOfPlaneBendForceImpl::calcForces(ContextImpl& context ) { double AmoebaOutOfPlaneBendForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaOutOfPlaneBendForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaOutOfPlaneBendForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaOutOfPlaneBendForceImpl::getKernelNames() { std::vector<std::string> AmoebaOutOfPlaneBendForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaPiTorsionForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaPiTorsionForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaPiTorsionForceImpl::calcForces(ContextImpl& context ) { double AmoebaPiTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaPiTorsionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaPiTorsionForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaPiTorsionForceImpl::getKernelNames() { std::vector<std::string> AmoebaPiTorsionForceImpl::getKernelNames() {
......
...@@ -46,12 +46,8 @@ void AmoebaSASAForceImpl::initialize(ContextImpl& context) { ...@@ -46,12 +46,8 @@ void AmoebaSASAForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaSASAForceImpl::calcForces(ContextImpl& context) { double AmoebaSASAForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaSASAForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaSASAForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaSASAForceImpl::getKernelNames() { std::vector<std::string> AmoebaSASAForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaStretchBendForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaStretchBendForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaStretchBendForceImpl::calcForces(ContextImpl& context ) { double AmoebaStretchBendForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaStretchBendForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaStretchBendForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaStretchBendForceImpl::getKernelNames() { std::vector<std::string> AmoebaStretchBendForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaTorsionForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaTorsionForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaTorsionForceImpl::calcForces(ContextImpl& context ) { double AmoebaTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaTorsionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaTorsionForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaTorsionForceImpl::getKernelNames() { std::vector<std::string> AmoebaTorsionForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaTorsionTorsionForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaTorsionTorsionForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaTorsionTorsionForceImpl::calcForces(ContextImpl& context ) { double AmoebaTorsionTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaTorsionTorsionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaTorsionTorsionForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaTorsionTorsionForceImpl::getKernelNames() { std::vector<std::string> AmoebaTorsionTorsionForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaVdwForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaVdwForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaVdwForceImpl::calcForces(ContextImpl& context ) { double AmoebaVdwForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaVdwForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaVdwForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaVdwForceImpl::getKernelNames() { std::vector<std::string> AmoebaVdwForceImpl::getKernelNames() {
......
...@@ -50,12 +50,8 @@ void AmoebaWcaDispersionForceImpl::initialize(ContextImpl& context) { ...@@ -50,12 +50,8 @@ void AmoebaWcaDispersionForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void AmoebaWcaDispersionForceImpl::calcForces(ContextImpl& context ) { double AmoebaWcaDispersionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double AmoebaWcaDispersionForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcAmoebaWcaDispersionForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> AmoebaWcaDispersionForceImpl::getKernelNames() { std::vector<std::string> AmoebaWcaDispersionForceImpl::getKernelNames() {
......
...@@ -90,13 +90,7 @@ void CudaCalcAmoebaHarmonicBondForceKernel::initialize(const System& system, con ...@@ -90,13 +90,7 @@ void CudaCalcAmoebaHarmonicBondForceKernel::initialize(const System& system, con
static_cast<float>(force.getAmoebaGlobalHarmonicBondQuartic()) ); static_cast<float>(force.getAmoebaGlobalHarmonicBondQuartic()) );
} }
void CudaCalcAmoebaHarmonicBondForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaHarmonicBondForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaHarmonicBondForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -137,13 +131,7 @@ void CudaCalcAmoebaHarmonicAngleForceKernel::initialize(const System& system, co ...@@ -137,13 +131,7 @@ void CudaCalcAmoebaHarmonicAngleForceKernel::initialize(const System& system, co
} }
void CudaCalcAmoebaHarmonicAngleForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaHarmonicAngleForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaHarmonicAngleForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -187,13 +175,7 @@ void CudaCalcAmoebaHarmonicInPlaneAngleForceKernel::initialize(const System& sys ...@@ -187,13 +175,7 @@ void CudaCalcAmoebaHarmonicInPlaneAngleForceKernel::initialize(const System& sys
} }
void CudaCalcAmoebaHarmonicInPlaneAngleForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaHarmonicInPlaneAngleForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaHarmonicInPlaneAngleForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -246,13 +228,7 @@ void CudaCalcAmoebaTorsionForceKernel::initialize(const System& system, const Am ...@@ -246,13 +228,7 @@ void CudaCalcAmoebaTorsionForceKernel::initialize(const System& system, const Am
} }
void CudaCalcAmoebaTorsionForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaTorsionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaTorsionForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -292,13 +268,7 @@ void CudaCalcAmoebaPiTorsionForceKernel::initialize(const System& system, const ...@@ -292,13 +268,7 @@ void CudaCalcAmoebaPiTorsionForceKernel::initialize(const System& system, const
gpuSetAmoebaPiTorsionParameters(data.getAmoebaGpu(), particle1, particle2, particle3, particle4, particle5, particle6, torsionKParameters); gpuSetAmoebaPiTorsionParameters(data.getAmoebaGpu(), particle1, particle2, particle3, particle4, particle5, particle6, torsionKParameters);
} }
void CudaCalcAmoebaPiTorsionForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaPiTorsionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaPiTorsionForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -341,13 +311,7 @@ void CudaCalcAmoebaStretchBendForceKernel::initialize(const System& system, cons ...@@ -341,13 +311,7 @@ void CudaCalcAmoebaStretchBendForceKernel::initialize(const System& system, cons
} }
void CudaCalcAmoebaStretchBendForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaStretchBendForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaStretchBendForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -388,13 +352,7 @@ void CudaCalcAmoebaOutOfPlaneBendForceKernel::initialize(const System& system, c ...@@ -388,13 +352,7 @@ void CudaCalcAmoebaOutOfPlaneBendForceKernel::initialize(const System& system, c
} }
void CudaCalcAmoebaOutOfPlaneBendForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaOutOfPlaneBendForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaOutOfPlaneBendForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -460,13 +418,7 @@ void CudaCalcAmoebaTorsionTorsionForceKernel::initialize(const System& system, c ...@@ -460,13 +418,7 @@ void CudaCalcAmoebaTorsionTorsionForceKernel::initialize(const System& system, c
} }
void CudaCalcAmoebaTorsionTorsionForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaTorsionTorsionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data );
}
}
double CudaCalcAmoebaTorsionTorsionForceKernel::executeEnergy(ContextImpl& context) {
if( data.getAmoebaLocalForcesKernel() == this ){ if( data.getAmoebaLocalForcesKernel() == this ){
computeAmoebaLocalForces( data ); computeAmoebaLocalForces( data );
} }
...@@ -632,11 +584,7 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const ...@@ -632,11 +584,7 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
} }
void CudaCalcAmoebaMultipoleForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaMultipoleForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
computeAmoebaMultipoleForce( data );
}
double CudaCalcAmoebaMultipoleForceKernel::executeEnergy(ContextImpl& context) {
computeAmoebaMultipoleForce( data ); computeAmoebaMultipoleForce( data );
return 0.0; return 0.0;
} }
...@@ -679,11 +627,7 @@ void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System& syst ...@@ -679,11 +627,7 @@ void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System& syst
static_cast<float>( force.getSurfaceAreaFactor() ) ); static_cast<float>( force.getSurfaceAreaFactor() ) );
} }
void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaGeneralizedKirkwoodForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
// handled in computeAmoebaMultipoleForce()
}
double CudaCalcAmoebaGeneralizedKirkwoodForceKernel::executeEnergy(ContextImpl& context) {
// handled in computeAmoebaMultipoleForce() // handled in computeAmoebaMultipoleForce()
return 0.0; return 0.0;
} }
...@@ -721,10 +665,7 @@ fflush( stderr ); ...@@ -721,10 +665,7 @@ fflush( stderr );
*/ */
} }
void CudaCalcAmoebaSASAForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaSASAForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
}
double CudaCalcAmoebaSASAForceKernel::executeEnergy(ContextImpl& context) {
return 0.0; return 0.0;
} }
...@@ -783,11 +724,7 @@ void CudaCalcAmoebaVdwForceKernel::initialize(const System& system, const Amoeba ...@@ -783,11 +724,7 @@ void CudaCalcAmoebaVdwForceKernel::initialize(const System& system, const Amoeba
allExclusions ); allExclusions );
} }
void CudaCalcAmoebaVdwForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaVdwForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
computeAmoebaVdwForce( data );
}
double CudaCalcAmoebaVdwForceKernel::executeEnergy(ContextImpl& context) {
computeAmoebaVdwForce( data ); computeAmoebaVdwForce( data );
return 0.0; return 0.0;
} }
...@@ -845,11 +782,7 @@ void CudaCalcAmoebaWcaDispersionForceKernel::initialize(const System& system, co ...@@ -845,11 +782,7 @@ void CudaCalcAmoebaWcaDispersionForceKernel::initialize(const System& system, co
static_cast<float>( force.getDispoff( ) ) ); static_cast<float>( force.getDispoff( ) ) );
} }
void CudaCalcAmoebaWcaDispersionForceKernel::executeForces(ContextImpl& context) { double CudaCalcAmoebaWcaDispersionForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
computeAmoebaWcaDispersionForce( data );
}
double CudaCalcAmoebaWcaDispersionForceKernel::executeEnergy(ContextImpl& context) {
computeAmoebaWcaDispersionForce( data ); computeAmoebaWcaDispersionForce( data );
return 0.0; return 0.0;
} }
...@@ -51,18 +51,14 @@ public: ...@@ -51,18 +51,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaHarmonicBondForce& force); void initialize(const System& system, const AmoebaHarmonicBondForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaHarmonicBondForce
*/
double executeEnergy(ContextImpl& context);
private: private:
int numBonds; int numBonds;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -84,18 +80,14 @@ public: ...@@ -84,18 +80,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaHarmonicAngleForce& force); void initialize(const System& system, const AmoebaHarmonicAngleForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaHarmonicAngleForce
*/
double executeEnergy(ContextImpl& context);
private: private:
int numAngles; int numAngles;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -117,18 +109,14 @@ public: ...@@ -117,18 +109,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaHarmonicInPlaneAngleForce& force); void initialize(const System& system, const AmoebaHarmonicInPlaneAngleForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
*/
void executeForces(ContextImpl& context);
/**
* 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 AmoebaHarmonicInPlaneAngleForce * @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
int numAngles; int numAngles;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -150,18 +138,14 @@ public: ...@@ -150,18 +138,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaTorsionForce& force); void initialize(const System& system, const AmoebaTorsionForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
*/
void executeForces(ContextImpl& context);
/**
* 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 AmoebaTorsionForce * @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
int numTorsions; int numTorsions;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -183,18 +167,14 @@ public: ...@@ -183,18 +167,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaPiTorsionForce& force); void initialize(const System& system, const AmoebaPiTorsionForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
*/
void executeForces(ContextImpl& context);
/**
* 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 AmoebaPiTorsionForce * @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
int numPiTorsions; int numPiTorsions;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -216,18 +196,14 @@ public: ...@@ -216,18 +196,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaStretchBendForce& force); void initialize(const System& system, const AmoebaStretchBendForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaStretchBendForce
*/
double executeEnergy(ContextImpl& context);
private: private:
int numStretchBends; int numStretchBends;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -249,18 +225,14 @@ public: ...@@ -249,18 +225,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaOutOfPlaneBendForce& force); void initialize(const System& system, const AmoebaOutOfPlaneBendForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
*/
void executeForces(ContextImpl& context);
/**
* 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 AmoebaOutOfPlaneBendForce * @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
int numOutOfPlaneBends; int numOutOfPlaneBends;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -282,18 +254,14 @@ public: ...@@ -282,18 +254,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaTorsionTorsionForce& force); void initialize(const System& system, const AmoebaTorsionTorsionForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaTorsionTorsionForce
*/
double executeEnergy(ContextImpl& context);
private: private:
int numTorsionTorsions; int numTorsionTorsions;
int numTorsionTorsionGrids; int numTorsionTorsionGrids;
...@@ -316,18 +284,14 @@ public: ...@@ -316,18 +284,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaMultipoleForce& force); void initialize(const System& system, const AmoebaMultipoleForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaMultipoleForce
*/
double executeEnergy(ContextImpl& context);
private: private:
int numMultipoles; int numMultipoles;
AmoebaCudaData& data; AmoebaCudaData& data;
...@@ -349,18 +313,14 @@ public: ...@@ -349,18 +313,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaGeneralizedKirkwoodForce& force); void initialize(const System& system, const AmoebaGeneralizedKirkwoodForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
*/
void executeForces(ContextImpl& context);
/**
* 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 AmoebaMultipoleForce * @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
AmoebaCudaData& data; AmoebaCudaData& data;
System& system; System& system;
...@@ -381,18 +341,14 @@ public: ...@@ -381,18 +341,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaSASAForce& force); void initialize(const System& system, const AmoebaSASAForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaMultipoleForce
*/
double executeEnergy(ContextImpl& context);
private: private:
AmoebaCudaData& data; AmoebaCudaData& data;
System& system; System& system;
...@@ -413,18 +369,14 @@ public: ...@@ -413,18 +369,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaVdwForce& force); void initialize(const System& system, const AmoebaVdwForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
* *
* @param context the context in which to execute this kernel * @param context the context in which to execute this kernel
* @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
void executeForces(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/**
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the AmoebaMultipoleForce
*/
double executeEnergy(ContextImpl& context);
private: private:
AmoebaCudaData& data; AmoebaCudaData& data;
System& system; System& system;
...@@ -445,18 +397,14 @@ public: ...@@ -445,18 +397,14 @@ public:
*/ */
void initialize(const System& system, const AmoebaWcaDispersionForce& force); void initialize(const System& system, const AmoebaWcaDispersionForce& force);
/** /**
* Execute the kernel to calculate the forces. * Execute the kernel to calculate the forces and/or energy.
*
* @param context the context in which to execute this kernel
*/
void executeForces(ContextImpl& context);
/**
* 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 AmoebaMultipoleForce * @param includeForces true if forces should be calculated
* @param includeEnergy true if the energy should be calculated
* @return the potential energy due to the force
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
AmoebaCudaData& data; AmoebaCudaData& data;
System& system; System& system;
......
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