Skip to content

Commit 0eb5bc0

Browse files
authored
Made getCollectiveVariableValues() const (openmm#3599)
1 parent e9b8b6a commit 0eb5bc0

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

openmmapi/include/openmm/CustomCVForce.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class OPENMM_EXPORT CustomCVForce : public Force {
238238
* @param[out] values the values of the collective variables are computed and
239239
* stored into this
240240
*/
241-
void getCollectiveVariableValues(Context& context, std::vector<double>& values);
241+
void getCollectiveVariableValues(Context& context, std::vector<double>& values) const;
242242
/**
243243
* Get the inner Context used for evaluating collective variables.
244244
*

openmmapi/include/openmm/Force.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ class OPENMM_EXPORT Force {
108108
/**
109109
* Get the ForceImpl corresponding to this Force in a Context.
110110
*/
111-
ForceImpl& getImplInContext(Context& context);
111+
ForceImpl& getImplInContext(Context& context) const;
112112
/**
113113
* Get a const reference to the ForceImpl corresponding to this Force in a Context.
114114
*/
115115
const ForceImpl& getImplInContext(const Context& context) const;
116116
/**
117117
* Get the ContextImpl corresponding to a Context.
118118
*/
119-
ContextImpl& getContextImpl(Context& context);
119+
ContextImpl& getContextImpl(Context& context) const;
120120
private:
121121
int forceGroup;
122122
std::string name;

openmmapi/include/openmm/internal/ForceImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class OPENMM_EXPORT ForceImpl {
116116
/**
117117
* Get the ContextImpl corresponding to a Context.
118118
*/
119-
ContextImpl& getContextImpl(Context& context) {
119+
ContextImpl& getContextImpl(Context& context) const {
120120
return context.getImpl();
121121
}
122122
};

openmmapi/src/CustomCVForce.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const string& CustomCVForce::getTabulatedFunctionName(int index) const {
140140
return functions[index].name;
141141
}
142142

143-
void CustomCVForce::getCollectiveVariableValues(Context& context, vector<double>& values) {
143+
void CustomCVForce::getCollectiveVariableValues(Context& context, vector<double>& values) const {
144144
dynamic_cast<CustomCVForceImpl&>(getImplInContext(context)).getCollectiveVariableValues(getContextImpl(context), values);
145145
}
146146

openmmapi/src/Force.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool Force::usesPeriodicBoundaryConditions() const {
7676
throw OpenMMException("usesPeriodicBoundaryConditions is not implemented");
7777
}
7878

79-
ForceImpl& Force::getImplInContext(Context& context) {
79+
ForceImpl& Force::getImplInContext(Context& context) const {
8080
for (auto impl : context.getImpl().getForceImpls())
8181
if (&impl->getOwner() == this)
8282
return *impl;
@@ -90,6 +90,6 @@ const ForceImpl& Force::getImplInContext(const Context& context) const {
9090
throw OpenMMException("getImplInContext: This Force is not present in the Context");
9191
}
9292

93-
ContextImpl& Force::getContextImpl(Context& context) {
93+
ContextImpl& Force::getContextImpl(Context& context) const {
9494
return context.getImpl();
9595
}

0 commit comments

Comments
 (0)