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
44bfd168
Commit
44bfd168
authored
Jun 27, 2011
by
Peter Eastman
Browse files
Added Integrator::stateChanged()
parent
c1bdee13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
openmmapi/include/openmm/Integrator.h
openmmapi/include/openmm/Integrator.h
+12
-0
openmmapi/src/ContextImpl.cpp
openmmapi/src/ContextImpl.cpp
+4
-0
No files found.
openmmapi/include/openmm/Integrator.h
View file @
44bfd168
...
...
@@ -32,6 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "State.h"
#include "Vec3.h"
#include <map>
#include <vector>
...
...
@@ -102,6 +103,17 @@ protected:
* Get the names of all Kernels used by this Integrator.
*/
virtual
std
::
vector
<
std
::
string
>
getKernelNames
()
=
0
;
/**
* This will be called by the Context when the user modifies aspects of the context state, such
* as positions, velocities, or parameters. This gives the Integrator a chance to discard cached
* information. This is <i>only</i> called when the user modifies information using methods of the Context
* object. It is <i>not</i> called when a ForceImpl object modifies state information in its updateContextState()
* method (unless the ForceImpl calls a Context method to perform the modification).
*
* @param changed this specifies what aspect of the Context was changed
*/
virtual
void
stateChanged
(
State
::
DataType
changed
)
{
}
private:
double
stepSize
,
constraintTol
;
};
...
...
openmmapi/src/ContextImpl.cpp
View file @
44bfd168
...
...
@@ -36,6 +36,7 @@
#include "openmm/kernels.h"
#include "openmm/internal/ForceImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/State.h"
#include <map>
#include <utility>
#include <vector>
...
...
@@ -104,6 +105,7 @@ void ContextImpl::getPositions(std::vector<Vec3>& positions) {
void
ContextImpl
::
setPositions
(
const
std
::
vector
<
Vec3
>&
positions
)
{
dynamic_cast
<
UpdateStateDataKernel
&>
(
updateStateDataKernel
.
getImpl
()).
setPositions
(
*
this
,
positions
);
integrator
.
stateChanged
(
State
::
Positions
);
}
void
ContextImpl
::
getVelocities
(
std
::
vector
<
Vec3
>&
velocities
)
{
...
...
@@ -112,6 +114,7 @@ void ContextImpl::getVelocities(std::vector<Vec3>& velocities) {
void
ContextImpl
::
setVelocities
(
const
std
::
vector
<
Vec3
>&
velocities
)
{
dynamic_cast
<
UpdateStateDataKernel
&>
(
updateStateDataKernel
.
getImpl
()).
setVelocities
(
*
this
,
velocities
);
integrator
.
stateChanged
(
State
::
Velocities
);
}
void
ContextImpl
::
getForces
(
std
::
vector
<
Vec3
>&
forces
)
{
...
...
@@ -128,6 +131,7 @@ void ContextImpl::setParameter(std::string name, double value) {
if
(
parameters
.
find
(
name
)
==
parameters
.
end
())
throw
OpenMMException
(
"Called setParameter() with invalid parameter name"
);
parameters
[
name
]
=
value
;
integrator
.
stateChanged
(
State
::
Parameters
);
}
void
ContextImpl
::
getPeriodicBoxVectors
(
Vec3
&
a
,
Vec3
&
b
,
Vec3
&
c
)
{
...
...
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