".github/vscode:/vscode.git/clone" did not exist on "dac35adc193cf1d02b211af87b84ae8b40d23c7f"
Commit 786bc04f authored by peastman's avatar peastman Committed by GitHub
Browse files

Merge pull request #1591 from peastman/statechanged

updateParametersInContext() causes stateChanged() to be called
parents f7935fef 599a2cda
...@@ -252,6 +252,10 @@ public: ...@@ -252,6 +252,10 @@ public:
void integratorDeleted() { void integratorDeleted() {
integratorIsDeleted = true; integratorIsDeleted = true;
} }
/**
* Notify the integrator that some aspect of the system has changed, and cached information should be discarded.
*/
void systemChanged();
/** /**
* This is the routine that actually computes the list of molecules returned by getMolecules(). Normally * This is the routine that actually computes the list of molecules returned by getMolecules(). Normally
* you should never call it. It is exposed here because the same logic is useful to other classes too. * you should never call it. It is exposed here because the same logic is useful to other classes too.
......
...@@ -158,4 +158,5 @@ void CMAPTorsionForceImpl::calcMapDerivatives(int size, const vector<double>& en ...@@ -158,4 +158,5 @@ void CMAPTorsionForceImpl::calcMapDerivatives(int size, const vector<double>& en
void CMAPTorsionForceImpl::updateParametersInContext(ContextImpl& context) { void CMAPTorsionForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCMAPTorsionForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCMAPTorsionForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -460,3 +460,7 @@ void ContextImpl::loadCheckpoint(istream& stream) { ...@@ -460,3 +460,7 @@ void ContextImpl::loadCheckpoint(istream& stream) {
updateStateDataKernel.getAs<UpdateStateDataKernel>().loadCheckpoint(*this, stream); updateStateDataKernel.getAs<UpdateStateDataKernel>().loadCheckpoint(*this, stream);
hasSetPositions = true; hasSetPositions = true;
} }
void ContextImpl::systemChanged() {
integrator.stateChanged(State::Energy);
}
...@@ -108,4 +108,5 @@ map<string, double> CustomAngleForceImpl::getDefaultParameters() { ...@@ -108,4 +108,5 @@ map<string, double> CustomAngleForceImpl::getDefaultParameters() {
void CustomAngleForceImpl::updateParametersInContext(ContextImpl& context) { void CustomAngleForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomAngleForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomAngleForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -113,4 +113,5 @@ vector<pair<int, int> > CustomBondForceImpl::getBondedParticles() const { ...@@ -113,4 +113,5 @@ vector<pair<int, int> > CustomBondForceImpl::getBondedParticles() const {
void CustomBondForceImpl::updateParametersInContext(ContextImpl& context) { void CustomBondForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomBondForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomBondForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -246,6 +246,7 @@ void CustomCentroidBondForceImpl::addBondsBetweenGroups(int group1, int group2, ...@@ -246,6 +246,7 @@ void CustomCentroidBondForceImpl::addBondsBetweenGroups(int group1, int group2,
void CustomCentroidBondForceImpl::updateParametersInContext(ContextImpl& context) { void CustomCentroidBondForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomCentroidBondForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomCentroidBondForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
void CustomCentroidBondForceImpl::computeNormalizedWeights(const CustomCentroidBondForce& force, const System& system, vector<vector<double> >& weights) { void CustomCentroidBondForceImpl::computeNormalizedWeights(const CustomCentroidBondForce& force, const System& system, vector<vector<double> >& weights) {
......
...@@ -208,4 +208,5 @@ ExpressionTreeNode CustomCompoundBondForceImpl::replaceFunctions(const Expressio ...@@ -208,4 +208,5 @@ ExpressionTreeNode CustomCompoundBondForceImpl::replaceFunctions(const Expressio
void CustomCompoundBondForceImpl::updateParametersInContext(ContextImpl& context) { void CustomCompoundBondForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomCompoundBondForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomCompoundBondForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -97,4 +97,5 @@ map<string, double> CustomExternalForceImpl::getDefaultParameters() { ...@@ -97,4 +97,5 @@ map<string, double> CustomExternalForceImpl::getDefaultParameters() {
void CustomExternalForceImpl::updateParametersInContext(ContextImpl& context) { void CustomExternalForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomExternalForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomExternalForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -126,4 +126,5 @@ map<string, double> CustomGBForceImpl::getDefaultParameters() { ...@@ -126,4 +126,5 @@ map<string, double> CustomGBForceImpl::getDefaultParameters() {
void CustomGBForceImpl::updateParametersInContext(ContextImpl& context) { void CustomGBForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomGBForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomGBForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -278,4 +278,5 @@ ExpressionTreeNode CustomHbondForceImpl::replaceFunctions(const ExpressionTreeNo ...@@ -278,4 +278,5 @@ ExpressionTreeNode CustomHbondForceImpl::replaceFunctions(const ExpressionTreeNo
void CustomHbondForceImpl::updateParametersInContext(ContextImpl& context) { void CustomHbondForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomHbondForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomHbondForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -240,6 +240,7 @@ ExpressionTreeNode CustomManyParticleForceImpl::replaceFunctions(const Expressio ...@@ -240,6 +240,7 @@ ExpressionTreeNode CustomManyParticleForceImpl::replaceFunctions(const Expressio
void CustomManyParticleForceImpl::updateParametersInContext(ContextImpl& context) { void CustomManyParticleForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomManyParticleForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomManyParticleForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
void CustomManyParticleForceImpl::buildFilterArrays(const CustomManyParticleForce& force, int& numTypes, vector<int>& particleTypes, vector<int>& orderIndex, vector<vector<int> >& particleOrder) { void CustomManyParticleForceImpl::buildFilterArrays(const CustomManyParticleForce& force, int& numTypes, vector<int>& particleTypes, vector<int>& orderIndex, vector<vector<int> >& particleOrder) {
......
...@@ -155,6 +155,7 @@ map<string, double> CustomNonbondedForceImpl::getDefaultParameters() { ...@@ -155,6 +155,7 @@ map<string, double> CustomNonbondedForceImpl::getDefaultParameters() {
void CustomNonbondedForceImpl::updateParametersInContext(ContextImpl& context) { void CustomNonbondedForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomNonbondedForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomNonbondedForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
void CustomNonbondedForceImpl::calcLongRangeCorrection(const CustomNonbondedForce& force, const Context& context, double& coefficient, vector<double>& derivatives) { void CustomNonbondedForceImpl::calcLongRangeCorrection(const CustomNonbondedForce& force, const Context& context, double& coefficient, vector<double>& derivatives) {
......
...@@ -115,4 +115,5 @@ map<string, double> CustomTorsionForceImpl::getDefaultParameters() { ...@@ -115,4 +115,5 @@ map<string, double> CustomTorsionForceImpl::getDefaultParameters() {
void CustomTorsionForceImpl::updateParametersInContext(ContextImpl& context) { void CustomTorsionForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcCustomTorsionForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcCustomTorsionForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -69,4 +69,5 @@ std::vector<std::string> GBSAOBCForceImpl::getKernelNames() { ...@@ -69,4 +69,5 @@ std::vector<std::string> GBSAOBCForceImpl::getKernelNames() {
void GBSAOBCForceImpl::updateParametersInContext(ContextImpl& context) { void GBSAOBCForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcGBSAOBCForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcGBSAOBCForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -126,4 +126,5 @@ std::vector<std::string> GayBerneForceImpl::getKernelNames() { ...@@ -126,4 +126,5 @@ std::vector<std::string> GayBerneForceImpl::getKernelNames() {
void GayBerneForceImpl::updateParametersInContext(ContextImpl& context) { void GayBerneForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcGayBerneForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcGayBerneForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -63,4 +63,5 @@ std::vector<std::string> HarmonicAngleForceImpl::getKernelNames() { ...@@ -63,4 +63,5 @@ std::vector<std::string> HarmonicAngleForceImpl::getKernelNames() {
void HarmonicAngleForceImpl::updateParametersInContext(ContextImpl& context) { void HarmonicAngleForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcHarmonicAngleForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcHarmonicAngleForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -73,4 +73,5 @@ vector<pair<int, int> > HarmonicBondForceImpl::getBondedParticles() const { ...@@ -73,4 +73,5 @@ vector<pair<int, int> > HarmonicBondForceImpl::getBondedParticles() const {
void HarmonicBondForceImpl::updateParametersInContext(ContextImpl& context) { void HarmonicBondForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcHarmonicBondForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcHarmonicBondForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -277,6 +277,7 @@ double NonbondedForceImpl::calcDispersionCorrection(const System& system, const ...@@ -277,6 +277,7 @@ double NonbondedForceImpl::calcDispersionCorrection(const System& system, const
void NonbondedForceImpl::updateParametersInContext(ContextImpl& context) { void NonbondedForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcNonbondedForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcNonbondedForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
void NonbondedForceImpl::getPMEParameters(double& alpha, int& nx, int& ny, int& nz) const { void NonbondedForceImpl::getPMEParameters(double& alpha, int& nx, int& ny, int& nz) const {
......
...@@ -63,4 +63,5 @@ std::vector<std::string> PeriodicTorsionForceImpl::getKernelNames() { ...@@ -63,4 +63,5 @@ std::vector<std::string> PeriodicTorsionForceImpl::getKernelNames() {
void PeriodicTorsionForceImpl::updateParametersInContext(ContextImpl& context) { void PeriodicTorsionForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcPeriodicTorsionForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcPeriodicTorsionForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
...@@ -63,4 +63,5 @@ std::vector<std::string> RBTorsionForceImpl::getKernelNames() { ...@@ -63,4 +63,5 @@ std::vector<std::string> RBTorsionForceImpl::getKernelNames() {
void RBTorsionForceImpl::updateParametersInContext(ContextImpl& context) { void RBTorsionForceImpl::updateParametersInContext(ContextImpl& context) {
kernel.getAs<CalcRBTorsionForceKernel>().copyParametersToContext(context, owner); kernel.getAs<CalcRBTorsionForceKernel>().copyParametersToContext(context, owner);
context.systemChanged();
} }
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