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
0d7cf997
Commit
0d7cf997
authored
Mar 18, 2016
by
peastman
Browse files
Merge pull request #1424 from peastman/blockenums
Renamed enums that caused Fortran compiler errors
parents
38f8d5f4
1647f1e9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
26 deletions
+26
-26
openmmapi/include/openmm/CustomIntegrator.h
openmmapi/include/openmm/CustomIntegrator.h
+4
-4
openmmapi/src/CustomIntegrator.cpp
openmmapi/src/CustomIntegrator.cpp
+3
-3
openmmapi/src/CustomIntegratorUtilities.cpp
openmmapi/src/CustomIntegratorUtilities.cpp
+5
-5
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+5
-5
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+5
-5
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
.../reference/src/SimTKReference/ReferenceCustomDynamics.cpp
+4
-4
No files found.
openmmapi/include/openmm/CustomIntegrator.h
View file @
0d7cf997
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2011-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2011-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -266,15 +266,15 @@ public:
...
@@ -266,15 +266,15 @@ public:
/**
/**
* Begin an "if" block.
* Begin an "if" block.
*/
*/
Begin
IfBlock
=
6
,
IfBlock
Start
=
6
,
/**
/**
* Begin a while" block.
* Begin a while" block.
*/
*/
Begin
WhileBlock
=
7
,
WhileBlock
Start
=
7
,
/**
/**
* End an "if" or "while" block.
* End an "if" or "while" block.
*/
*/
End
Block
=
8
Block
End
=
8
};
};
/**
/**
* Create a CustomIntegrator.
* Create a CustomIntegrator.
...
...
openmmapi/src/CustomIntegrator.cpp
View file @
0d7cf997
...
@@ -248,21 +248,21 @@ int CustomIntegrator::addUpdateContextState() {
...
@@ -248,21 +248,21 @@ int CustomIntegrator::addUpdateContextState() {
int
CustomIntegrator
::
beginIfBlock
(
const
string
&
expression
)
{
int
CustomIntegrator
::
beginIfBlock
(
const
string
&
expression
)
{
if
(
owner
!=
NULL
)
if
(
owner
!=
NULL
)
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
computations
.
push_back
(
ComputationInfo
(
Begin
IfBlock
,
""
,
expression
));
computations
.
push_back
(
ComputationInfo
(
IfBlock
Start
,
""
,
expression
));
return
computations
.
size
()
-
1
;
return
computations
.
size
()
-
1
;
}
}
int
CustomIntegrator
::
beginWhileBlock
(
const
string
&
expression
)
{
int
CustomIntegrator
::
beginWhileBlock
(
const
string
&
expression
)
{
if
(
owner
!=
NULL
)
if
(
owner
!=
NULL
)
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
computations
.
push_back
(
ComputationInfo
(
Begin
WhileBlock
,
""
,
expression
));
computations
.
push_back
(
ComputationInfo
(
WhileBlock
Start
,
""
,
expression
));
return
computations
.
size
()
-
1
;
return
computations
.
size
()
-
1
;
}
}
int
CustomIntegrator
::
endBlock
()
{
int
CustomIntegrator
::
endBlock
()
{
if
(
owner
!=
NULL
)
if
(
owner
!=
NULL
)
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
throw
OpenMMException
(
"The integrator cannot be modified after it is bound to a context"
);
computations
.
push_back
(
ComputationInfo
(
End
Block
,
""
,
""
));
computations
.
push_back
(
ComputationInfo
(
Block
End
,
""
,
""
));
return
computations
.
size
()
-
1
;
return
computations
.
size
()
-
1
;
}
}
...
...
openmmapi/src/CustomIntegratorUtilities.cpp
View file @
0d7cf997
...
@@ -87,7 +87,7 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
...
@@ -87,7 +87,7 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
string
expression
;
string
expression
;
integrator
.
getComputationStep
(
step
,
stepType
[
step
],
stepVariable
[
step
],
expression
);
integrator
.
getComputationStep
(
step
,
stepType
[
step
],
stepVariable
[
step
],
expression
);
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
||
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
{
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
||
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
{
// This step involves a condition.
// This step involves a condition.
string
lhs
,
rhs
;
string
lhs
,
rhs
;
...
@@ -158,9 +158,9 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
...
@@ -158,9 +158,9 @@ void CustomIntegratorUtilities::analyzeComputations(const ContextImpl& context,
vector
<
int
>
blockStart
;
vector
<
int
>
blockStart
;
blockEnd
.
resize
(
numSteps
,
-
1
);
blockEnd
.
resize
(
numSteps
,
-
1
);
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
||
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
||
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
blockStart
.
push_back
(
step
);
blockStart
.
push_back
(
step
);
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
End
Block
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Block
End
)
{
if
(
blockStart
.
size
()
==
0
)
{
if
(
blockStart
.
size
()
==
0
)
{
stringstream
error
(
"CustomIntegrator: Unexpected end of block at computation "
);
stringstream
error
(
"CustomIntegrator: Unexpected end of block at computation "
);
error
<<
step
;
error
<<
step
;
...
@@ -207,7 +207,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
...
@@ -207,7 +207,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
jumps
[
step
]
=
-
1
;
jumps
[
step
]
=
-
1
;
step
=
nextStep
;
step
=
nextStep
;
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
)
{
// Consider skipping the block.
// Consider skipping the block.
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
...
@@ -216,7 +216,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
...
@@ -216,7 +216,7 @@ void CustomIntegratorUtilities::enumeratePaths(int firstStep, vector<int> steps,
step
++
;
step
++
;
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
&&
jumps
[
step
]
!=
-
2
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
&&
jumps
[
step
]
!=
-
2
)
{
// Consider skipping the block.
// Consider skipping the block.
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
enumeratePaths
(
blockEnd
[
step
]
+
1
,
steps
,
jumps
,
blockEnd
,
stepType
,
needsForces
,
needsEnergy
,
invalidatesForces
,
forceGroup
,
computeBoth
);
...
...
platforms/cuda/src/CudaKernels.cpp
View file @
0d7cf997
...
@@ -6236,9 +6236,9 @@ void CudaIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context,
...
@@ -6236,9 +6236,9 @@ void CudaIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context,
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
for
(
int
step
=
0
;
step
<
numSteps
;
step
++
)
{
string
expr
;
string
expr
;
integrator
.
getComputationStep
(
step
,
stepType
[
step
],
variable
[
step
],
expr
);
integrator
.
getComputationStep
(
step
,
stepType
[
step
],
variable
[
step
],
expr
);
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
if
(
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
blockEnd
[
blockEnd
[
step
]]
=
step
;
// Record where to branch back to.
blockEnd
[
blockEnd
[
step
]]
=
step
;
// Record where to branch back to.
if
(
stepType
[
step
]
==
CustomIntegrator
::
ComputeGlobal
||
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
||
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
if
(
stepType
[
step
]
==
CustomIntegrator
::
ComputeGlobal
||
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
||
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
for
(
int
i
=
0
;
i
<
(
int
)
expression
[
step
].
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
expression
[
step
].
size
();
i
++
)
globalExpressions
[
step
].
push_back
(
expression
[
step
][
i
].
createCompiledExpression
());
globalExpressions
[
step
].
push_back
(
expression
[
step
][
i
].
createCompiledExpression
());
}
}
...
@@ -6685,15 +6685,15 @@ void CudaIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegrat
...
@@ -6685,15 +6685,15 @@ void CudaIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegrat
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
ConstrainVelocities
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
ConstrainVelocities
)
{
cu
.
getIntegrationUtilities
().
applyVelocityConstraints
(
integrator
.
getConstraintTolerance
());
cu
.
getIntegrationUtilities
().
applyVelocityConstraints
(
integrator
.
getConstraintTolerance
());
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
IfBlock
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
IfBlock
Start
)
{
if
(
!
evaluateCondition
(
step
))
if
(
!
evaluateCondition
(
step
))
nextStep
=
blockEnd
[
step
]
+
1
;
nextStep
=
blockEnd
[
step
]
+
1
;
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Begin
WhileBlock
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
WhileBlock
Start
)
{
if
(
!
evaluateCondition
(
step
))
if
(
!
evaluateCondition
(
step
))
nextStep
=
blockEnd
[
step
]
+
1
;
nextStep
=
blockEnd
[
step
]
+
1
;
}
}
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
End
Block
)
{
else
if
(
stepType
[
step
]
==
CustomIntegrator
::
Block
End
)
{
if
(
blockEnd
[
step
]
!=
-
1
)
if
(
blockEnd
[
step
]
!=
-
1
)
nextStep
=
blockEnd
[
step
];
// Return to the start of a while block.
nextStep
=
blockEnd
[
step
];
// Return to the start of a while block.
}
}
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
0d7cf997
...
@@ -6513,9 +6513,9 @@ void OpenCLIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context
...
@@ -6513,9 +6513,9 @@ void OpenCLIntegrateCustomStepKernel::prepareForComputation(ContextImpl& context
for (int step = 0; step < numSteps; step++) {
for (int step = 0; step < numSteps; step++) {
string expr;
string expr;
integrator.getComputationStep(step, stepType[step], variable[step], expr);
integrator.getComputationStep(step, stepType[step], variable[step], expr);
if (stepType[step] == CustomIntegrator::
Begin
WhileBlock)
if (stepType[step] == CustomIntegrator::WhileBlock
Start
)
blockEnd[blockEnd[step]] = step; // Record where to branch back to.
blockEnd[blockEnd[step]] = step; // Record where to branch back to.
if (stepType[step] == CustomIntegrator::ComputeGlobal || stepType[step] == CustomIntegrator::
Begin
IfBlock || stepType[step] == CustomIntegrator::
Begin
WhileBlock)
if (stepType[step] == CustomIntegrator::ComputeGlobal || stepType[step] == CustomIntegrator::IfBlock
Start
|| stepType[step] == CustomIntegrator::WhileBlock
Start
)
for (int i = 0; i < (int) expression[step].size(); i++)
for (int i = 0; i < (int) expression[step].size(); i++)
globalExpressions[step].push_back(expression[step][i].createCompiledExpression());
globalExpressions[step].push_back(expression[step][i].createCompiledExpression());
}
}
...
@@ -6961,15 +6961,15 @@ void OpenCLIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
...
@@ -6961,15 +6961,15 @@ void OpenCLIntegrateCustomStepKernel::execute(ContextImpl& context, CustomIntegr
else if (stepType[step] == CustomIntegrator::ConstrainVelocities) {
else if (stepType[step] == CustomIntegrator::ConstrainVelocities) {
cl.getIntegrationUtilities().applyVelocityConstraints(integrator.getConstraintTolerance());
cl.getIntegrationUtilities().applyVelocityConstraints(integrator.getConstraintTolerance());
}
}
else if (stepType[step] == CustomIntegrator::
Begin
IfBlock) {
else if (stepType[step] == CustomIntegrator::IfBlock
Start
) {
if (!evaluateCondition(step))
if (!evaluateCondition(step))
nextStep = blockEnd[step]+1;
nextStep = blockEnd[step]+1;
}
}
else if (stepType[step] == CustomIntegrator::
Begin
WhileBlock) {
else if (stepType[step] == CustomIntegrator::WhileBlock
Start
) {
if (!evaluateCondition(step))
if (!evaluateCondition(step))
nextStep = blockEnd[step]+1;
nextStep = blockEnd[step]+1;
}
}
else if (stepType[step] == CustomIntegrator::
End
Block) {
else if (stepType[step] == CustomIntegrator::Block
End
) {
if (blockEnd[step] != -1)
if (blockEnd[step] != -1)
nextStep = blockEnd[step]; // Return to the start of a while block.
nextStep = blockEnd[step]; // Return to the start of a while block.
}
}
...
...
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
View file @
0d7cf997
...
@@ -107,7 +107,7 @@ void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, ve
...
@@ -107,7 +107,7 @@ void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, ve
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
{
for
(
int
j
=
0
;
j
<
(
int
)
expressions
[
i
].
size
();
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
expressions
[
i
].
size
();
j
++
)
stepExpressions
[
i
].
push_back
(
expressions
[
i
][
j
].
createProgram
());
stepExpressions
[
i
].
push_back
(
expressions
[
i
][
j
].
createProgram
());
if
(
stepType
[
i
]
==
CustomIntegrator
::
Begin
WhileBlock
)
if
(
stepType
[
i
]
==
CustomIntegrator
::
WhileBlock
Start
)
blockEnd
[
blockEnd
[
i
]]
=
i
;
// Record where to branch back to.
blockEnd
[
blockEnd
[
i
]]
=
i
;
// Record where to branch back to.
}
}
...
@@ -213,17 +213,17 @@ void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, ve
...
@@ -213,17 +213,17 @@ void ReferenceCustomDynamics::update(ContextImpl& context, int numberOfAtoms, ve
globals
.
insert
(
context
.
getParameters
().
begin
(),
context
.
getParameters
().
end
());
globals
.
insert
(
context
.
getParameters
().
begin
(),
context
.
getParameters
().
end
());
break
;
break
;
}
}
case
CustomIntegrator
::
Begin
IfBlock
:
{
case
CustomIntegrator
::
IfBlock
Start
:
{
if
(
!
evaluateCondition
(
step
,
globals
))
if
(
!
evaluateCondition
(
step
,
globals
))
nextStep
=
blockEnd
[
step
]
+
1
;
nextStep
=
blockEnd
[
step
]
+
1
;
break
;
break
;
}
}
case
CustomIntegrator
::
Begin
WhileBlock
:
{
case
CustomIntegrator
::
WhileBlock
Start
:
{
if
(
!
evaluateCondition
(
step
,
globals
))
if
(
!
evaluateCondition
(
step
,
globals
))
nextStep
=
blockEnd
[
step
]
+
1
;
nextStep
=
blockEnd
[
step
]
+
1
;
break
;
break
;
}
}
case
CustomIntegrator
::
End
Block
:
{
case
CustomIntegrator
::
Block
End
:
{
if
(
blockEnd
[
step
]
!=
-
1
)
if
(
blockEnd
[
step
]
!=
-
1
)
nextStep
=
blockEnd
[
step
];
// Return to the start of a while block.
nextStep
=
blockEnd
[
step
];
// Return to the start of a while block.
break
;
break
;
...
...
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