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
...@@ -65,18 +65,14 @@ public: ...@@ -65,18 +65,14 @@ public:
*/ */
virtual void initialize(const System& system, const GBSAOBCSoftcoreForce& force) = 0; virtual void initialize(const System& system, const GBSAOBCSoftcoreForce& force) = 0;
/** /**
* 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
virtual void executeForces(ContextImpl& context) = 0; * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBSAOBCSoftcoreForce
*/ */
virtual double executeEnergy(ContextImpl& context) = 0; virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
}; };
/** /**
...@@ -104,18 +100,14 @@ public: ...@@ -104,18 +100,14 @@ public:
*/ */
virtual void initialize(const System& system, const NonbondedSoftcoreForce& force) = 0; virtual void initialize(const System& system, const NonbondedSoftcoreForce& force) = 0;
/** /**
* 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
virtual void executeForces(ContextImpl& context) = 0; * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the NonbondedSoftcoreForce
*/ */
virtual double executeEnergy(ContextImpl& context) = 0; virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
}; };
/** /**
...@@ -137,18 +129,14 @@ public: ...@@ -137,18 +129,14 @@ public:
*/ */
virtual void initialize(const System& system, const GBVISoftcoreForce& force, const std::vector<double>& scaledRadii) = 0; virtual void initialize(const System& system, const GBVISoftcoreForce& force, const std::vector<double>& scaledRadii) = 0;
/** /**
* 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
virtual void executeForces(ContextImpl& context) = 0; * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBVISoftcoreForce
*/ */
virtual double executeEnergy(ContextImpl& context) = 0; virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -53,8 +53,7 @@ public: ...@@ -53,8 +53,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.
} }
......
...@@ -62,8 +62,7 @@ public: ...@@ -62,8 +62,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.
} }
......
...@@ -48,12 +48,8 @@ void GBSAOBCSoftcoreForceImpl::initialize(ContextImpl& context) { ...@@ -48,12 +48,8 @@ void GBSAOBCSoftcoreForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcGBSAOBCSoftcoreForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcGBSAOBCSoftcoreForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void GBSAOBCSoftcoreForceImpl::calcForces(ContextImpl& context ) { double GBSAOBCSoftcoreForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcGBSAOBCSoftcoreForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcGBSAOBCSoftcoreForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double GBSAOBCSoftcoreForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcGBSAOBCSoftcoreForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> GBSAOBCSoftcoreForceImpl::getKernelNames() { std::vector<std::string> GBSAOBCSoftcoreForceImpl::getKernelNames() {
......
...@@ -261,12 +261,8 @@ void GBVISoftcoreForceImpl::findScaledRadii( int numberOfParticles, const std::v ...@@ -261,12 +261,8 @@ void GBVISoftcoreForceImpl::findScaledRadii( int numberOfParticles, const std::v
} }
void GBVISoftcoreForceImpl::calcForces(ContextImpl& context) { double GBVISoftcoreForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcGBVISoftcoreForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcGBVISoftcoreForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double GBVISoftcoreForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcGBVISoftcoreForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> GBVISoftcoreForceImpl::getKernelNames() { std::vector<std::string> GBVISoftcoreForceImpl::getKernelNames() {
......
...@@ -87,12 +87,8 @@ void NonbondedSoftcoreForceImpl::initialize(ContextImpl& context) { ...@@ -87,12 +87,8 @@ void NonbondedSoftcoreForceImpl::initialize(ContextImpl& context) {
dynamic_cast<CalcNonbondedSoftcoreForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner); dynamic_cast<CalcNonbondedSoftcoreForceKernel&>(kernel.getImpl()).initialize(context.getSystem(), owner);
} }
void NonbondedSoftcoreForceImpl::calcForces(ContextImpl& context ) { double NonbondedSoftcoreForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy) {
dynamic_cast<CalcNonbondedSoftcoreForceKernel&>(kernel.getImpl()).executeForces(context); return dynamic_cast<CalcNonbondedSoftcoreForceKernel&>(kernel.getImpl()).execute(context, includeForces, includeEnergy);
}
double NonbondedSoftcoreForceImpl::calcEnergy(ContextImpl& context) {
return dynamic_cast<CalcNonbondedSoftcoreForceKernel&>(kernel.getImpl()).executeEnergy(context);
} }
std::vector<std::string> NonbondedSoftcoreForceImpl::getKernelNames() { std::vector<std::string> NonbondedSoftcoreForceImpl::getKernelNames() {
......
...@@ -377,7 +377,7 @@ void CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::initialize(const System& sy ...@@ -377,7 +377,7 @@ void CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::initialize(const System& sy
} }
} }
void CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::executeForces(ContextImpl& context) { double CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -428,10 +428,6 @@ void CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::executeForces(ContextImpl& ...@@ -428,10 +428,6 @@ void CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::executeForces(ContextImpl&
//kPrintForces( gpu, "Post kCalculateLocalSoftcoreForces ", call ); //kPrintForces( gpu, "Post kCalculateLocalSoftcoreForces ", call );
//kPrintForces(gpu, "Post kCalculateLocalSoftcoreForces", call ); //kPrintForces(gpu, "Post kCalculateLocalSoftcoreForces", call );
//kReduceForces(gpu); //kReduceForces(gpu);
}
double CudaFreeEnergyCalcNonbondedSoftcoreForceKernel::executeEnergy(ContextImpl& context) {
executeForces(context);
return 0.0; return 0.0;
} }
...@@ -519,7 +515,7 @@ void CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::initialize(const System& syst ...@@ -519,7 +515,7 @@ void CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::initialize(const System& syst
radius, scale, charge, nonPolarScalingFactors ); radius, scale, charge, nonPolarScalingFactors );
} }
void CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::executeForces(ContextImpl& context) { double CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -576,11 +572,7 @@ void CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::executeForces(ContextImpl& co ...@@ -576,11 +572,7 @@ void CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::executeForces(ContextImpl& co
// second loop of Obc GBSA forces // second loop of Obc GBSA forces
kCalculateObcGbsaSoftcoreForces2(gpu); kCalculateObcGbsaSoftcoreForces2(gpu);
} return 0.0;
double CudaFreeEnergyCalcGBSAOBCSoftcoreForceKernel::executeEnergy(ContextImpl& context) {
executeForces( context );
return 0.0;
} }
CudaFreeEnergyCalcGBVISoftcoreForceKernel::~CudaFreeEnergyCalcGBVISoftcoreForceKernel() { CudaFreeEnergyCalcGBVISoftcoreForceKernel::~CudaFreeEnergyCalcGBVISoftcoreForceKernel() {
...@@ -661,7 +653,7 @@ void CudaFreeEnergyCalcGBVISoftcoreForceKernel::initialize(const System& system, ...@@ -661,7 +653,7 @@ void CudaFreeEnergyCalcGBVISoftcoreForceKernel::initialize(const System& system,
} }
void CudaFreeEnergyCalcGBVISoftcoreForceKernel::executeForces(ContextImpl& context) { double CudaFreeEnergyCalcGBVISoftcoreForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
...@@ -747,10 +739,6 @@ void CudaFreeEnergyCalcGBVISoftcoreForceKernel::executeForces(ContextImpl& conte ...@@ -747,10 +739,6 @@ void CudaFreeEnergyCalcGBVISoftcoreForceKernel::executeForces(ContextImpl& conte
kCalculateGBVISoftcoreForces2(gpu); kCalculateGBVISoftcoreForces2(gpu);
//kPrintForces( gpu, "Post GBVISoftcoreForces2", call ); //kPrintForces( gpu, "Post GBVISoftcoreForces2", call );
}
double CudaFreeEnergyCalcGBVISoftcoreForceKernel::executeEnergy(ContextImpl& context) {
executeForces( context );
return 0.0; return 0.0;
} }
......
...@@ -73,18 +73,14 @@ public: ...@@ -73,18 +73,14 @@ public:
*/ */
void initialize(const System& system, const NonbondedSoftcoreForce& force); void initialize(const System& system, const NonbondedSoftcoreForce& 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
void executeForces(ContextImpl& context); * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the NonbondedForce
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/** /**
* Get flag signalling whether GBSA/OBC force is included * Get flag signalling whether GBSA/OBC force is included
* *
...@@ -177,18 +173,14 @@ public: ...@@ -177,18 +173,14 @@ public:
*/ */
void initialize(const System& system, const GBSAOBCSoftcoreForce& force); void initialize(const System& system, const GBSAOBCSoftcoreForce& 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
void executeForces(ContextImpl& context); * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBSAOBCForce
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
CudaPlatform::PlatformData& data; CudaPlatform::PlatformData& data;
FILE* log; FILE* log;
...@@ -223,18 +215,14 @@ public: ...@@ -223,18 +215,14 @@ public:
*/ */
void initialize(const System& system, const GBVISoftcoreForce& force, const std::vector<double> & scaledRadii); void initialize(const System& system, const GBVISoftcoreForce& force, const std::vector<double> & scaledRadii);
/** /**
* 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
void executeForces(ContextImpl& context); * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBVIForce
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
/** /**
* Apply quintic scaling for Born radii * Apply quintic scaling for Born radii
......
...@@ -226,47 +226,11 @@ void ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::initialize(const Syste ...@@ -226,47 +226,11 @@ void ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::initialize(const Syste
rfDielectric = (RealOpenMM)force.getReactionFieldDielectric(); rfDielectric = (RealOpenMM)force.getReactionFieldDielectric();
} }
void ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::executeForces(ContextImpl& context) { double ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
RealOpenMM** posData = extractPositions(context); RealOpenMM** posData = extractPositions(context);
RealOpenMM** forceData = extractForces(context); RealOpenMM** forceData = extractForces(context);
ReferenceFreeEnergyLJCoulombSoftcoreIxn clj;
//clj.setSoftCoreLJLambda( softCoreLJLambda );
bool periodic = (nonbondedMethod == CutoffPeriodic);
bool ewald = (nonbondedMethod == Ewald);
bool pme = (nonbondedMethod == PME);
if (nonbondedMethod != NoCutoff) {
computeNeighborListVoxelHash(*neighborList, numParticles, posData, exclusions, (periodic || ewald || pme) ? periodicBoxSize : NULL, nonbondedCutoff, 0.0);
clj.setUseCutoff(nonbondedCutoff, *neighborList, rfDielectric);
}
if (periodic||ewald||pme)
clj.setPeriodic(periodicBoxSize);
if (ewald)
clj.setUseEwald(ewaldAlpha, kmax[0], kmax[1], kmax[2]);
if (pme)
clj.setUsePME(ewaldAlpha);
clj.calculatePairIxn(numParticles, posData, particleParamArray, exclusionArray, 0, forceData, 0, 0);
ReferenceBondForce refBondForce;
ReferenceFreeEnergyLJCoulomb14Softcore nonbonded14;
if (nonbondedMethod == CutoffNonPeriodic || nonbondedMethod == CutoffPeriodic)
nonbonded14.setUseCutoff(nonbondedCutoff, rfDielectric);
refBondForce.calculateForce(num14, bonded14IndexArray, posData, bonded14ParamArray, forceData, 0, nonbonded14);
}
double ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = extractPositions(context);
RealOpenMM** forceData = allocateRealArray(numParticles, 3);
RealOpenMM energy = 0; RealOpenMM energy = 0;
ReferenceFreeEnergyLJCoulombSoftcoreIxn clj; ReferenceFreeEnergyLJCoulombSoftcoreIxn clj;
// clj.setSoftCoreLJLambda( softCoreLJLambda ); // clj.setSoftCoreLJLambda( softCoreLJLambda );
...@@ -290,7 +254,6 @@ double ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::executeEnergy(Contex ...@@ -290,7 +254,6 @@ double ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::executeEnergy(Contex
nonbonded14.setUseCutoff(nonbondedCutoff, rfDielectric); nonbonded14.setUseCutoff(nonbondedCutoff, rfDielectric);
refBondForce.calculateForce(num14, bonded14IndexArray, posData, bonded14ParamArray, forceData, &energy, nonbonded14); refBondForce.calculateForce(num14, bonded14IndexArray, posData, bonded14ParamArray, forceData, &energy, nonbonded14);
disposeRealArray(forceData, numParticles);
return energy; return energy;
} }
...@@ -361,13 +324,7 @@ void ReferenceFreeEnergyCalcGBSAOBCSoftcoreForceKernel::initialize(const System& ...@@ -361,13 +324,7 @@ void ReferenceFreeEnergyCalcGBSAOBCSoftcoreForceKernel::initialize(const System&
obc->setIncludeAceApproximation(true); obc->setIncludeAceApproximation(true);
} }
void ReferenceFreeEnergyCalcGBSAOBCSoftcoreForceKernel::executeForces(ContextImpl& context) { double ReferenceFreeEnergyCalcGBSAOBCSoftcoreForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
RealOpenMM** posData = extractPositions(context);
RealOpenMM** forceData = extractForces(context);
obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1);
}
double ReferenceFreeEnergyCalcGBSAOBCSoftcoreForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = extractPositions(context); RealOpenMM** posData = extractPositions(context);
RealOpenMM** forceData = extractForces(context); RealOpenMM** forceData = extractForces(context);
obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1); obc->computeImplicitSolventForces(posData, &charges[0], forceData, 1);
...@@ -433,23 +390,18 @@ void ReferenceFreeEnergyCalcGBVISoftcoreForceKernel::initialize(const System& sy ...@@ -433,23 +390,18 @@ void ReferenceFreeEnergyCalcGBVISoftcoreForceKernel::initialize(const System& sy
gbviSoftcore = new CpuGBVISoftcore(gBVIParameters); gbviSoftcore = new CpuGBVISoftcore(gBVIParameters);
} }
void ReferenceFreeEnergyCalcGBVISoftcoreForceKernel::executeForces(ContextImpl& context) { double ReferenceFreeEnergyCalcGBVISoftcoreForceKernel::execute(ContextImpl& context, bool includeForces, bool includeEnergy) {
RealOpenMM** posData = extractPositions(context);
RealOpenMM** forceData = extractForces(context);
RealOpenMM* bornRadii = new RealOpenMM[context.getSystem().getNumParticles()];
gbviSoftcore->computeBornRadii(posData, bornRadii, NULL );
gbviSoftcore->computeBornForces(bornRadii, posData, &charges[0], forceData);
delete[] bornRadii;
}
double ReferenceFreeEnergyCalcGBVISoftcoreForceKernel::executeEnergy(ContextImpl& context) {
RealOpenMM** posData = extractPositions(context); RealOpenMM** posData = extractPositions(context);
RealOpenMM* bornRadii = new RealOpenMM[context.getSystem().getNumParticles()]; RealOpenMM* bornRadii = new RealOpenMM[context.getSystem().getNumParticles()];
gbviSoftcore->computeBornRadii(posData, bornRadii, NULL ); gbviSoftcore->computeBornRadii(posData, bornRadii, NULL );
RealOpenMM energy = gbviSoftcore->computeBornEnergy(bornRadii ,posData, &charges[0]); if (includeForces) {
RealOpenMM** forceData = extractForces(context);
gbviSoftcore->computeBornForces(bornRadii, posData, &charges[0], forceData);
}
RealOpenMM energy = 0.0;
if (includeEnergy)
energy = gbviSoftcore->computeBornEnergy(bornRadii ,posData, &charges[0]);
delete[] bornRadii; delete[] bornRadii;
return static_cast<double>(energy); return static_cast<double>(energy);
} }
...@@ -57,18 +57,14 @@ public: ...@@ -57,18 +57,14 @@ public:
*/ */
void initialize(const System& system, const NonbondedSoftcoreForce& force); void initialize(const System& system, const NonbondedSoftcoreForce& 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
void executeForces(ContextImpl& context); * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the NonbondedSoftcoreForce
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
int numParticles, num14; int numParticles, num14;
int **exclusionArray, **bonded14IndexArray; int **exclusionArray, **bonded14IndexArray;
...@@ -96,18 +92,14 @@ public: ...@@ -96,18 +92,14 @@ public:
*/ */
void initialize(const System& system, const GBSAOBCSoftcoreForce& force); void initialize(const System& system, const GBSAOBCSoftcoreForce& 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
void executeForces(ContextImpl& context); * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBSAOBCSoftcoreForce
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
CpuObcSoftcore* obc; CpuObcSoftcore* obc;
std::vector<RealOpenMM> charges; std::vector<RealOpenMM> charges;
...@@ -130,18 +122,14 @@ public: ...@@ -130,18 +122,14 @@ public:
*/ */
void initialize(const System& system, const GBVISoftcoreForce& force, const std::vector<double> & scaledRadii); void initialize(const System& system, const GBVISoftcoreForce& force, const std::vector<double> & scaledRadii);
/** /**
* 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
void executeForces(ContextImpl& context); * @param includeEnergy true if the energy should be calculated
/** * @return the potential energy due to the force
* Execute the kernel to calculate the energy.
*
* @param context the context in which to execute this kernel
* @return the potential energy due to the GBVISoftcoreForce
*/ */
double executeEnergy(ContextImpl& context); double execute(ContextImpl& context, bool includeForces, bool includeEnergy);
private: private:
CpuGBVISoftcore* gbviSoftcore; CpuGBVISoftcore* gbviSoftcore;
std::vector<RealOpenMM> charges; std::vector<RealOpenMM> charges;
......
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