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
da52d3ae
Commit
da52d3ae
authored
Jun 18, 2009
by
Peter Eastman
Browse files
API changes to support variable time step integrators
parent
14f17de5
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
platforms/reference/src/ReferenceKernels.h
platforms/reference/src/ReferenceKernels.h
+30
-0
platforms/reference/src/ReferencePlatform.cpp
platforms/reference/src/ReferencePlatform.cpp
+11
-0
No files found.
platforms/reference/src/ReferenceKernels.h
View file @
da52d3ae
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#include "ReferencePlatform.h"
#include "openmm/kernels.h"
#include "openmm/kernels.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
#include "SimTKReference/ReferenceNeighborList.h"
#include "SimTKReference/ReferenceNeighborList.h"
...
@@ -67,6 +68,35 @@ public:
...
@@ -67,6 +68,35 @@ public:
void
execute
(
OpenMMContextImpl
&
context
);
void
execute
(
OpenMMContextImpl
&
context
);
};
};
/**
* This kernel is invoked to get or set the current time.
*/
class
ReferenceUpdateTimeKernel
:
public
UpdateTimeKernel
{
public:
ReferenceUpdateTimeKernel
(
std
::
string
name
,
const
Platform
&
platform
,
ReferencePlatform
::
PlatformData
&
data
)
:
UpdateTimeKernel
(
name
,
platform
),
data
(
data
)
{
}
/**
* Initialize the kernel.
*
* @param system the System this kernel will be applied to
*/
void
initialize
(
const
System
&
system
);
/**
* Get the current time (in picoseconds).
*
* @param context the context in which to execute this kernel
*/
double
getTime
(
const
OpenMMContextImpl
&
context
)
const
;
/**
* Set the current time (in picoseconds).
*
* @param context the context in which to execute this kernel
*/
void
setTime
(
OpenMMContextImpl
&
context
,
double
time
);
private:
ReferencePlatform
::
PlatformData
&
data
;
};
/**
/**
* This kernel is invoked by HarmonicBondForce to calculate the forces acting on the system and the energy of the system.
* This kernel is invoked by HarmonicBondForce to calculate the forces acting on the system and the energy of the system.
*/
*/
...
...
platforms/reference/src/ReferencePlatform.cpp
View file @
da52d3ae
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "ReferencePlatform.h"
#include "ReferencePlatform.h"
#include "ReferenceKernelFactory.h"
#include "ReferenceKernelFactory.h"
#include "ReferenceKernels.h"
#include "ReferenceKernels.h"
#include "openmm/internal/OpenMMContextImpl.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
#include "SimTKUtilities/SimTKOpenMMRealType.h"
using
namespace
OpenMM
;
using
namespace
OpenMM
;
...
@@ -39,6 +40,7 @@ using namespace OpenMM;
...
@@ -39,6 +40,7 @@ using namespace OpenMM;
ReferencePlatform
::
ReferencePlatform
()
{
ReferencePlatform
::
ReferencePlatform
()
{
ReferenceKernelFactory
*
factory
=
new
ReferenceKernelFactory
();
ReferenceKernelFactory
*
factory
=
new
ReferenceKernelFactory
();
registerKernelFactory
(
InitializeForcesKernel
::
Name
(),
factory
);
registerKernelFactory
(
InitializeForcesKernel
::
Name
(),
factory
);
registerKernelFactory
(
UpdateTimeKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcHarmonicBondForceKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcHarmonicBondForceKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcHarmonicAngleForceKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcHarmonicAngleForceKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcPeriodicTorsionForceKernel
::
Name
(),
factory
);
registerKernelFactory
(
CalcPeriodicTorsionForceKernel
::
Name
(),
factory
);
...
@@ -61,3 +63,12 @@ bool ReferencePlatform::supportsDoublePrecision() const {
...
@@ -61,3 +63,12 @@ bool ReferencePlatform::supportsDoublePrecision() const {
const
StreamFactory
&
ReferencePlatform
::
getDefaultStreamFactory
()
const
{
const
StreamFactory
&
ReferencePlatform
::
getDefaultStreamFactory
()
const
{
return
defaultStreamFactory
;
return
defaultStreamFactory
;
}
}
void
ReferencePlatform
::
contextCreated
(
OpenMMContextImpl
&
context
)
const
{
context
.
setPlatformData
(
new
PlatformData
());
}
void
ReferencePlatform
::
contextDestroyed
(
OpenMMContextImpl
&
context
)
const
{
PlatformData
*
data
=
reinterpret_cast
<
PlatformData
*>
(
context
.
getPlatformData
());
delete
data
;
}
Prev
1
2
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