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
389563ef
"wrappers/python/vscode:/vscode.git/clone" did not exist on "fcba92a6aa1f2867642ab4fd12deedd5473cbc39"
Commit
389563ef
authored
Mar 24, 2009
by
Peter Eastman
Browse files
Keep atom coordinates in the first periodic cell to maintain precision.
parent
ff0a69f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
platforms/cuda/src/kernels/gpu.cpp
platforms/cuda/src/kernels/gpu.cpp
+16
-3
platforms/cuda/tests/TestCudaNonbondedForce.cpp
platforms/cuda/tests/TestCudaNonbondedForce.cpp
+3
-1
No files found.
platforms/cuda/src/kernels/gpu.cpp
View file @
389563ef
...
...
@@ -1699,9 +1699,22 @@ void gpuReorderAtoms(gpuContext gpu)
for
(
int
i
=
0
;
i
<
numMolecules
;
i
++
)
{
molPos
[
i
].
x
-=
floor
(
molPos
[
i
].
x
/
gpu
->
sim
.
periodicBoxSizeX
)
*
gpu
->
sim
.
periodicBoxSizeX
;
molPos
[
i
].
y
-=
floor
(
molPos
[
i
].
y
/
gpu
->
sim
.
periodicBoxSizeY
)
*
gpu
->
sim
.
periodicBoxSizeY
;
molPos
[
i
].
z
-=
floor
(
molPos
[
i
].
z
/
gpu
->
sim
.
periodicBoxSizeZ
)
*
gpu
->
sim
.
periodicBoxSizeZ
;
float
dx
=
floor
(
molPos
[
i
].
x
/
gpu
->
sim
.
periodicBoxSizeX
)
*
gpu
->
sim
.
periodicBoxSizeX
;
float
dy
=
floor
(
molPos
[
i
].
y
/
gpu
->
sim
.
periodicBoxSizeY
)
*
gpu
->
sim
.
periodicBoxSizeY
;
float
dz
=
floor
(
molPos
[
i
].
z
/
gpu
->
sim
.
periodicBoxSizeZ
)
*
gpu
->
sim
.
periodicBoxSizeZ
;
if
(
dx
!=
0.0
f
||
dy
!=
0.0
f
||
dz
!=
0.0
f
)
{
molPos
[
i
].
x
-=
dx
;
molPos
[
i
].
y
-=
dy
;
molPos
[
i
].
z
-=
dz
;
for
(
int
j
=
0
;
j
<
atoms
.
size
();
j
++
)
{
int
atom
=
atoms
[
j
]
+
mol
.
instances
[
i
];
posq
[
atom
].
x
-=
dx
;
posq
[
atom
].
y
-=
dy
;
posq
[
atom
].
z
-=
dz
;
}
}
}
}
...
...
platforms/cuda/tests/TestCudaNonbondedForce.cpp
View file @
389563ef
...
...
@@ -388,7 +388,9 @@ void testLargeSystem() {
cudaState
=
cudaContext
.
getState
(
State
::
Positions
|
State
::
Velocities
|
State
::
Forces
);
referenceState
=
referenceContext
.
getState
(
State
::
Positions
|
State
::
Velocities
|
State
::
Forces
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
ASSERT_EQUAL_VEC
(
cudaState
.
getPositions
()[
i
],
referenceState
.
getPositions
()[
i
],
tol
);
ASSERT_EQUAL_TOL
(
fmod
(
cudaState
.
getPositions
()[
i
][
0
]
-
referenceState
.
getPositions
()[
i
][
0
],
boxSize
),
0
,
tol
);
ASSERT_EQUAL_TOL
(
fmod
(
cudaState
.
getPositions
()[
i
][
1
]
-
referenceState
.
getPositions
()[
i
][
1
],
boxSize
),
0
,
tol
);
ASSERT_EQUAL_TOL
(
fmod
(
cudaState
.
getPositions
()[
i
][
2
]
-
referenceState
.
getPositions
()[
i
][
2
],
boxSize
),
0
,
tol
);
ASSERT_EQUAL_VEC
(
cudaState
.
getVelocities
()[
i
],
referenceState
.
getVelocities
()[
i
],
tol
);
ASSERT_EQUAL_VEC
(
cudaState
.
getForces
()[
i
],
referenceState
.
getForces
()[
i
],
tol
);
}
...
...
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