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

Added updateParametersInContext() methods to most AMOEBA forces.

parent e6696626
......@@ -155,6 +155,16 @@ public:
* @param quadratic k the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/
void setAngleParameters(int index, int particle1, int particle2, int particle3, double length, double quadraticK );
/**
* Update the per-angle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setAngleParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-angle parameters. The set of particles involved
* in an angle cannot be changed, nor can new angles be added.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -127,6 +127,16 @@ public:
* @param k the quadratic force constant for the bond
*/
void setBondParameters(int index, int particle1, int particle2, double length, double quadraticK );
/**
* Update the per-bond parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setBondParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-bond parameters. The set of particles involved
* in a bond cannot be changed, nor can new bonds be added.
*/
void updateParametersInContext(Context& context);
protected:
double _globalQuarticK, _globalCubicK;
......
......@@ -152,6 +152,16 @@ public:
* Set the surface area factor kJ/(nm*nm) used in SASA contribution
*/
void setSurfaceAreaFactor( double surfaceAreaFactor );
/**
* Update the per-particle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setParticleParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-particle parameters. All other aspects of the Force
* (the probe radius, the surface area factor, etc.) are unaffected and can only be changed by reinitializing the Context.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -160,6 +160,16 @@ public:
* @param quadratic k the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/
void setAngleParameters(int index, int particle1, int particle2, int particle3, int particle4, double length, double quadraticK );
/**
* Update the per-angle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setAngleParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-angle parameters. The set of particles involved
* in an angle cannot be changed, nor can new angles be added.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -328,6 +328,18 @@ public:
quadrupole_zx, quadrupole_zy, quadrupole_zz)
*/
void getSystemMultipoleMoments(Context& context, std::vector< double >& outputMultipoleMoments);
/**
* Update the multipole parameters in a Context to match those stored in this Force object. This method
* provides an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setMultipoleParameters() to modify this object's parameters, then call updateParametersInState() to
* copy them over to the Context.
*
* This method has several limitations. The only information it updates is the parameters of multipoles.
* All other aspects of the Force (the nonbonded method, the cutoff distance, etc.) are unaffected and can only be
* changed by reinitializing the Context. Furthermore, this method cannot be used to add new multipoles,
* only to change the parameters of existing ones.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -152,6 +152,16 @@ public:
* @param k the force constant for the out-of-plane bend
*/
void setOutOfPlaneBendParameters(int index, int particle1, int particle2, int particle3, int particle4, double k);
/**
* Update the per-bend term parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setOutOfPlaneBendParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-bend term parameters. The set of particles involved
* in a term cannot be changed, nor can new terms be added.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -102,6 +102,16 @@ public:
* @param k the force constant for the torsion
*/
void setPiTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int particle5, int particle6, double k);
/**
* Update the per-torsion parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setPiTorsionParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-torsion parameters. The set of particles involved
* in a torsion cannot be changed, nor can new torsions be added.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -105,6 +105,16 @@ public:
*/
void setStretchBendParameters(int index, int particle1, int particle2, int particle3,
double lengthAB, double lengthCB, double angle, double k );
/**
* Update the per-stretch-bend term parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setStretchBendParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-stretch-bend term parameters. The set of particles involved
* in a term cannot be changed, nor can new terms be added.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -201,6 +201,16 @@ public:
* Set the method used for handling long range nonbonded interactions.
*/
void setNonbondedMethod(NonbondedMethod method);
/**
* Update the per-particle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setParticleParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-particle parameters. All other aspects of the Force
* (the nonbonded method, the cutoff distance, etc.) are unaffected and can only be changed by reinitializing the Context.
*/
void updateParametersInContext(Context& context);
protected:
ForceImpl* createImpl();
......
......@@ -88,6 +88,16 @@ public:
* @return index of added particle
*/
int addParticle(double radius, double epsilon);
/**
* Update the per-particle parameters in a Context to match those stored in this Force object. This method provides
* an efficient method to update certain parameters in an existing Context without needing to reinitialize it.
* Simply call setParticleParameters() to modify this object's parameters, then call updateParametersInState()
* to copy them over to the Context.
*
* The only information this method updates is the values of per-particle parameters. All other aspects of the Force
* are unaffected and can only be changed by reinitializing the Context.
*/
void updateParametersInContext(Context& context);
/*
* Constants
......
......@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors. *
* Portions copyright (c) 2008-2012 Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
......@@ -74,7 +74,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaBondForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaBondForce& force) = 0;
};
/**
......@@ -108,6 +114,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaAngleForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaAngleForce& force) = 0;
};
/**
......@@ -141,6 +154,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaInPlaneAngleForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaInPlaneAngleForce& force) = 0;
};
/**
......@@ -174,6 +194,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaPiTorsionForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaPiTorsionForce& force) = 0;
};
/**
......@@ -207,6 +234,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaStretchBendForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaStretchBendForce& force) = 0;
};
/**
......@@ -240,6 +274,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaOutOfPlaneBendForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaOutOfPlaneBendForce& force) = 0;
};
/**
......@@ -311,7 +352,13 @@ public:
std::vector< double >& outputElectrostaticPotential ) = 0;
virtual void getSystemMultipoleMoments( ContextImpl& context, std::vector< double >& outputMultipoleMonents ) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaMultipoleForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaMultipoleForce& force) = 0;
};
/**
......@@ -345,6 +392,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaGeneralizedKirkwoodForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaGeneralizedKirkwoodForce& force) = 0;
};
......@@ -378,6 +432,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaVdwForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaVdwForce& force) = 0;
};
/**
......@@ -411,6 +472,13 @@ public:
* @return the potential energy due to the force
*/
virtual double execute(ContextImpl& context, bool includeForces, bool includeEnergy) = 0;
/**
* Copy changed parameters over to a context.
*
* @param context the context to copy parameters to
* @param force the AmoebaWcaDispersionForce to copy the parameters from
*/
virtual void copyParametersToContext(ContextImpl& context, const AmoebaWcaDispersionForce& force) = 0;
};
} // namespace OpenMM
......
......@@ -61,6 +61,7 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
void updateParametersInContext(ContextImpl& context);
private:
AmoebaAngleForce& owner;
Kernel kernel;
......
......@@ -64,6 +64,7 @@ public:
std::vector<std::string> getKernelNames();
std::vector< std::pair<int, int> > getBondedParticles() const;
void updateParametersInContext(ContextImpl& context);
private:
AmoebaBondForce& owner;
Kernel kernel;
......
......@@ -61,6 +61,7 @@ public:
Kernel& getKernel() {
return kernel;
}
void updateParametersInContext(ContextImpl& context);
private:
AmoebaGeneralizedKirkwoodForce& owner;
Kernel kernel;
......
......@@ -61,6 +61,7 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
void updateParametersInContext(ContextImpl& context);
private:
AmoebaInPlaneAngleForce& owner;
Kernel kernel;
......
......@@ -86,6 +86,7 @@ public:
std::vector< double >& outputElectrostaticPotential );
void getSystemMultipoleMoments( ContextImpl& context, std::vector< double >& outputMultipoleMonents );
void updateParametersInContext(ContextImpl& context);
private:
......
......@@ -61,6 +61,7 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
void updateParametersInContext(ContextImpl& context);
private:
AmoebaOutOfPlaneBendForce& owner;
Kernel kernel;
......
......@@ -61,6 +61,7 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
void updateParametersInContext(ContextImpl& context);
private:
AmoebaPiTorsionForce& owner;
Kernel kernel;
......
......@@ -61,6 +61,7 @@ public:
return std::map<std::string, double>(); // This force field doesn't define any parameters.
}
std::vector<std::string> getKernelNames();
void updateParametersInContext(ContextImpl& context);
private:
AmoebaStretchBendForce& owner;
Kernel kernel;
......
......@@ -68,6 +68,7 @@ public:
* long range dispersion correction to the energy.
*/
static double calcDispersionCorrection(const System& system, const AmoebaVdwForce& force);
void updateParametersInContext(ContextImpl& context);
private:
AmoebaVdwForce& owner;
Kernel kernel;
......
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