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
1b705ba9
"...amoeba/platforms/cuda-old/src/AmoebaCudaKernelFactory.cpp" did not exist on "077a93c8e715650f5501a9c10f07c1183fadbef1"
Commit
1b705ba9
authored
Jun 23, 2009
by
Peter Eastman
Browse files
Minor cleanups to VariableVerletIntegrator
parent
09786e4b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
22 deletions
+21
-22
openmmapi/include/openmm/VariableVerletIntegrator.h
openmmapi/include/openmm/VariableVerletIntegrator.h
+12
-12
openmmapi/src/VariableVerletIntegrator.cpp
openmmapi/src/VariableVerletIntegrator.cpp
+1
-1
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+4
-4
platforms/reference/src/ReferenceKernels.h
platforms/reference/src/ReferenceKernels.h
+1
-1
platforms/reference/src/SimTKReference/ReferenceVariableVerletDynamics.cpp
...ce/src/SimTKReference/ReferenceVariableVerletDynamics.cpp
+2
-3
platforms/reference/src/SimTKReference/ReferenceVariableVerletDynamics.h
...ence/src/SimTKReference/ReferenceVariableVerletDynamics.h
+1
-1
No files found.
openmmapi/include/openmm/VariableVerletIntegrator.h
View file @
1b705ba9
...
...
@@ -46,9 +46,9 @@ namespace OpenMM {
* specified tolerance. This allows it to take larger steps on average than a fixed step size
* integrator, while still maintaining comparable accuracy and stability.
*
* It is best not to think of the
value of the accuracy parameter
as having any absolute meaning.
*
It is just an
adjustable parameter that affects the step size and integration accuracy. You
* should try different values to find the largest
value
that produces a trajectory sufficiently
* It is best not to think of the
error tolerance
as having any absolute meaning.
It is just an
* adjustable parameter that affects the step size and integration accuracy. You
* should try different values to find the largest
one
that produces a trajectory sufficiently
* accurate for your purposes. 0.001 is often a good starting point.
*
* Unlike a fixed step size Verlet integrator, variable step size Verlet is not symplectic. This
...
...
@@ -64,20 +64,20 @@ public:
* Create a VariableVerletIntegrator.
*
* @param stepSize the initial step size to use (in picoseconds)
* @param
accuracy the required accuracy
* @param
tol the error tolerance
*/
VariableVerletIntegrator
(
double
stepSize
,
double
accuracy
);
VariableVerletIntegrator
(
double
stepSize
,
double
errorTol
);
/**
* Get the
required accuracy
.
* Get the
error tolerance
.
*/
double
get
Accuracy
()
const
{
return
accuracy
;
double
get
ErrorTolerance
()
const
{
return
errorTol
;
}
/**
* Set the
required accuracy
.
* Set the
error tolerance
.
*/
void
set
Accuracy
(
double
acc
)
{
accuracy
=
acc
;
void
set
ErrorTolerance
(
double
tol
)
{
errorTol
=
tol
;
}
/**
* Advance a simulation through time by taking a series of time steps.
...
...
@@ -97,7 +97,7 @@ protected:
*/
std
::
vector
<
std
::
string
>
getKernelNames
();
private:
double
accuracy
;
double
errorTol
;
OpenMMContextImpl
*
context
;
Kernel
kernel
;
};
...
...
openmmapi/src/VariableVerletIntegrator.cpp
View file @
1b705ba9
...
...
@@ -39,7 +39,7 @@ using namespace OpenMM;
using
std
::
string
;
using
std
::
vector
;
VariableVerletIntegrator
::
VariableVerletIntegrator
(
double
stepSize
,
double
accuracy
)
:
accuracy
(
accuracy
)
{
VariableVerletIntegrator
::
VariableVerletIntegrator
(
double
stepSize
,
double
errorTol
)
:
errorTol
(
errorTol
)
{
setStepSize
(
stepSize
);
setConstraintTolerance
(
1e-4
);
}
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
1b705ba9
...
...
@@ -803,24 +803,24 @@ void ReferenceIntegrateVariableVerletStepKernel::initialize(const System& system
void
ReferenceIntegrateVariableVerletStepKernel
::
execute
(
OpenMMContextImpl
&
context
,
const
VariableVerletIntegrator
&
integrator
)
{
double
stepSize
=
integrator
.
getStepSize
();
double
accuracy
=
integrator
.
get
Accuracy
();
double
errorTol
=
integrator
.
get
ErrorTolerance
();
RealOpenMM
**
posData
=
((
ReferenceFloatStreamImpl
&
)
context
.
getPositions
().
getImpl
()).
getData
();
RealOpenMM
**
velData
=
((
ReferenceFloatStreamImpl
&
)
context
.
getVelocities
().
getImpl
()).
getData
();
RealOpenMM
**
forceData
=
const_cast
<
RealOpenMM
**>
(((
ReferenceFloatStreamImpl
&
)
context
.
getForces
().
getImpl
()).
getData
());
// Reference code needs to be made const correct
if
(
dynamics
==
0
||
stepSize
!=
prevStepSize
||
accuracy
!=
prevAccuracy
)
{
if
(
dynamics
==
0
||
stepSize
!=
prevStepSize
||
errorTol
!=
prevErrorTol
)
{
// Recreate the computation objects with the new parameters.
if
(
dynamics
)
{
delete
dynamics
;
delete
constraints
;
}
dynamics
=
new
ReferenceVariableVerletDynamics
(
context
.
getSystem
().
getNumParticles
(),
static_cast
<
RealOpenMM
>
(
stepSize
),
accuracy
);
dynamics
=
new
ReferenceVariableVerletDynamics
(
context
.
getSystem
().
getNumParticles
(),
static_cast
<
RealOpenMM
>
(
stepSize
),
errorTol
);
vector
<
ReferenceCCMAAlgorithm
::
AngleInfo
>
angles
;
findAnglesForCCMA
(
context
.
getSystem
(),
angles
);
constraints
=
new
ReferenceCCMAAlgorithm
(
context
.
getSystem
().
getNumParticles
(),
numConstraints
,
constraintIndices
,
constraintDistances
,
masses
,
angles
,
(
RealOpenMM
)
integrator
.
getConstraintTolerance
());
dynamics
->
setReferenceConstraintAlgorithm
(
constraints
);
prevStepSize
=
stepSize
;
prev
Accuracy
=
accuracy
;
prev
ErrorTol
=
errorTol
;
}
dynamics
->
update
(
context
.
getSystem
().
getNumParticles
(),
posData
,
velData
,
forceData
,
masses
);
data
.
time
+=
dynamics
->
getLastStepSize
();
...
...
platforms/reference/src/ReferenceKernels.h
View file @
1b705ba9
...
...
@@ -472,7 +472,7 @@ private:
RealOpenMM
*
constraintDistances
;
int
**
constraintIndices
;
int
numConstraints
;
double
prevStepSize
,
prev
Accuracy
;
double
prevStepSize
,
prev
ErrorTol
;
};
/**
...
...
platforms/reference/src/SimTKReference/ReferenceVariableVerletDynamics.cpp
View file @
1b705ba9
...
...
@@ -167,7 +167,6 @@ int ReferenceVariableVerletDynamics::update( int numberOfAtoms, RealOpenMM** ato
// get work arrays
RealOpenMM
**
xPrime
=
get2DArrayAtIndex
(
xPrime2D
);
RealOpenMM
**
vPrime
=
get2DArrayAtIndex
(
vPrime2D
);
RealOpenMM
*
inverseMasses
=
get1DArrayAtIndex
(
InverseMasses
);
// first-time-through initialization
...
...
@@ -208,8 +207,8 @@ int ReferenceVariableVerletDynamics::update( int numberOfAtoms, RealOpenMM** ato
for
(
int
i
=
0
;
i
<
numberOfAtoms
;
++
i
)
{
for
(
int
j
=
0
;
j
<
3
;
++
j
)
{
RealOpenMM
xref
=
atomCoordinates
[
i
][
j
]
+
velocities
[
i
][
j
]
*
getDeltaT
();
vPrime
[
i
][
j
]
=
velocities
[
i
][
j
]
+
inverseMasses
[
i
]
*
forces
[
i
][
j
]
*
getDeltaT
();
xPrime
[
i
][
j
]
=
atomCoordinates
[
i
][
j
]
+
vPrime
[
i
][
j
]
*
getDeltaT
();
RealOpenMM
vPrime
=
velocities
[
i
][
j
]
+
inverseMasses
[
i
]
*
forces
[
i
][
j
]
*
getDeltaT
();
xPrime
[
i
][
j
]
=
atomCoordinates
[
i
][
j
]
+
vPrime
*
getDeltaT
();
RealOpenMM
xerror
=
xPrime
[
i
][
j
]
-
xref
;
error
+=
xerror
*
xerror
;
}
...
...
platforms/reference/src/SimTKReference/ReferenceVariableVerletDynamics.h
View file @
1b705ba9
...
...
@@ -33,7 +33,7 @@ class ReferenceVariableVerletDynamics : public ReferenceDynamics {
private:
enum
TwoDArrayIndicies
{
xPrime2D
,
vPrime2D
,
Max2DArrays
};
enum
TwoDArrayIndicies
{
xPrime2D
,
Max2DArrays
};
enum
OneDArrayIndicies
{
InverseMasses
,
Max1DArrays
};
RealOpenMM
_accuracy
,
_lastStepSize
;
...
...
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