Unverified Commit 4a26bca4 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Ignore changes to force group after context creation (#4029)

parent c7efe3d4
...@@ -119,6 +119,7 @@ protected: ...@@ -119,6 +119,7 @@ protected:
ContextImpl& getContextImpl(Context& context) const { ContextImpl& getContextImpl(Context& context) const {
return context.getImpl(); return context.getImpl();
} }
int forceGroup;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -86,6 +86,8 @@ private: ...@@ -86,6 +86,8 @@ private:
static double evalIntegral(double r, double rs, double rc, double sigma); static double evalIntegral(double r, double rs, double rc, double sigma);
const NonbondedForce& owner; const NonbondedForce& owner;
Kernel kernel; Kernel kernel;
int recipForceGroup;
bool includeDirectSpace;
}; };
} // namespace OpenMM } // namespace OpenMM
......
...@@ -43,6 +43,7 @@ using namespace OpenMM; ...@@ -43,6 +43,7 @@ using namespace OpenMM;
using namespace std; using namespace std;
CMAPTorsionForceImpl::CMAPTorsionForceImpl(const CMAPTorsionForce& owner) : owner(owner) { CMAPTorsionForceImpl::CMAPTorsionForceImpl(const CMAPTorsionForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CMAPTorsionForceImpl::~CMAPTorsionForceImpl() { CMAPTorsionForceImpl::~CMAPTorsionForceImpl() {
...@@ -73,7 +74,7 @@ void CMAPTorsionForceImpl::initialize(ContextImpl& context) { ...@@ -73,7 +74,7 @@ void CMAPTorsionForceImpl::initialize(ContextImpl& context) {
} }
double CMAPTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CMAPTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCMAPTorsionForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCMAPTorsionForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -44,6 +44,7 @@ using std::string; ...@@ -44,6 +44,7 @@ using std::string;
using std::stringstream; using std::stringstream;
CustomAngleForceImpl::CustomAngleForceImpl(const CustomAngleForce& owner) : owner(owner) { CustomAngleForceImpl::CustomAngleForceImpl(const CustomAngleForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomAngleForceImpl::~CustomAngleForceImpl() { CustomAngleForceImpl::~CustomAngleForceImpl() {
...@@ -78,7 +79,7 @@ void CustomAngleForceImpl::initialize(ContextImpl& context) { ...@@ -78,7 +79,7 @@ void CustomAngleForceImpl::initialize(ContextImpl& context) {
} }
double CustomAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomAngleForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomAngleForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -44,6 +44,7 @@ using std::string; ...@@ -44,6 +44,7 @@ using std::string;
using std::stringstream; using std::stringstream;
CustomBondForceImpl::CustomBondForceImpl(const CustomBondForce& owner) : owner(owner) { CustomBondForceImpl::CustomBondForceImpl(const CustomBondForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomBondForceImpl::~CustomBondForceImpl() { CustomBondForceImpl::~CustomBondForceImpl() {
...@@ -79,7 +80,7 @@ void CustomBondForceImpl::initialize(ContextImpl& context) { ...@@ -79,7 +80,7 @@ void CustomBondForceImpl::initialize(ContextImpl& context) {
} }
double CustomBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomBondForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomBondForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -42,6 +42,7 @@ using namespace std; ...@@ -42,6 +42,7 @@ using namespace std;
CustomCVForceImpl::CustomCVForceImpl(const CustomCVForce& owner) : owner(owner), innerIntegrator(1.0), CustomCVForceImpl::CustomCVForceImpl(const CustomCVForce& owner) : owner(owner), innerIntegrator(1.0),
innerContext(NULL) { innerContext(NULL) {
forceGroup = owner.getForceGroup();
} }
CustomCVForceImpl::~CustomCVForceImpl() { CustomCVForceImpl::~CustomCVForceImpl() {
...@@ -80,7 +81,7 @@ void CustomCVForceImpl::initialize(ContextImpl& context) { ...@@ -80,7 +81,7 @@ void CustomCVForceImpl::initialize(ContextImpl& context) {
} }
double CustomCVForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomCVForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomCVForceKernel>().execute(context, getContextImpl(*innerContext), includeForces, includeEnergy); return kernel.getAs<CalcCustomCVForceKernel>().execute(context, getContextImpl(*innerContext), includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -68,6 +68,7 @@ public: ...@@ -68,6 +68,7 @@ public:
}; };
CustomCentroidBondForceImpl::CustomCentroidBondForceImpl(const CustomCentroidBondForce& owner) : owner(owner) { CustomCentroidBondForceImpl::CustomCentroidBondForceImpl(const CustomCentroidBondForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomCentroidBondForceImpl::~CustomCentroidBondForceImpl() { CustomCentroidBondForceImpl::~CustomCentroidBondForceImpl() {
...@@ -120,7 +121,7 @@ void CustomCentroidBondForceImpl::initialize(ContextImpl& context) { ...@@ -120,7 +121,7 @@ void CustomCentroidBondForceImpl::initialize(ContextImpl& context) {
} }
double CustomCentroidBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomCentroidBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomCentroidBondForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomCentroidBondForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
}; };
CustomCompoundBondForceImpl::CustomCompoundBondForceImpl(const CustomCompoundBondForce& owner) : owner(owner) { CustomCompoundBondForceImpl::CustomCompoundBondForceImpl(const CustomCompoundBondForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomCompoundBondForceImpl::~CustomCompoundBondForceImpl() { CustomCompoundBondForceImpl::~CustomCompoundBondForceImpl() {
...@@ -106,7 +107,7 @@ void CustomCompoundBondForceImpl::initialize(ContextImpl& context) { ...@@ -106,7 +107,7 @@ void CustomCompoundBondForceImpl::initialize(ContextImpl& context) {
} }
double CustomCompoundBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomCompoundBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomCompoundBondForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomCompoundBondForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -44,6 +44,7 @@ using std::string; ...@@ -44,6 +44,7 @@ using std::string;
using std::stringstream; using std::stringstream;
CustomExternalForceImpl::CustomExternalForceImpl(const CustomExternalForce& owner) : owner(owner) { CustomExternalForceImpl::CustomExternalForceImpl(const CustomExternalForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomExternalForceImpl::~CustomExternalForceImpl() { CustomExternalForceImpl::~CustomExternalForceImpl() {
...@@ -77,7 +78,7 @@ void CustomExternalForceImpl::initialize(ContextImpl& context) { ...@@ -77,7 +78,7 @@ void CustomExternalForceImpl::initialize(ContextImpl& context) {
} }
double CustomExternalForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomExternalForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomExternalForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomExternalForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -45,6 +45,7 @@ using std::string; ...@@ -45,6 +45,7 @@ using std::string;
using std::stringstream; using std::stringstream;
CustomGBForceImpl::CustomGBForceImpl(const CustomGBForce& owner) : owner(owner) { CustomGBForceImpl::CustomGBForceImpl(const CustomGBForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomGBForceImpl::~CustomGBForceImpl() { CustomGBForceImpl::~CustomGBForceImpl() {
...@@ -107,7 +108,7 @@ void CustomGBForceImpl::initialize(ContextImpl& context) { ...@@ -107,7 +108,7 @@ void CustomGBForceImpl::initialize(ContextImpl& context) {
} }
double CustomGBForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomGBForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomGBForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomGBForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
}; };
CustomHbondForceImpl::CustomHbondForceImpl(const CustomHbondForce& owner) : owner(owner) { CustomHbondForceImpl::CustomHbondForceImpl(const CustomHbondForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomHbondForceImpl::~CustomHbondForceImpl() { CustomHbondForceImpl::~CustomHbondForceImpl() {
...@@ -180,7 +181,7 @@ void CustomHbondForceImpl::initialize(ContextImpl& context) { ...@@ -180,7 +181,7 @@ void CustomHbondForceImpl::initialize(ContextImpl& context) {
} }
double CustomHbondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomHbondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomHbondForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomHbondForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -73,6 +73,7 @@ public: ...@@ -73,6 +73,7 @@ public:
}; };
CustomManyParticleForceImpl::CustomManyParticleForceImpl(const CustomManyParticleForce& owner) : owner(owner) { CustomManyParticleForceImpl::CustomManyParticleForceImpl(const CustomManyParticleForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomManyParticleForceImpl::~CustomManyParticleForceImpl() { CustomManyParticleForceImpl::~CustomManyParticleForceImpl() {
...@@ -136,7 +137,7 @@ void CustomManyParticleForceImpl::initialize(ContextImpl& context) { ...@@ -136,7 +137,7 @@ void CustomManyParticleForceImpl::initialize(ContextImpl& context) {
} }
double CustomManyParticleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomManyParticleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomManyParticleForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomManyParticleForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -51,6 +51,7 @@ using namespace OpenMM; ...@@ -51,6 +51,7 @@ using namespace OpenMM;
using namespace std; using namespace std;
CustomNonbondedForceImpl::CustomNonbondedForceImpl(const CustomNonbondedForce& owner) : owner(owner) { CustomNonbondedForceImpl::CustomNonbondedForceImpl(const CustomNonbondedForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomNonbondedForceImpl::~CustomNonbondedForceImpl() { CustomNonbondedForceImpl::~CustomNonbondedForceImpl() {
...@@ -139,7 +140,7 @@ void CustomNonbondedForceImpl::initialize(ContextImpl& context) { ...@@ -139,7 +140,7 @@ void CustomNonbondedForceImpl::initialize(ContextImpl& context) {
} }
double CustomNonbondedForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomNonbondedForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomNonbondedForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomNonbondedForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -44,6 +44,7 @@ using std::string; ...@@ -44,6 +44,7 @@ using std::string;
using std::stringstream; using std::stringstream;
CustomTorsionForceImpl::CustomTorsionForceImpl(const CustomTorsionForce& owner) : owner(owner) { CustomTorsionForceImpl::CustomTorsionForceImpl(const CustomTorsionForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
CustomTorsionForceImpl::~CustomTorsionForceImpl() { CustomTorsionForceImpl::~CustomTorsionForceImpl() {
...@@ -79,7 +80,7 @@ void CustomTorsionForceImpl::initialize(ContextImpl& context) { ...@@ -79,7 +80,7 @@ void CustomTorsionForceImpl::initialize(ContextImpl& context) {
} }
double CustomTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double CustomTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcCustomTorsionForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcCustomTorsionForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -40,6 +40,7 @@ using namespace OpenMM; ...@@ -40,6 +40,7 @@ using namespace OpenMM;
using std::vector; using std::vector;
GBSAOBCForceImpl::GBSAOBCForceImpl(const GBSAOBCForce& owner) : owner(owner) { GBSAOBCForceImpl::GBSAOBCForceImpl(const GBSAOBCForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
void GBSAOBCForceImpl::initialize(ContextImpl& context) { void GBSAOBCForceImpl::initialize(ContextImpl& context) {
...@@ -65,7 +66,7 @@ void GBSAOBCForceImpl::initialize(ContextImpl& context) { ...@@ -65,7 +66,7 @@ void GBSAOBCForceImpl::initialize(ContextImpl& context) {
} }
double GBSAOBCForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double GBSAOBCForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcGBSAOBCForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcGBSAOBCForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -41,6 +41,7 @@ using namespace OpenMM; ...@@ -41,6 +41,7 @@ using namespace OpenMM;
using namespace std; using namespace std;
GayBerneForceImpl::GayBerneForceImpl(const GayBerneForce& owner) : owner(owner) { GayBerneForceImpl::GayBerneForceImpl(const GayBerneForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
GayBerneForceImpl::~GayBerneForceImpl() { GayBerneForceImpl::~GayBerneForceImpl() {
...@@ -122,7 +123,7 @@ void GayBerneForceImpl::initialize(ContextImpl& context) { ...@@ -122,7 +123,7 @@ void GayBerneForceImpl::initialize(ContextImpl& context) {
} }
double GayBerneForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double GayBerneForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcGayBerneForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcGayBerneForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -43,6 +43,7 @@ using namespace OpenMM; ...@@ -43,6 +43,7 @@ using namespace OpenMM;
using namespace std; using namespace std;
HarmonicAngleForceImpl::HarmonicAngleForceImpl(const HarmonicAngleForce& owner) : owner(owner) { HarmonicAngleForceImpl::HarmonicAngleForceImpl(const HarmonicAngleForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
HarmonicAngleForceImpl::~HarmonicAngleForceImpl() { HarmonicAngleForceImpl::~HarmonicAngleForceImpl() {
...@@ -70,7 +71,7 @@ void HarmonicAngleForceImpl::initialize(ContextImpl& context) { ...@@ -70,7 +71,7 @@ void HarmonicAngleForceImpl::initialize(ContextImpl& context) {
} }
double HarmonicAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double HarmonicAngleForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcHarmonicAngleForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcHarmonicAngleForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -39,6 +39,7 @@ using namespace OpenMM; ...@@ -39,6 +39,7 @@ using namespace OpenMM;
using namespace std; using namespace std;
HarmonicBondForceImpl::HarmonicBondForceImpl(const HarmonicBondForce& owner) : owner(owner) { HarmonicBondForceImpl::HarmonicBondForceImpl(const HarmonicBondForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
HarmonicBondForceImpl::~HarmonicBondForceImpl() { HarmonicBondForceImpl::~HarmonicBondForceImpl() {
...@@ -66,7 +67,7 @@ void HarmonicBondForceImpl::initialize(ContextImpl& context) { ...@@ -66,7 +67,7 @@ void HarmonicBondForceImpl::initialize(ContextImpl& context) {
} }
double HarmonicBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double HarmonicBondForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcHarmonicBondForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcHarmonicBondForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
...@@ -46,6 +46,11 @@ using namespace OpenMM; ...@@ -46,6 +46,11 @@ using namespace OpenMM;
using namespace std; using namespace std;
NonbondedForceImpl::NonbondedForceImpl(const NonbondedForce& owner) : owner(owner) { NonbondedForceImpl::NonbondedForceImpl(const NonbondedForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
recipForceGroup = owner.getReciprocalSpaceForceGroup();
if (recipForceGroup < 0)
recipForceGroup = owner.getForceGroup();
includeDirectSpace = owner.getIncludeDirectSpace();
} }
NonbondedForceImpl::~NonbondedForceImpl() { NonbondedForceImpl::~NonbondedForceImpl() {
...@@ -136,11 +141,8 @@ void NonbondedForceImpl::initialize(ContextImpl& context) { ...@@ -136,11 +141,8 @@ void NonbondedForceImpl::initialize(ContextImpl& context) {
} }
double NonbondedForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double NonbondedForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
bool includeDirect = (owner.getIncludeDirectSpace() && (groups&(1<<owner.getForceGroup())) != 0); bool includeDirect = (includeDirectSpace && (groups&(1<<forceGroup)) != 0);
int reciprocalGroup = owner.getReciprocalSpaceForceGroup(); bool includeReciprocal = ((groups&(1<<recipForceGroup)) != 0);
if (reciprocalGroup < 0)
reciprocalGroup = owner.getForceGroup();
bool includeReciprocal = ((groups&(1<<reciprocalGroup)) != 0);
return kernel.getAs<CalcNonbondedForceKernel>().execute(context, includeForces, includeEnergy, includeDirect, includeReciprocal); return kernel.getAs<CalcNonbondedForceKernel>().execute(context, includeForces, includeEnergy, includeDirect, includeReciprocal);
} }
......
...@@ -39,6 +39,7 @@ using namespace OpenMM; ...@@ -39,6 +39,7 @@ using namespace OpenMM;
using namespace std; using namespace std;
PeriodicTorsionForceImpl::PeriodicTorsionForceImpl(const PeriodicTorsionForce& owner) : owner(owner) { PeriodicTorsionForceImpl::PeriodicTorsionForceImpl(const PeriodicTorsionForce& owner) : owner(owner) {
forceGroup = owner.getForceGroup();
} }
PeriodicTorsionForceImpl::~PeriodicTorsionForceImpl() { PeriodicTorsionForceImpl::~PeriodicTorsionForceImpl() {
...@@ -66,7 +67,7 @@ void PeriodicTorsionForceImpl::initialize(ContextImpl& context) { ...@@ -66,7 +67,7 @@ void PeriodicTorsionForceImpl::initialize(ContextImpl& context) {
} }
double PeriodicTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double PeriodicTorsionForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
if ((groups&(1<<owner.getForceGroup())) != 0) if ((groups&(1<<forceGroup)) != 0)
return kernel.getAs<CalcPeriodicTorsionForceKernel>().execute(context, includeForces, includeEnergy); return kernel.getAs<CalcPeriodicTorsionForceKernel>().execute(context, includeForces, includeEnergy);
return 0.0; return 0.0;
} }
......
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