Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
4bc723ab
Commit
4bc723ab
authored
Jun 06, 2012
by
Peter Eastman
Browse files
Implemented updateParametersInContext() for seven more Force classes
parent
b5e2a951
Changes
51
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
155 additions
and
10 deletions
+155
-10
olla/include/openmm/kernels.h
olla/include/openmm/kernels.h
+50
-1
openmmapi/include/openmm/CustomAngleForce.h
openmmapi/include/openmm/CustomAngleForce.h
+12
-1
openmmapi/include/openmm/CustomBondForce.h
openmmapi/include/openmm/CustomBondForce.h
+12
-1
openmmapi/include/openmm/CustomTorsionForce.h
openmmapi/include/openmm/CustomTorsionForce.h
+12
-1
openmmapi/include/openmm/HarmonicAngleForce.h
openmmapi/include/openmm/HarmonicAngleForce.h
+11
-1
openmmapi/include/openmm/HarmonicBondForce.h
openmmapi/include/openmm/HarmonicBondForce.h
+11
-1
openmmapi/include/openmm/PeriodicTorsionForce.h
openmmapi/include/openmm/PeriodicTorsionForce.h
+11
-1
openmmapi/include/openmm/RBTorsionForce.h
openmmapi/include/openmm/RBTorsionForce.h
+11
-1
openmmapi/include/openmm/internal/CustomAngleForceImpl.h
openmmapi/include/openmm/internal/CustomAngleForceImpl.h
+1
-0
openmmapi/include/openmm/internal/CustomBondForceImpl.h
openmmapi/include/openmm/internal/CustomBondForceImpl.h
+1
-0
openmmapi/include/openmm/internal/CustomTorsionForceImpl.h
openmmapi/include/openmm/internal/CustomTorsionForceImpl.h
+1
-0
openmmapi/include/openmm/internal/HarmonicAngleForceImpl.h
openmmapi/include/openmm/internal/HarmonicAngleForceImpl.h
+1
-0
openmmapi/include/openmm/internal/HarmonicBondForceImpl.h
openmmapi/include/openmm/internal/HarmonicBondForceImpl.h
+1
-0
openmmapi/include/openmm/internal/PeriodicTorsionForceImpl.h
openmmapi/include/openmm/internal/PeriodicTorsionForceImpl.h
+1
-0
openmmapi/include/openmm/internal/RBTorsionForceImpl.h
openmmapi/include/openmm/internal/RBTorsionForceImpl.h
+1
-0
openmmapi/src/CustomAngleForce.cpp
openmmapi/src/CustomAngleForce.cpp
+3
-0
openmmapi/src/CustomAngleForceImpl.cpp
openmmapi/src/CustomAngleForceImpl.cpp
+4
-1
openmmapi/src/CustomBondForce.cpp
openmmapi/src/CustomBondForce.cpp
+3
-0
openmmapi/src/CustomBondForceImpl.cpp
openmmapi/src/CustomBondForceImpl.cpp
+5
-1
openmmapi/src/CustomTorsionForce.cpp
openmmapi/src/CustomTorsionForce.cpp
+3
-0
No files found.
olla/include/openmm/kernels.h
View file @
4bc723ab
...
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -274,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 HarmonicBondForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
HarmonicBondForce
&
force
)
=
0
;
};
/**
...
...
@@ -302,6 +309,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 CustomBondForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
CustomBondForce
&
force
)
=
0
;
};
/**
...
...
@@ -330,6 +344,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 HarmonicAngleForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
HarmonicAngleForce
&
force
)
=
0
;
};
/**
...
...
@@ -358,6 +379,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 CustomAngleForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
CustomAngleForce
&
force
)
=
0
;
};
/**
...
...
@@ -386,6 +414,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 PeriodicTorsionForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
PeriodicTorsionForce
&
force
)
=
0
;
};
/**
...
...
@@ -414,6 +449,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 RBTorsionForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
RBTorsionForce
&
force
)
=
0
;
};
/**
...
...
@@ -470,6 +512,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 CustomTorsionForce to copy the parameters from
*/
virtual
void
copyParametersToContext
(
ContextImpl
&
context
,
const
CustomTorsionForce
&
force
)
=
0
;
};
/**
...
...
openmmapi/include/openmm/CustomAngleForce.h
View file @
4bc723ab
...
...
@@ -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) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2012
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -190,6 +190,17 @@ public:
* @param parameters the list of parameters for the angle
*/
void
setAngleParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
const
std
::
vector
<
double
>&
parameters
);
/**
* 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.
*
* This method has several limitations. The only information it updates is the values of per-angle parameters.
* All other aspects of the Force (such as the energy function) are unaffected and can only be changed by reinitializing
* the Context. The set of particles involved in a angle cannot be changed, nor can new angles be added.
*/
void
updateParametersInContext
(
Context
&
context
);
protected:
ForceImpl
*
createImpl
();
private:
...
...
openmmapi/include/openmm/CustomBondForce.h
View file @
4bc723ab
...
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -187,6 +187,17 @@ public:
* @param parameters the list of parameters for the bond
*/
void
setBondParameters
(
int
index
,
int
particle1
,
int
particle2
,
const
std
::
vector
<
double
>&
parameters
);
/**
* 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.
*
* This method has several limitations. The only information it updates is the values of per-bond parameters.
* All other aspects of the Force (such as the energy function) are unaffected and can only be changed by reinitializing
* the Context. The set of particles involved in a bond cannot be changed, nor can new bonds be added.
*/
void
updateParametersInContext
(
Context
&
context
);
protected:
ForceImpl
*
createImpl
();
private:
...
...
openmmapi/include/openmm/CustomTorsionForce.h
View file @
4bc723ab
...
...
@@ -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) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2012
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -193,6 +193,17 @@ public:
* @param parameters the list of parameters for the torsion
*/
void
setTorsionParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
const
std
::
vector
<
double
>&
parameters
);
/**
* 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 setTorsionParameters() 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 values of per-torsion parameters.
* All other aspects of the Force (such as the energy function) are unaffected and can only be changed by reinitializing
* the Context. The set of particles involved in a torsion cannot be changed, nor can new torsions be added.
*/
void
updateParametersInContext
(
Context
&
context
);
protected:
ForceImpl
*
createImpl
();
private:
...
...
openmmapi/include/openmm/HarmonicAngleForce.h
View file @
4bc723ab
...
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -91,6 +91,16 @@ public:
* @param k the harmonic force constant for the angle, measured in kJ/mol/radian^2
*/
void
setAngleParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
double
angle
,
double
k
);
/**
* 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 a angle cannot be changed, nor can new angles be added.
*/
void
updateParametersInContext
(
Context
&
context
);
protected:
ForceImpl
*
createImpl
();
private:
...
...
openmmapi/include/openmm/HarmonicBondForce.h
View file @
4bc723ab
...
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -88,6 +88,16 @@ public:
* @param k the harmonic force constant for the bond, measured in kJ/mol/nm^2
*/
void
setBondParameters
(
int
index
,
int
particle1
,
int
particle2
,
double
length
,
double
k
);
/**
* 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:
ForceImpl
*
createImpl
();
private:
...
...
openmmapi/include/openmm/PeriodicTorsionForce.h
View file @
4bc723ab
...
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -97,6 +97,16 @@ public:
* @param k the force constant for the torsion
*/
void
setTorsionParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
int
periodicity
,
double
phase
,
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 setTorsionParameters() 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
();
private:
...
...
openmmapi/include/openmm/RBTorsionForce.h
View file @
4bc723ab
...
...
@@ -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-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -106,6 +106,16 @@ public:
* @param c5 the coefficient of the 5th order term, measured in kJ/mol
*/
void
setTorsionParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
double
c0
,
double
c1
,
double
c2
,
double
c3
,
double
c4
,
double
c5
);
/**
* 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 setTorsionParameters() 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
();
private:
...
...
openmmapi/include/openmm/internal/CustomAngleForceImpl.h
View file @
4bc723ab
...
...
@@ -59,6 +59,7 @@ public:
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
();
std
::
vector
<
std
::
string
>
getKernelNames
();
void
updateParametersInContext
(
ContextImpl
&
context
);
private:
CustomAngleForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/include/openmm/internal/CustomBondForceImpl.h
View file @
4bc723ab
...
...
@@ -60,6 +60,7 @@ public:
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
();
std
::
vector
<
std
::
string
>
getKernelNames
();
std
::
vector
<
std
::
pair
<
int
,
int
>
>
getBondedParticles
()
const
;
void
updateParametersInContext
(
ContextImpl
&
context
);
private:
CustomBondForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/include/openmm/internal/CustomTorsionForceImpl.h
View file @
4bc723ab
...
...
@@ -59,6 +59,7 @@ public:
double
calcForcesAndEnergy
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
,
int
groups
);
std
::
map
<
std
::
string
,
double
>
getDefaultParameters
();
std
::
vector
<
std
::
string
>
getKernelNames
();
void
updateParametersInContext
(
ContextImpl
&
context
);
private:
CustomTorsionForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/include/openmm/internal/HarmonicAngleForceImpl.h
View file @
4bc723ab
...
...
@@ -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:
HarmonicAngleForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/include/openmm/internal/HarmonicBondForceImpl.h
View file @
4bc723ab
...
...
@@ -62,6 +62,7 @@ public:
}
std
::
vector
<
std
::
string
>
getKernelNames
();
std
::
vector
<
std
::
pair
<
int
,
int
>
>
getBondedParticles
()
const
;
void
updateParametersInContext
(
ContextImpl
&
context
);
private:
HarmonicBondForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/include/openmm/internal/PeriodicTorsionForceImpl.h
View file @
4bc723ab
...
...
@@ -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:
PeriodicTorsionForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/include/openmm/internal/RBTorsionForceImpl.h
View file @
4bc723ab
...
...
@@ -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:
RBTorsionForce
&
owner
;
Kernel
kernel
;
...
...
openmmapi/src/CustomAngleForce.cpp
View file @
4bc723ab
...
...
@@ -120,3 +120,6 @@ ForceImpl* CustomAngleForce::createImpl() {
return
new
CustomAngleForceImpl
(
*
this
);
}
void
CustomAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
CustomAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
openmmapi/src/CustomAngleForceImpl.cpp
View file @
4bc723ab
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010 Stanford University and the Authors.
*
* Portions copyright (c) 2010
-2012
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -107,3 +107,6 @@ map<string, double> CustomAngleForceImpl::getDefaultParameters() {
return
parameters
;
}
void
CustomAngleForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
kernel
.
getAs
<
CalcCustomAngleForceKernel
>
().
copyParametersToContext
(
context
,
owner
);
}
openmmapi/src/CustomBondForce.cpp
View file @
4bc723ab
...
...
@@ -118,3 +118,6 @@ ForceImpl* CustomBondForce::createImpl() {
return
new
CustomBondForceImpl
(
*
this
);
}
void
CustomBondForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
CustomBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
openmmapi/src/CustomBondForceImpl.cpp
View file @
4bc723ab
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
12
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -110,3 +110,7 @@ vector<pair<int, int> > CustomBondForceImpl::getBondedParticles() const {
}
return
bonds
;
}
void
CustomBondForceImpl
::
updateParametersInContext
(
ContextImpl
&
context
)
{
kernel
.
getAs
<
CalcCustomBondForceKernel
>
().
copyParametersToContext
(
context
,
owner
);
}
openmmapi/src/CustomTorsionForce.cpp
View file @
4bc723ab
...
...
@@ -122,3 +122,6 @@ ForceImpl* CustomTorsionForce::createImpl() {
return
new
CustomTorsionForceImpl
(
*
this
);
}
void
CustomTorsionForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
CustomTorsionForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment