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
d314e695
Commit
d314e695
authored
Mar 06, 2017
by
peastman
Browse files
Use C++11 style loops
parent
28b79b2f
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
23 deletions
+22
-23
platforms/cpu/src/CpuBondForce.cpp
platforms/cpu/src/CpuBondForce.cpp
+2
-2
platforms/cpu/src/CpuNeighborList.cpp
platforms/cpu/src/CpuNeighborList.cpp
+3
-3
platforms/cpu/src/CpuNonbondedForce.cpp
platforms/cpu/src/CpuNonbondedForce.cpp
+3
-3
platforms/cuda/src/CudaExpressionUtilities.cpp
platforms/cuda/src/CudaExpressionUtilities.cpp
+4
-4
platforms/opencl/src/OpenCLBondedUtilities.cpp
platforms/opencl/src/OpenCLBondedUtilities.cpp
+1
-2
platforms/opencl/src/OpenCLExpressionUtilities.cpp
platforms/opencl/src/OpenCLExpressionUtilities.cpp
+4
-4
platforms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.cpp
...s/reference/src/SimTKReference/ReferenceCCMAAlgorithm.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
...ms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
+3
-3
No files found.
platforms/cpu/src/CpuBondForce.cpp
View file @
d314e695
...
@@ -159,8 +159,8 @@ void CpuBondForce::assignBond(int bond, int thread, vector<int>& atomThread, vec
...
@@ -159,8 +159,8 @@ void CpuBondForce::assignBond(int bond, int thread, vector<int>& atomThread, vec
if
(
atom
!=
-
1
)
if
(
atom
!=
-
1
)
throw
OpenMMException
(
"CpuBondForce: Internal error: atoms assigned to threads incorrectly"
);
throw
OpenMMException
(
"CpuBondForce: Internal error: atoms assigned to threads incorrectly"
);
atom
=
thread
;
atom
=
thread
;
for
(
set
<
int
>::
const_iterator
iter
=
atomBonds
[
atom
].
begin
();
iter
!=
atomBonds
[
atom
]
.
end
();
++
iter
)
for
(
int
bond
:
atomBonds
[
atom
])
candidateBonds
.
push_back
(
*
iter
);
candidateBonds
.
push_back
(
bond
);
}
}
}
}
...
...
platforms/cpu/src/CpuNeighborList.cpp
View file @
d314e695
...
@@ -577,10 +577,10 @@ void CpuNeighborList::threadComputeNeighborList(ThreadPool& threads, int threadI
...
@@ -577,10 +577,10 @@ void CpuNeighborList::threadComputeNeighborList(ThreadPool& threads, int threadI
for
(
int
j
=
0
;
j
<
atomsInBlock
;
j
++
)
{
for
(
int
j
=
0
;
j
<
atomsInBlock
;
j
++
)
{
const
set
<
int
>&
atomExclusions
=
(
*
exclusions
)[
sortedAtoms
[
firstIndex
+
j
]];
const
set
<
int
>&
atomExclusions
=
(
*
exclusions
)[
sortedAtoms
[
firstIndex
+
j
]];
char
mask
=
1
<<
j
;
char
mask
=
1
<<
j
;
for
(
set
<
int
>::
const_iterator
iter
=
atomExclusions
.
begin
();
iter
!=
atomExclusions
.
end
();
++
iter
)
{
for
(
int
exclusion
:
atomExclusions
)
{
map
<
int
,
char
>::
iterator
thisAtomFlags
=
atomFlags
.
find
(
*
iter
);
map
<
int
,
char
>::
iterator
thisAtomFlags
=
atomFlags
.
find
(
exclusion
);
if
(
thisAtomFlags
==
atomFlags
.
end
())
if
(
thisAtomFlags
==
atomFlags
.
end
())
atomFlags
[
*
iter
]
=
mask
;
atomFlags
[
exclusion
]
=
mask
;
else
else
thisAtomFlags
->
second
|=
mask
;
thisAtomFlags
->
second
|=
mask
;
}
}
...
...
platforms/cpu/src/CpuNonbondedForce.cpp
View file @
d314e695
...
@@ -447,9 +447,9 @@ void CpuNonbondedForce::threadComputeDirect(ThreadPool& threads, int threadIndex
...
@@ -447,9 +447,9 @@ void CpuNonbondedForce::threadComputeDirect(ThreadPool& threads, int threadIndex
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
fvec4
posI
((
float
)
atomCoordinates
[
i
][
0
],
(
float
)
atomCoordinates
[
i
][
1
],
(
float
)
atomCoordinates
[
i
][
2
],
0.0
f
);
fvec4
posI
((
float
)
atomCoordinates
[
i
][
0
],
(
float
)
atomCoordinates
[
i
][
1
],
(
float
)
atomCoordinates
[
i
][
2
],
0.0
f
);
float
scaledChargeI
=
(
float
)
(
ONE_4PI_EPS0
*
posq
[
4
*
i
+
3
]);
float
scaledChargeI
=
(
float
)
(
ONE_4PI_EPS0
*
posq
[
4
*
i
+
3
]);
for
(
set
<
int
>::
const_iterator
iter
=
exclusions
[
i
].
begin
();
iter
!=
exclusions
[
i
].
end
();
++
iter
)
{
for
(
int
excluded
:
exclusions
[
i
]
)
{
if
(
*
iter
>
i
)
{
if
(
excluded
>
i
)
{
int
j
=
*
iter
;
int
j
=
excluded
;
fvec4
deltaR
;
fvec4
deltaR
;
fvec4
posJ
((
float
)
atomCoordinates
[
j
][
0
],
(
float
)
atomCoordinates
[
j
][
1
],
(
float
)
atomCoordinates
[
j
][
2
],
0.0
f
);
fvec4
posJ
((
float
)
atomCoordinates
[
j
][
0
],
(
float
)
atomCoordinates
[
j
][
1
],
(
float
)
atomCoordinates
[
j
][
2
],
0.0
f
);
float
r2
;
float
r2
;
...
...
platforms/cuda/src/CudaExpressionUtilities.cpp
View file @
d314e695
...
@@ -456,12 +456,12 @@ void CudaExpressionUtilities::processExpression(stringstream& out, const Express
...
@@ -456,12 +456,12 @@ void CudaExpressionUtilities::processExpression(stringstream& out, const Express
vector
<
bool
>
hasAssigned
(
powers
.
size
(),
false
);
vector
<
bool
>
hasAssigned
(
powers
.
size
(),
false
);
exponents
.
push_back
((
int
)
fabs
(
exponent
));
exponents
.
push_back
((
int
)
fabs
(
exponent
));
names
.
push_back
(
name
);
names
.
push_back
(
name
);
for
(
map
<
int
,
const
ExpressionTreeNode
*>::
const_iterator
iter
=
powers
.
begin
();
iter
!=
powers
.
end
();
++
iter
)
{
for
(
auto
&
power
:
powers
)
{
if
(
iter
->
first
!=
exponent
)
{
if
(
power
.
first
!=
exponent
)
{
exponents
.
push_back
(
iter
->
first
>=
0
?
iter
->
first
:
-
iter
->
first
);
exponents
.
push_back
(
power
.
first
>=
0
?
power
.
first
:
-
power
.
first
);
string
name2
=
prefix
+
context
.
intToString
(
temps
.
size
());
string
name2
=
prefix
+
context
.
intToString
(
temps
.
size
());
names
.
push_back
(
name2
);
names
.
push_back
(
name2
);
temps
.
push_back
(
make_pair
(
*
iter
->
second
,
name2
));
temps
.
push_back
(
make_pair
(
*
power
.
second
,
name2
));
out
<<
tempType
<<
" "
<<
name2
<<
" = 0.0f;
\n
"
;
out
<<
tempType
<<
" "
<<
name2
<<
" = 0.0f;
\n
"
;
}
}
}
}
...
...
platforms/opencl/src/OpenCLBondedUtilities.cpp
View file @
d314e695
...
@@ -184,8 +184,7 @@ void OpenCLBondedUtilities::initialize(const System& system) {
...
@@ -184,8 +184,7 @@ void OpenCLBondedUtilities::initialize(const System& system) {
// Create the kernels.
// Create the kernels.
for
(
vector
<
vector
<
int
>
>::
const_iterator
iter
=
forceSets
.
begin
();
iter
!=
forceSets
.
end
();
++
iter
)
{
for
(
auto
&
set
:
forceSets
)
{
const
vector
<
int
>&
set
=
*
iter
;
int
setSize
=
set
.
size
();
int
setSize
=
set
.
size
();
stringstream
s
;
stringstream
s
;
s
<<
"#ifdef SUPPORTS_64_BIT_ATOMICS
\n
"
;
s
<<
"#ifdef SUPPORTS_64_BIT_ATOMICS
\n
"
;
...
...
platforms/opencl/src/OpenCLExpressionUtilities.cpp
View file @
d314e695
...
@@ -448,12 +448,12 @@ void OpenCLExpressionUtilities::processExpression(stringstream& out, const Expre
...
@@ -448,12 +448,12 @@ void OpenCLExpressionUtilities::processExpression(stringstream& out, const Expre
vector
<
bool
>
hasAssigned
(
powers
.
size
(),
false
);
vector
<
bool
>
hasAssigned
(
powers
.
size
(),
false
);
exponents
.
push_back
((
int
)
fabs
(
exponent
));
exponents
.
push_back
((
int
)
fabs
(
exponent
));
names
.
push_back
(
name
);
names
.
push_back
(
name
);
for
(
map
<
int
,
const
ExpressionTreeNode
*>::
const_iterator
iter
=
powers
.
begin
();
iter
!=
powers
.
end
();
++
iter
)
{
for
(
auto
&
power
:
powers
)
{
if
(
iter
->
first
!=
exponent
)
{
if
(
power
.
first
!=
exponent
)
{
exponents
.
push_back
(
iter
->
first
>=
0
?
iter
->
first
:
-
iter
->
first
);
exponents
.
push_back
(
power
.
first
>=
0
?
power
.
first
:
-
power
.
first
);
string
name2
=
prefix
+
context
.
intToString
(
temps
.
size
());
string
name2
=
prefix
+
context
.
intToString
(
temps
.
size
());
names
.
push_back
(
name2
);
names
.
push_back
(
name2
);
temps
.
push_back
(
make_pair
(
*
iter
->
second
,
name2
));
temps
.
push_back
(
make_pair
(
*
power
.
second
,
name2
));
out
<<
tempType
<<
" "
<<
name2
<<
" = 0.0f;
\n
"
;
out
<<
tempType
<<
" "
<<
name2
<<
" = 0.0f;
\n
"
;
}
}
}
}
...
...
platforms/reference/src/SimTKReference/ReferenceCCMAAlgorithm.cpp
View file @
d314e695
...
@@ -127,8 +127,8 @@ ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm(int numberOfAtoms,
...
@@ -127,8 +127,8 @@ ReferenceCCMAAlgorithm::ReferenceCCMAAlgorithm(int numberOfAtoms,
// We didn't find one, so look for an angle force field term.
// We didn't find one, so look for an angle force field term.
const
vector
<
int
>&
angleCandidates
=
atomAngles
[
atomb
];
const
vector
<
int
>&
angleCandidates
=
atomAngles
[
atomb
];
for
(
vector
<
int
>::
const_iterator
iter
=
angleCandidates
.
begin
();
iter
!=
angleCandidates
.
end
();
iter
++
)
{
for
(
int
candidate
:
angleCandidates
)
{
const
AngleInfo
&
angle
=
angles
[
*
i
te
r
];
const
AngleInfo
&
angle
=
angles
[
candida
te
];
if
((
angle
.
atom1
==
atoma
&&
angle
.
atom3
==
atomc
)
||
(
angle
.
atom3
==
atoma
&&
angle
.
atom1
==
atomc
))
{
if
((
angle
.
atom1
==
atoma
&&
angle
.
atom3
==
atomc
)
||
(
angle
.
atom3
==
atoma
&&
angle
.
atom1
==
atomc
))
{
matrix
[
j
].
push_back
(
pair
<
int
,
double
>
(
k
,
scale
*
cos
(
angle
.
angle
)));
matrix
[
j
].
push_back
(
pair
<
int
,
double
>
(
k
,
scale
*
cos
(
angle
.
angle
)));
break
;
break
;
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
View file @
d314e695
...
@@ -488,10 +488,10 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<Vec3>& a
...
@@ -488,10 +488,10 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<Vec3>& a
double
totalExclusionEnergy
=
0.0
f
;
double
totalExclusionEnergy
=
0.0
f
;
const
double
TWO_OVER_SQRT_PI
=
2
/
sqrt
(
PI_M
);
const
double
TWO_OVER_SQRT_PI
=
2
/
sqrt
(
PI_M
);
for
(
int
i
=
0
;
i
<
numberOfAtoms
;
i
++
)
for
(
int
i
=
0
;
i
<
numberOfAtoms
;
i
++
)
for
(
set
<
int
>::
const_iterator
iter
=
exclusions
[
i
].
begin
();
iter
!=
exclusions
[
i
].
end
();
++
iter
)
{
for
(
int
exclusion
:
exclusions
[
i
]
)
{
if
(
*
iter
>
i
)
{
if
(
exclusion
>
i
)
{
int
ii
=
i
;
int
ii
=
i
;
int
jj
=
*
iter
;
int
jj
=
exclusion
;
double
deltaR
[
2
][
ReferenceForce
::
LastDeltaRIndex
];
double
deltaR
[
2
][
ReferenceForce
::
LastDeltaRIndex
];
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
jj
],
atomCoordinates
[
ii
],
deltaR
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
jj
],
atomCoordinates
[
ii
],
deltaR
[
0
]);
...
...
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