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
e7813ee0
Commit
e7813ee0
authored
Aug 24, 2009
by
Peter Eastman
Browse files
Particle locations reported through the API do not get moved into the first periodic box
parent
5e133f35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
13 deletions
+34
-13
platforms/cuda/src/CudaStreamImpl.h
platforms/cuda/src/CudaStreamImpl.h
+16
-5
platforms/cuda/src/kernels/gpu.cpp
platforms/cuda/src/kernels/gpu.cpp
+17
-8
platforms/cuda/src/kernels/gputypes.h
platforms/cuda/src/kernels/gputypes.h
+1
-0
No files found.
platforms/cuda/src/CudaStreamImpl.h
View file @
e7813ee0
...
@@ -150,12 +150,10 @@ void CudaStreamImpl<T>::loadFromArray(const void* array) {
...
@@ -150,12 +150,10 @@ void CudaStreamImpl<T>::loadFromArray(const void* array) {
for
(
int
j
=
0
;
j
<
rowOffset
;
++
j
)
for
(
int
j
=
0
;
j
<
rowOffset
;
++
j
)
data
[
i
*
rowOffset
+
j
]
=
paddingValues
[
j
];
data
[
i
*
rowOffset
+
j
]
=
paddingValues
[
j
];
stream
->
Upload
();
stream
->
Upload
();
if
(
gpu
&&
getName
()
==
"particlePositions"
)
{
// VisualStudio compiler did not like stream == gpu->psPosq4
//if( gpu && stream == gpu->psPosq4 ){
if
(
gpu
&&
getName
()
==
"particlePositions"
){
gpu
->
bRecalculateBornRadii
=
true
;
gpu
->
bRecalculateBornRadii
=
true
;
for
(
int
i
=
0
;
i
<
gpu
->
posCellOffsets
.
size
();
i
++
)
gpu
->
posCellOffsets
[
i
]
=
make_int3
(
0
,
0
,
0
);
}
}
}
}
...
@@ -175,6 +173,14 @@ void CudaStreamImpl<T>::saveToArray(void* array) {
...
@@ -175,6 +173,14 @@ void CudaStreamImpl<T>::saveToArray(void* array) {
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
i
=
0
;
i
<
getSize
();
++
i
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
for
(
int
j
=
0
;
j
<
width
;
++
j
)
arrayData
[
order
[
i
]
*
width
+
j
]
=
data
[
i
*
rowOffset
+
j
];
arrayData
[
order
[
i
]
*
width
+
j
]
=
data
[
i
*
rowOffset
+
j
];
if
(
gpu
&&
getName
()
==
"particlePositions"
)
{
for
(
int
i
=
0
;
i
<
getSize
();
i
++
)
{
int3
offset
=
gpu
->
posCellOffsets
[
i
];
arrayData
[
order
[
i
]
*
width
]
-=
offset
.
x
*
gpu
->
sim
.
periodicBoxSizeX
;
arrayData
[
order
[
i
]
*
width
+
1
]
-=
offset
.
y
*
gpu
->
sim
.
periodicBoxSizeY
;
arrayData
[
order
[
i
]
*
width
+
2
]
-=
offset
.
z
*
gpu
->
sim
.
periodicBoxSizeZ
;
}
}
}
}
else
{
else
{
int
*
arrayData
=
(
int
*
)
array
;
int
*
arrayData
=
(
int
*
)
array
;
...
@@ -209,6 +215,11 @@ void CudaStreamImpl<T>::fillWithValue(void* value) {
...
@@ -209,6 +215,11 @@ void CudaStreamImpl<T>::fillWithValue(void* value) {
for
(
int
j
=
0
;
j
<
rowOffset
;
++
j
)
for
(
int
j
=
0
;
j
<
rowOffset
;
++
j
)
data
[
i
*
rowOffset
+
j
]
=
paddingValues
[
j
];
data
[
i
*
rowOffset
+
j
]
=
paddingValues
[
j
];
stream
->
Upload
();
stream
->
Upload
();
if
(
gpu
&&
getName
()
==
"particlePositions"
)
{
gpu
->
bRecalculateBornRadii
=
true
;
for
(
int
i
=
0
;
i
<
gpu
->
posCellOffsets
.
size
();
i
++
)
gpu
->
posCellOffsets
[
i
]
=
make_int3
(
0
,
0
,
0
);
}
}
}
template
<
class
T
>
template
<
class
T
>
...
...
platforms/cuda/src/kernels/gpu.cpp
View file @
e7813ee0
...
@@ -1333,6 +1333,7 @@ int gpuAllocateInitialBuffers(gpuContext gpu)
...
@@ -1333,6 +1333,7 @@ int gpuAllocateInitialBuffers(gpuContext gpu)
for
(
int
i
=
0
;
i
<
(
int
)
gpu
->
sim
.
paddedNumberOfAtoms
;
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
gpu
->
sim
.
paddedNumberOfAtoms
;
i
++
)
(
*
gpu
->
psAtomIndex
)[
i
]
=
i
;
(
*
gpu
->
psAtomIndex
)[
i
]
=
i
;
gpu
->
psAtomIndex
->
Upload
();
gpu
->
psAtomIndex
->
Upload
();
gpu
->
posCellOffsets
.
resize
(
gpu
->
natoms
,
make_int3
(
0
,
0
,
0
));
// Determine randoms
// Determine randoms
gpu
->
seed
=
1
;
gpu
->
seed
=
1
;
gpu
->
sim
.
randomFrames
=
20
;
gpu
->
sim
.
randomFrames
=
20
;
...
@@ -2385,6 +2386,7 @@ void gpuReorderAtoms(gpuContext gpu)
...
@@ -2385,6 +2386,7 @@ void gpuReorderAtoms(gpuContext gpu)
vector
<
int
>
originalIndex
(
numAtoms
);
vector
<
int
>
originalIndex
(
numAtoms
);
vector
<
float4
>
newPosq
(
numAtoms
);
vector
<
float4
>
newPosq
(
numAtoms
);
vector
<
float4
>
newVelm
(
numAtoms
);
vector
<
float4
>
newVelm
(
numAtoms
);
vector
<
int3
>
newCellOffsets
(
numAtoms
);
for
(
int
group
=
0
;
group
<
(
int
)
gpu
->
moleculeGroups
.
size
();
group
++
)
for
(
int
group
=
0
;
group
<
(
int
)
gpu
->
moleculeGroups
.
size
();
group
++
)
{
{
// Find the center of each molecule.
// Find the center of each molecule.
...
@@ -2415,9 +2417,12 @@ void gpuReorderAtoms(gpuContext gpu)
...
@@ -2415,9 +2417,12 @@ void gpuReorderAtoms(gpuContext gpu)
for
(
int
i
=
0
;
i
<
numMolecules
;
i
++
)
for
(
int
i
=
0
;
i
<
numMolecules
;
i
++
)
{
{
float
dx
=
floor
(
molPos
[
i
].
x
/
gpu
->
sim
.
periodicBoxSizeX
)
*
gpu
->
sim
.
periodicBoxSizeX
;
int
xcell
=
(
int
)
floor
(
molPos
[
i
].
x
/
gpu
->
sim
.
periodicBoxSizeX
);
float
dy
=
floor
(
molPos
[
i
].
y
/
gpu
->
sim
.
periodicBoxSizeY
)
*
gpu
->
sim
.
periodicBoxSizeY
;
int
ycell
=
(
int
)
floor
(
molPos
[
i
].
y
/
gpu
->
sim
.
periodicBoxSizeY
);
float
dz
=
floor
(
molPos
[
i
].
z
/
gpu
->
sim
.
periodicBoxSizeZ
)
*
gpu
->
sim
.
periodicBoxSizeZ
;
int
zcell
=
(
int
)
floor
(
molPos
[
i
].
z
/
gpu
->
sim
.
periodicBoxSizeZ
);
float
dx
=
xcell
*
gpu
->
sim
.
periodicBoxSizeX
;
float
dy
=
ycell
*
gpu
->
sim
.
periodicBoxSizeY
;
float
dz
=
zcell
*
gpu
->
sim
.
periodicBoxSizeZ
;
if
(
dx
!=
0.0
f
||
dy
!=
0.0
f
||
dz
!=
0.0
f
)
if
(
dx
!=
0.0
f
||
dy
!=
0.0
f
||
dz
!=
0.0
f
)
{
{
molPos
[
i
].
x
-=
dx
;
molPos
[
i
].
x
-=
dx
;
...
@@ -2429,6 +2434,9 @@ void gpuReorderAtoms(gpuContext gpu)
...
@@ -2429,6 +2434,9 @@ void gpuReorderAtoms(gpuContext gpu)
posq
[
atom
].
x
-=
dx
;
posq
[
atom
].
x
-=
dx
;
posq
[
atom
].
y
-=
dy
;
posq
[
atom
].
y
-=
dy
;
posq
[
atom
].
z
-=
dz
;
posq
[
atom
].
z
-=
dz
;
gpu
->
posCellOffsets
[
atom
].
x
-=
xcell
;
gpu
->
posCellOffsets
[
atom
].
y
-=
ycell
;
gpu
->
posCellOffsets
[
atom
].
z
-=
zcell
;
}
}
}
}
}
}
...
@@ -2482,19 +2490,20 @@ void gpuReorderAtoms(gpuContext gpu)
...
@@ -2482,19 +2490,20 @@ void gpuReorderAtoms(gpuContext gpu)
originalIndex
[
newIndex
]
=
(
*
gpu
->
psAtomIndex
)[
oldIndex
];
originalIndex
[
newIndex
]
=
(
*
gpu
->
psAtomIndex
)[
oldIndex
];
newPosq
[
newIndex
]
=
posq
[
oldIndex
];
newPosq
[
newIndex
]
=
posq
[
oldIndex
];
newVelm
[
newIndex
]
=
velm
[
oldIndex
];
newVelm
[
newIndex
]
=
velm
[
oldIndex
];
newCellOffsets
[
newIndex
]
=
gpu
->
posCellOffsets
[
oldIndex
];
}
}
}
}
}
}
// Update the streams.
// Update the streams.
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
{
posq
[
i
]
=
newPosq
[
i
];
posq
[
i
]
=
newPosq
[
i
];
gpu
->
psPosq4
->
Upload
();
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
velm
[
i
]
=
newVelm
[
i
];
velm
[
i
]
=
newVelm
[
i
];
gpu
->
psVelm4
->
Upload
();
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
(
*
gpu
->
psAtomIndex
)[
i
]
=
originalIndex
[
i
];
(
*
gpu
->
psAtomIndex
)[
i
]
=
originalIndex
[
i
];
gpu
->
posCellOffsets
[
i
]
=
newCellOffsets
[
i
];
}
gpu
->
psPosq4
->
Upload
();
gpu
->
psVelm4
->
Upload
();
gpu
->
psAtomIndex
->
Upload
();
gpu
->
psAtomIndex
->
Upload
();
}
}
platforms/cuda/src/kernels/gputypes.h
View file @
e7813ee0
...
@@ -74,6 +74,7 @@ struct _gpuContext {
...
@@ -74,6 +74,7 @@ struct _gpuContext {
unsigned
char
*
pAtomSymbol
;
unsigned
char
*
pAtomSymbol
;
std
::
vector
<
gpuMoleculeGroup
>
moleculeGroups
;
std
::
vector
<
gpuMoleculeGroup
>
moleculeGroups
;
gpuTabulatedFunction
tabulatedFunctions
[
MAX_TABULATED_FUNCTIONS
];
gpuTabulatedFunction
tabulatedFunctions
[
MAX_TABULATED_FUNCTIONS
];
std
::
vector
<
int3
>
posCellOffsets
;
float
iterations
;
float
iterations
;
float
epsfac
;
float
epsfac
;
float
solventDielectric
;
float
solventDielectric
;
...
...
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