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
fa0fb1dd
Commit
fa0fb1dd
authored
Jul 16, 2025
by
Evan Pretti
Browse files
Track initialization with explicit flag
parent
2abeb801
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
platforms/reference/include/ReferenceCustomDynamics.h
platforms/reference/include/ReferenceCustomDynamics.h
+1
-0
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
.../reference/src/SimTKReference/ReferenceCustomDynamics.cpp
+5
-3
No files found.
platforms/reference/include/ReferenceCustomDynamics.h
View file @
fa0fb1dd
...
@@ -43,6 +43,7 @@ class ReferenceCustomDynamics : public ReferenceDynamics {
...
@@ -43,6 +43,7 @@ class ReferenceCustomDynamics : public ReferenceDynamics {
private:
private:
class
DerivFunction
;
class
DerivFunction
;
bool
initialized
;
const
OpenMM
::
CustomIntegrator
&
integrator
;
const
OpenMM
::
CustomIntegrator
&
integrator
;
std
::
vector
<
double
>
inverseMasses
;
std
::
vector
<
double
>
inverseMasses
;
std
::
vector
<
OpenMM
::
Vec3
>
sumBuffer
,
oldPos
;
std
::
vector
<
OpenMM
::
Vec3
>
sumBuffer
,
oldPos
;
...
...
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
View file @
fa0fb1dd
...
@@ -84,7 +84,7 @@ static bool isVectorExpression(const ExpressionTreeNode& node) {
...
@@ -84,7 +84,7 @@ static bool isVectorExpression(const ExpressionTreeNode& node) {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
ReferenceCustomDynamics
::
ReferenceCustomDynamics
(
int
numberOfAtoms
,
const
CustomIntegrator
&
integrator
)
:
ReferenceCustomDynamics
::
ReferenceCustomDynamics
(
int
numberOfAtoms
,
const
CustomIntegrator
&
integrator
)
:
ReferenceDynamics
(
numberOfAtoms
,
integrator
.
getStepSize
(),
0.0
),
integrator
(
integrator
)
{
ReferenceDynamics
(
numberOfAtoms
,
integrator
.
getStepSize
(),
0.0
),
initialized
(
false
),
integrator
(
integrator
)
{
sumBuffer
.
resize
(
numberOfAtoms
);
sumBuffer
.
resize
(
numberOfAtoms
);
oldPos
.
resize
(
numberOfAtoms
);
oldPos
.
resize
(
numberOfAtoms
);
stepType
.
resize
(
integrator
.
getNumComputations
());
stepType
.
resize
(
integrator
.
getNumComputations
());
...
@@ -195,6 +195,8 @@ void ReferenceCustomDynamics::initialize(ContextImpl& context, vector<double>& m
...
@@ -195,6 +195,8 @@ void ReferenceCustomDynamics::initialize(ContextImpl& context, vector<double>& m
perDofVariableIndex
.
push_back
(
expressionSet
.
getVariableIndex
(
integrator
.
getPerDofVariableName
(
i
)));
perDofVariableIndex
.
push_back
(
expressionSet
.
getVariableIndex
(
integrator
.
getPerDofVariableName
(
i
)));
for
(
int
i
=
0
;
i
<
stepVariable
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
stepVariable
.
size
();
i
++
)
stepVariableIndex
.
push_back
(
expressionSet
.
getVariableIndex
(
stepVariable
[
i
]));
stepVariableIndex
.
push_back
(
expressionSet
.
getVariableIndex
(
stepVariable
[
i
]));
initialized
=
true
;
}
}
ExpressionTreeNode
ReferenceCustomDynamics
::
replaceDerivFunctions
(
const
ExpressionTreeNode
&
node
,
ContextImpl
&
context
)
{
ExpressionTreeNode
ReferenceCustomDynamics
::
replaceDerivFunctions
(
const
ExpressionTreeNode
&
node
,
ContextImpl
&
context
)
{
...
@@ -232,7 +234,7 @@ ExpressionTreeNode ReferenceCustomDynamics::replaceDerivFunctions(const Expressi
...
@@ -232,7 +234,7 @@ ExpressionTreeNode ReferenceCustomDynamics::replaceDerivFunctions(const Expressi
void
ReferenceCustomDynamics
::
update
(
ContextImpl
&
context
,
int
numberOfAtoms
,
vector
<
Vec3
>&
atomCoordinates
,
void
ReferenceCustomDynamics
::
update
(
ContextImpl
&
context
,
int
numberOfAtoms
,
vector
<
Vec3
>&
atomCoordinates
,
vector
<
Vec3
>&
velocities
,
vector
<
Vec3
>&
forces
,
vector
<
double
>&
masses
,
vector
<
Vec3
>&
velocities
,
vector
<
Vec3
>&
forces
,
vector
<
double
>&
masses
,
map
<
string
,
double
>&
globals
,
vector
<
vector
<
Vec3
>
>&
perDof
,
bool
&
forcesAreValid
,
double
tolerance
)
{
map
<
string
,
double
>&
globals
,
vector
<
vector
<
Vec3
>
>&
perDof
,
bool
&
forcesAreValid
,
double
tolerance
)
{
if
(
in
validatesForces
.
size
()
==
0
)
if
(
!
in
itialized
)
initialize
(
context
,
masses
,
globals
);
initialize
(
context
,
masses
,
globals
);
int
numSteps
=
stepType
.
size
();
int
numSteps
=
stepType
.
size
();
globals
.
insert
(
context
.
getParameters
().
begin
(),
context
.
getParameters
().
end
());
globals
.
insert
(
context
.
getParameters
().
begin
(),
context
.
getParameters
().
end
());
...
@@ -458,7 +460,7 @@ void ReferenceCustomDynamics::recordChangedParameters(OpenMM::ContextImpl& conte
...
@@ -458,7 +460,7 @@ void ReferenceCustomDynamics::recordChangedParameters(OpenMM::ContextImpl& conte
double
ReferenceCustomDynamics
::
computeKineticEnergy
(
OpenMM
::
ContextImpl
&
context
,
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
ReferenceCustomDynamics
::
computeKineticEnergy
(
OpenMM
::
ContextImpl
&
context
,
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec3
>&
velocities
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
masses
,
std
::
vector
<
OpenMM
::
Vec3
>&
velocities
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
masses
,
std
::
map
<
std
::
string
,
double
>&
globals
,
std
::
vector
<
std
::
vector
<
OpenMM
::
Vec3
>
>&
perDof
,
bool
&
forcesAreValid
)
{
std
::
map
<
std
::
string
,
double
>&
globals
,
std
::
vector
<
std
::
vector
<
OpenMM
::
Vec3
>
>&
perDof
,
bool
&
forcesAreValid
)
{
if
(
in
validatesForces
.
size
()
==
0
)
if
(
!
in
itialized
)
initialize
(
context
,
masses
,
globals
);
initialize
(
context
,
masses
,
globals
);
globals
.
insert
(
context
.
getParameters
().
begin
(),
context
.
getParameters
().
end
());
globals
.
insert
(
context
.
getParameters
().
begin
(),
context
.
getParameters
().
end
());
for
(
auto
&
global
:
globals
)
for
(
auto
&
global
:
globals
)
...
...
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