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
ea435536
Commit
ea435536
authored
Oct 07, 2014
by
peastman
Browse files
Very minor optimization to CpuCustomGBForce
parent
6a4ac837
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
32 deletions
+11
-32
platforms/cpu/include/CpuCustomGBForce.h
platforms/cpu/include/CpuCustomGBForce.h
+0
-12
platforms/cpu/src/CpuCustomGBForce.cpp
platforms/cpu/src/CpuCustomGBForce.cpp
+11
-20
No files found.
platforms/cpu/include/CpuCustomGBForce.h
View file @
ea435536
...
...
@@ -71,18 +71,6 @@ private:
*/
void
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
);
/**
* Calculate a computed value of type SingleParticle
*
* @param index the index of the value to compute
* @param data workspace for the current thread
* @param numAtoms number of atoms
* @param posq atom coordinates
* @param atomParameters atomParameters[atomIndex][paramterIndex]
*/
void
calculateSingleParticleValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
RealOpenMM
**
atomParameters
);
/**
* Calculate a computed value that is based on particle pairs
*
...
...
platforms/cpu/src/CpuCustomGBForce.cpp
View file @
ea435536
...
...
@@ -231,20 +231,24 @@ void CpuCustomGBForce::threadComputeForce(ThreadPool& threads, int threadIndex)
calculateParticlePairValue
(
0
,
data
,
numberOfAtoms
,
posq
,
atomParameters
,
false
,
boxSize
,
invBoxSize
);
threads
.
syncThreads
();
// Sum the first computed value.
// Sum the first computed value
and calculate the remaining ones
.
int
numValues
=
valueTypes
.
size
();
for
(
int
atom
=
data
.
firstAtom
;
atom
<
data
.
lastAtom
;
atom
++
)
{
float
sum
=
0.0
f
;
for
(
int
j
=
0
;
j
<
(
int
)
threadData
.
size
();
j
++
)
sum
+=
threadData
[
j
]
->
value0
[
atom
];
values
[
0
][
atom
]
=
sum
;
data
.
expressionSet
.
setVariable
(
data
.
xindex
,
posq
[
4
*
atom
]);
data
.
expressionSet
.
setVariable
(
data
.
yindex
,
posq
[
4
*
atom
+
1
]);
data
.
expressionSet
.
setVariable
(
data
.
zindex
,
posq
[
4
*
atom
+
2
]);
for
(
int
j
=
0
;
j
<
(
int
)
paramNames
.
size
();
j
++
)
data
.
expressionSet
.
setVariable
(
data
.
paramIndex
[
j
],
atomParameters
[
atom
][
j
]);
for
(
int
i
=
1
;
i
<
numValues
;
i
++
)
{
data
.
expressionSet
.
setVariable
(
data
.
valueIndex
[
i
-
1
],
values
[
i
-
1
][
atom
]);
values
[
i
][
atom
]
=
(
float
)
data
.
valueExpressions
[
i
].
evaluate
();
}
}
// Calculate the remaining computed values.
int
numValues
=
valueTypes
.
size
();
for
(
int
i
=
1
;
i
<
numValues
;
i
++
)
calculateSingleParticleValue
(
i
,
data
,
numberOfAtoms
,
posq
,
atomParameters
);
threads
.
syncThreads
();
// Now calculate the energy and its derivatives.
...
...
@@ -279,19 +283,6 @@ void CpuCustomGBForce::threadComputeForce(ThreadPool& threads, int threadIndex)
calculateChainRuleForces
(
data
,
numberOfAtoms
,
posq
,
atomParameters
,
forces
,
boxSize
,
invBoxSize
);
}
void
CpuCustomGBForce
::
calculateSingleParticleValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
RealOpenMM
**
atomParameters
)
{
for
(
int
i
=
data
.
firstAtom
;
i
<
data
.
lastAtom
;
i
++
)
{
data
.
expressionSet
.
setVariable
(
data
.
xindex
,
posq
[
4
*
i
]);
data
.
expressionSet
.
setVariable
(
data
.
yindex
,
posq
[
4
*
i
+
1
]);
data
.
expressionSet
.
setVariable
(
data
.
zindex
,
posq
[
4
*
i
+
2
]);
for
(
int
j
=
0
;
j
<
(
int
)
paramNames
.
size
();
j
++
)
data
.
expressionSet
.
setVariable
(
data
.
paramIndex
[
j
],
atomParameters
[
i
][
j
]);
for
(
int
j
=
0
;
j
<
index
;
j
++
)
data
.
expressionSet
.
setVariable
(
data
.
valueIndex
[
j
],
values
[
j
][
i
]);
values
[
index
][
i
]
=
(
float
)
data
.
valueExpressions
[
index
].
evaluate
();
}
}
void
CpuCustomGBForce
::
calculateParticlePairValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
RealOpenMM
**
atomParameters
,
bool
useExclusions
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
...
...
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