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
dd175b23
Commit
dd175b23
authored
Oct 15, 2013
by
peastman
Browse files
Bug fix, plus a minor optimization to reference platform
parent
79011828
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
platforms/cpu/src/CpuNeighborList.cpp
platforms/cpu/src/CpuNeighborList.cpp
+6
-2
platforms/reference/src/SimTKReference/ReferenceNeighborList.cpp
...ms/reference/src/SimTKReference/ReferenceNeighborList.cpp
+10
-8
No files found.
platforms/cpu/src/CpuNeighborList.cpp
View file @
dd175b23
...
...
@@ -41,16 +41,20 @@ public:
nx
=
(
int
)
floorf
(
periodicBoxSize
[
0
]
/
voxelSizeX
+
0.5
f
);
ny
=
(
int
)
floorf
(
periodicBoxSize
[
1
]
/
voxelSizeY
+
0.5
f
);
nz
=
(
int
)
floorf
(
periodicBoxSize
[
2
]
/
voxelSizeZ
+
0.5
f
);
voxelSizeX
=
periodicBoxSize
[
0
]
/
nx
;
voxelSizeY
=
periodicBoxSize
[
0
]
/
ny
;
voxelSizeZ
=
periodicBoxSize
[
0
]
/
nz
;
}
}
void
insert
(
const
int
&
item
,
const
float
*
location
)
{
VoxelIndex
voxelIndex
=
getVoxelIndex
(
location
);
if
(
voxelMap
.
find
(
voxelIndex
)
==
voxelMap
.
end
())
voxelMap
[
voxelIndex
]
=
Voxel
();
if
(
voxelMap
.
find
(
voxelIndex
)
==
voxelMap
.
end
())
voxelMap
[
voxelIndex
]
=
Voxel
();
Voxel
&
voxel
=
voxelMap
.
find
(
voxelIndex
)
->
second
;
voxel
.
push_back
(
VoxelItem
(
location
,
item
));
}
VoxelIndex
getVoxelIndex
(
const
float
*
location
)
const
{
float
xperiodic
,
yperiodic
,
zperiodic
;
...
...
platforms/reference/src/SimTKReference/ReferenceNeighborList.cpp
View file @
dd175b23
...
...
@@ -44,9 +44,7 @@ void OPENMM_EXPORT computeNeighborListNaive(
bool
usePeriodic
,
double
maxDistance
,
double
minDistance
,
bool
reportSymmetricPairs
)
{
bool
reportSymmetricPairs
)
{
neighborList
.
clear
();
double
maxDistanceSquared
=
maxDistance
*
maxDistance
;
...
...
@@ -102,15 +100,19 @@ public:
nx
=
(
int
)
floor
(
periodicBoxSize
[
0
]
/
voxelSizeX
+
0.5
);
ny
=
(
int
)
floor
(
periodicBoxSize
[
1
]
/
voxelSizeY
+
0.5
);
nz
=
(
int
)
floor
(
periodicBoxSize
[
2
]
/
voxelSizeZ
+
0.5
);
voxelSizeX
=
periodicBoxSize
[
0
]
/
nx
;
voxelSizeY
=
periodicBoxSize
[
0
]
/
ny
;
voxelSizeZ
=
periodicBoxSize
[
0
]
/
nz
;
}
}
void
insert
(
const
AtomIndex
&
item
,
const
RealVec
&
location
)
{
VoxelIndex
voxelIndex
=
getVoxelIndex
(
location
);
if
(
voxelMap
.
find
(
voxelIndex
)
==
voxelMap
.
end
()
)
voxelMap
[
voxelIndex
]
=
Voxel
();
if
(
voxelMap
.
find
(
voxelIndex
)
==
voxelMap
.
end
())
voxelMap
[
voxelIndex
]
=
Voxel
();
Voxel
&
voxel
=
voxelMap
.
find
(
voxelIndex
)
->
second
;
voxel
.
push_back
(
VoxelItem
(
&
location
,
item
)
);
voxel
.
push_back
(
VoxelItem
(
&
location
,
item
));
}
...
...
@@ -191,13 +193,13 @@ public:
// Ignore self hits
if
(
atomI
==
atomJ
)
continue
;
// Ignore exclusions.
if
(
exclusions
[
atomI
].
find
(
atomJ
)
!=
exclusions
[
atomI
].
end
())
continue
;
double
dSquared
=
compPairDistanceSquared
(
locationI
,
locationJ
,
periodicBoxSize
,
usePeriodic
);
if
(
dSquared
>
maxDistanceSquared
)
continue
;
if
(
dSquared
<
minDistanceSquared
)
continue
;
// Ignore exclusions.
if
(
exclusions
[
atomI
].
find
(
atomJ
)
!=
exclusions
[
atomI
].
end
())
continue
;
neighbors
.
push_back
(
AtomPair
(
atomI
,
atomJ
)
);
if
(
reportSymmetricPairs
)
neighbors
.
push_back
(
AtomPair
(
atomJ
,
atomI
)
);
...
...
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