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
73183c61
Commit
73183c61
authored
May 31, 2016
by
ChayaSt
Browse files
resolved conflict
parents
0e218233
32e08b87
Changes
267
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
303 additions
and
137 deletions
+303
-137
platforms/opencl/src/kernels/gbsaObc_cpu.cl
platforms/opencl/src/kernels/gbsaObc_cpu.cl
+44
-48
platforms/opencl/src/kernels/nonbonded.cl
platforms/opencl/src/kernels/nonbonded.cl
+28
-30
platforms/opencl/src/kernels/nonbonded_cpu.cl
platforms/opencl/src/kernels/nonbonded_cpu.cl
+22
-24
platforms/opencl/src/kernels/pme.cl
platforms/opencl/src/kernels/pme.cl
+12
-13
platforms/opencl/src/kernels/torsionForce.cl
platforms/opencl/src/kernels/torsionForce.cl
+5
-0
platforms/opencl/tests/OpenCLTests.h
platforms/opencl/tests/OpenCLTests.h
+3
-3
platforms/reference/include/ReferenceAngleBondIxn.h
platforms/reference/include/ReferenceAngleBondIxn.h
+13
-0
platforms/reference/include/ReferenceCMAPTorsionIxn.h
platforms/reference/include/ReferenceCMAPTorsionIxn.h
+12
-0
platforms/reference/include/ReferenceCustomAngleIxn.h
platforms/reference/include/ReferenceCustomAngleIxn.h
+13
-1
platforms/reference/include/ReferenceCustomBondIxn.h
platforms/reference/include/ReferenceCustomBondIxn.h
+13
-1
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
+13
-1
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
+13
-1
platforms/reference/include/ReferenceCustomDynamics.h
platforms/reference/include/ReferenceCustomDynamics.h
+13
-8
platforms/reference/include/ReferenceCustomTorsionIxn.h
platforms/reference/include/ReferenceCustomTorsionIxn.h
+13
-1
platforms/reference/include/ReferenceForce.h
platforms/reference/include/ReferenceForce.h
+28
-0
platforms/reference/include/ReferenceHarmonicBondIxn.h
platforms/reference/include/ReferenceHarmonicBondIxn.h
+14
-1
platforms/reference/include/ReferenceKernels.h
platforms/reference/include/ReferenceKernels.h
+12
-2
platforms/reference/include/ReferenceProperDihedralBond.h
platforms/reference/include/ReferenceProperDihedralBond.h
+14
-1
platforms/reference/include/ReferenceRbDihedralBond.h
platforms/reference/include/ReferenceRbDihedralBond.h
+14
-1
platforms/reference/include/ReferenceTabulatedFunction.h
platforms/reference/include/ReferenceTabulatedFunction.h
+4
-1
No files found.
platforms/opencl/src/kernels/gbsaObc_cpu.cl
View file @
73183c61
...
@@ -178,6 +178,8 @@ __kernel void computeBornSum(
...
@@ -178,6 +178,8 @@ __kernel void computeBornSum(
#
ifdef
USE_CUTOFF
#
ifdef
USE_CUTOFF
unsigned
int
numTiles
=
interactionCount[0]
;
unsigned
int
numTiles
=
interactionCount[0]
;
if
(
numTiles
>
maxTiles
)
return
; // There wasn't enough memory for the neighbor list.
int
pos
=
(
int
)
(
get_group_id
(
0
)
*
(
numTiles
>
maxTiles
?
NUM_BLOCKS*
((
long
)
NUM_BLOCKS+1
)
/2
:
numTiles
)
/get_num_groups
(
0
))
;
int
pos
=
(
int
)
(
get_group_id
(
0
)
*
(
numTiles
>
maxTiles
?
NUM_BLOCKS*
((
long
)
NUM_BLOCKS+1
)
/2
:
numTiles
)
/get_num_groups
(
0
))
;
int
end
=
(
int
)
((
get_group_id
(
0
)
+1
)
*
(
numTiles
>
maxTiles
?
NUM_BLOCKS*
((
long
)
NUM_BLOCKS+1
)
/2
:
numTiles
)
/get_num_groups
(
0
))
;
int
end
=
(
int
)
((
get_group_id
(
0
)
+1
)
*
(
numTiles
>
maxTiles
?
NUM_BLOCKS*
((
long
)
NUM_BLOCKS+1
)
/2
:
numTiles
)
/get_num_groups
(
0
))
;
#
else
#
else
...
@@ -196,35 +198,31 @@ __kernel void computeBornSum(
...
@@ -196,35 +198,31 @@ __kernel void computeBornSum(
int
x,
y
;
int
x,
y
;
bool
singlePeriodicCopy
=
false
;
bool
singlePeriodicCopy
=
false
;
#
ifdef
USE_CUTOFF
#
ifdef
USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
{
x
=
tiles[pos]
;
x
=
tiles[pos]
;
real4
blockSizeX
=
blockSize[x]
;
real4
blockSizeX
=
blockSize[x]
;
singlePeriodicCopy
=
(
0.5f*periodicBoxSize.x-blockSizeX.x
>=
CUTOFF
&&
singlePeriodicCopy
=
(
0.5f*periodicBoxSize.x-blockSizeX.x
>=
CUTOFF
&&
0.5f*periodicBoxSize.y-blockSizeX.y
>=
CUTOFF
&&
0.5f*periodicBoxSize.y-blockSizeX.y
>=
CUTOFF
&&
0.5f*periodicBoxSize.z-blockSizeX.z
>=
CUTOFF
)
;
0.5f*periodicBoxSize.z-blockSizeX.z
>=
CUTOFF
)
;
#
else
}
y
=
(
int
)
floor
(
NUM_BLOCKS+0.5f-SQRT
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
else
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
#
endif
if
(
x
<
y
|
| x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
{
y += (x < y ? -1 : 1);
y
=
(
int
)
floor
(
NUM_BLOCKS+0.5f-SQRT
((
NUM_BLOCKS+0.5f
)
*
(
NUM_BLOCKS+0.5f
)
-2*pos
))
;
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if
(
x
<
y
|
| x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
}
y += (x < y ? -1 : 1);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
// Skip over tiles that have exclusions, since they were already processed.
// Skip over tiles that have exclusions, since they were already processed.
while (nextToSkip < pos) {
while (nextToSkip < pos) {
if (currentSkipIndex < NUM_TILES_WITH_EXCLUSIONS) {
if (currentSkipIndex < NUM_TILES_WITH_EXCLUSIONS) {
ushort2 tile = exclusionTiles[currentSkipIndex++];
ushort2 tile = exclusionTiles[currentSkipIndex++];
nextToSkip = tile.x + tile.y*NUM_BLOCKS - tile.y*(tile.y+1)/2;
nextToSkip = tile.x + tile.y*NUM_BLOCKS - tile.y*(tile.y+1)/2;
}
else
nextToSkip = end;
}
}
includeTile = (nextToSkip != pos);
else
nextToSkip = end;
}
}
includeTile = (nextToSkip != pos);
#endif
if (includeTile) {
if (includeTile) {
// Load the data for this tile.
// Load the data for this tile.
...
@@ -593,6 +591,8 @@ __kernel void computeGBSAForce1(
...
@@ -593,6 +591,8 @@ __kernel void computeGBSAForce1(
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
unsigned int numTiles = interactionCount[0];
unsigned int numTiles = interactionCount[0];
if (numTiles > maxTiles)
return; // There wasn't enough memory for the neighbor list.
int pos = (int) (get_group_id(0)*(numTiles > maxTiles ? NUM_BLOCKS*((long)NUM_BLOCKS+1)/2 : numTiles)/get_num_groups(0));
int pos = (int) (get_group_id(0)*(numTiles > maxTiles ? NUM_BLOCKS*((long)NUM_BLOCKS+1)/2 : numTiles)/get_num_groups(0));
int end = (int) ((get_group_id(0)+1)*(numTiles > maxTiles ? NUM_BLOCKS*((long)NUM_BLOCKS+1)/2 : numTiles)/get_num_groups(0));
int end = (int) ((get_group_id(0)+1)*(numTiles > maxTiles ? NUM_BLOCKS*((long)NUM_BLOCKS+1)/2 : numTiles)/get_num_groups(0));
#else
#else
...
@@ -611,35 +611,31 @@ __kernel void computeGBSAForce1(
...
@@ -611,35 +611,31 @@ __kernel void computeGBSAForce1(
int x, y;
int x, y;
bool singlePeriodicCopy = false;
bool singlePeriodicCopy = false;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if (numTiles <= maxTiles) {
x = tiles[pos];
x = tiles[pos];
real4 blockSizeX = blockSize[x];
real4 blockSizeX = blockSize[x];
singlePeriodicCopy = (0.5f*periodicBoxSize.x-blockSizeX.x >= CUTOFF &&
singlePeriodicCopy = (0.5f*periodicBoxSize.x-blockSizeX.x >= CUTOFF &&
0.5f*periodicBoxSize.y-blockSizeX.y >= CUTOFF &&
0.5f*periodicBoxSize.y-blockSizeX.y >= CUTOFF &&
0.5f*periodicBoxSize.z-blockSizeX.z >= CUTOFF);
0.5f*periodicBoxSize.z-blockSizeX.z >= CUTOFF);
#else
}
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
else
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
#endif
if (x < y |
|
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
{
y
+=
(
x
<
y
?
-1
:
1
)
;
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
if (x < y |
|
x
>=
NUM_BLOCKS
)
{
//
Occasionally
happens
due
to
roundoff
error.
}
y
+=
(
x
<
y
?
-1
:
1
)
;
x
=
(
pos-y*NUM_BLOCKS+y*
(
y+1
)
/2
)
;
}
//
Skip
over
tiles
that
have
exclusions,
since
they
were
already
processed.
//
Skip
over
tiles
that
have
exclusions,
since
they
were
already
processed.
while
(
nextToSkip
<
pos
)
{
while
(
nextToSkip
<
pos
)
{
if
(
currentSkipIndex
<
NUM_TILES_WITH_EXCLUSIONS
)
{
if
(
currentSkipIndex
<
NUM_TILES_WITH_EXCLUSIONS
)
{
ushort2
tile
=
exclusionTiles[currentSkipIndex++]
;
ushort2
tile
=
exclusionTiles[currentSkipIndex++]
;
nextToSkip
=
tile.x
+
tile.y*NUM_BLOCKS
-
tile.y*
(
tile.y+1
)
/2
;
nextToSkip
=
tile.x
+
tile.y*NUM_BLOCKS
-
tile.y*
(
tile.y+1
)
/2
;
}
else
nextToSkip
=
end
;
}
}
includeTile
=
(
nextToSkip
!=
pos
)
;
else
nextToSkip
=
end
;
}
}
includeTile
=
(
nextToSkip
!=
pos
)
;
#
endif
if
(
includeTile
)
{
if
(
includeTile
)
{
//
Load
the
data
for
this
tile.
//
Load
the
data
for
this
tile.
...
...
platforms/opencl/src/kernels/nonbonded.cl
View file @
73183c61
...
@@ -200,6 +200,8 @@ __kernel void computeNonbonded(
...
@@ -200,6 +200,8 @@ __kernel void computeNonbonded(
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
unsigned int numTiles = interactionCount[0];
unsigned int numTiles = interactionCount[0];
if (numTiles > maxTiles)
return; // There wasn't enough memory for the neighbor list.
int pos = (int) (numTiles > maxTiles ? startTileIndex+warp*(long)numTileIndices/totalWarps : warp*(long)numTiles/totalWarps);
int pos = (int) (numTiles > maxTiles ? startTileIndex+warp*(long)numTileIndices/totalWarps : warp*(long)numTiles/totalWarps);
int end = (int) (numTiles > maxTiles ? startTileIndex+(warp+1)*(long)numTileIndices/totalWarps : (warp+1)*(long)numTiles/totalWarps);
int end = (int) (numTiles > maxTiles ? startTileIndex+(warp+1)*(long)numTileIndices/totalWarps : (warp+1)*(long)numTiles/totalWarps);
#else
#else
...
@@ -223,42 +225,38 @@ __kernel void computeNonbonded(
...
@@ -223,42 +225,38 @@ __kernel void computeNonbonded(
int x, y;
int x, y;
bool singlePeriodicCopy = false;
bool singlePeriodicCopy = false;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if (numTiles <= maxTiles) {
x = tiles[pos];
x = tiles[pos];
real4 blockSizeX = blockSize[x];
real4 blockSizeX = blockSize[x];
singlePeriodicCopy = (0.5f*periodicBoxSize.x-blockSizeX.x >= MAX_CUTOFF &&
singlePeriodicCopy = (0.5f*periodicBoxSize.x-blockSizeX.x >= MAX_CUTOFF &&
0.5f*periodicBoxSize.y-blockSizeX.y >= MAX_CUTOFF &&
0.5f*periodicBoxSize.y-blockSizeX.y >= MAX_CUTOFF &&
0.5f*periodicBoxSize.z-blockSizeX.z >= MAX_CUTOFF);
0.5f*periodicBoxSize.z-blockSizeX.z >= MAX_CUTOFF);
#else
}
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
else
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
#endif
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
{
y += (x < y ? -1 : 1);
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
}
y += (x < y ? -1 : 1);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
// Skip over tiles that have exclusions, since they were already processed.
// Skip over tiles that have exclusions, since they were already processed.
SYNC_WARPS;
while (skipTiles[tbx+TILE_SIZE-1] < pos) {
SYNC_WARPS;
SYNC_WARPS;
while (skipTiles[tbx+TILE_SIZE-1] < pos) {
if (skipBase+tgx < NUM_TILES_WITH_EXCLUSIONS) {
SYNC_WARPS;
ushort2 tile = exclusionTiles[skipBase+tgx];
if (skipBase+tgx < NUM_TILES_WITH_EXCLUSIONS) {
skipTiles[get_local_id(0)] = tile.x + tile.y*NUM_BLOCKS - tile.y*(tile.y+1)/2;
ushort2 tile = exclusionTiles[skipBase+tgx];
skipTiles[get_local_id(0)] = tile.x + tile.y*NUM_BLOCKS - tile.y*(tile.y+1)/2;
}
else
skipTiles[get_local_id(0)] = end;
skipBase += TILE_SIZE;
currentSkipIndex = tbx;
SYNC_WARPS;
}
}
while (skipTiles[currentSkipIndex] < pos)
else
currentSkipIndex++;
skipTiles[get_local_id(0)] = end;
includeTile = (skipTiles[currentSkipIndex] != pos);
skipBase += TILE_SIZE;
currentSkipIndex = tbx;
SYNC_WARPS;
}
}
while (skipTiles[currentSkipIndex] < pos)
currentSkipIndex++;
includeTile = (skipTiles[currentSkipIndex] != pos);
#endif
if (includeTile) {
if (includeTile) {
unsigned int atom1 = x*TILE_SIZE + tgx;
unsigned int atom1 = x*TILE_SIZE + tgx;
...
...
platforms/opencl/src/kernels/nonbonded_cpu.cl
View file @
73183c61
...
@@ -214,6 +214,8 @@ __kernel void computeNonbonded(
...
@@ -214,6 +214,8 @@ __kernel void computeNonbonded(
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
const unsigned int numTiles = interactionCount[0];
const unsigned int numTiles = interactionCount[0];
if (numTiles > maxTiles)
return; // There wasn't enough memory for the neighbor list.
int pos = (int) (numTiles > maxTiles ? (unsigned int) (startTileIndex+get_group_id(0)*(long)numTileIndices/get_num_groups(0)) : get_group_id(0)*(long)numTiles/get_num_groups(0));
int pos = (int) (numTiles > maxTiles ? (unsigned int) (startTileIndex+get_group_id(0)*(long)numTileIndices/get_num_groups(0)) : get_group_id(0)*(long)numTiles/get_num_groups(0));
int end = (int) (numTiles > maxTiles ? (unsigned int) (startTileIndex+(get_group_id(0)+1)*(long)numTileIndices/get_num_groups(0)) : (get_group_id(0)+1)*(long)numTiles/get_num_groups(0));
int end = (int) (numTiles > maxTiles ? (unsigned int) (startTileIndex+(get_group_id(0)+1)*(long)numTileIndices/get_num_groups(0)) : (get_group_id(0)+1)*(long)numTiles/get_num_groups(0));
#else
#else
...
@@ -234,35 +236,31 @@ __kernel void computeNonbonded(
...
@@ -234,35 +236,31 @@ __kernel void computeNonbonded(
int x, y;
int x, y;
bool singlePeriodicCopy = false;
bool singlePeriodicCopy = false;
#ifdef USE_CUTOFF
#ifdef USE_CUTOFF
if (numTiles <= maxTiles) {
x = tiles[pos];
x = tiles[pos];
real4 blockSizeX = blockSize[x];
real4 blockSizeX = blockSize[x];
singlePeriodicCopy = (0.5f*periodicBoxSize.x-blockSizeX.x >= MAX_CUTOFF &&
singlePeriodicCopy = (0.5f*periodicBoxSize.x-blockSizeX.x >= MAX_CUTOFF &&
0.5f*periodicBoxSize.y-blockSizeX.y >= MAX_CUTOFF &&
0.5f*periodicBoxSize.y-blockSizeX.y >= MAX_CUTOFF &&
0.5f*periodicBoxSize.z-blockSizeX.z >= MAX_CUTOFF);
0.5f*periodicBoxSize.z-blockSizeX.z >= MAX_CUTOFF);
#else
}
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
else
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
#endif
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
{
y += (x < y ? -1 : 1);
y = (int) floor(NUM_BLOCKS+0.5f-SQRT((NUM_BLOCKS+0.5f)*(NUM_BLOCKS+0.5f)-2*pos));
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
if (x < y || x >= NUM_BLOCKS) { // Occasionally happens due to roundoff error.
}
y += (x < y ? -1 : 1);
x = (pos-y*NUM_BLOCKS+y*(y+1)/2);
}
// Skip over tiles that have exclusions, since they were already processed.
// Skip over tiles that have exclusions, since they were already processed.
while (nextToSkip < pos) {
while (nextToSkip < pos) {
if (currentSkipIndex < NUM_TILES_WITH_EXCLUSIONS) {
if (currentSkipIndex < NUM_TILES_WITH_EXCLUSIONS) {
ushort2 tile = exclusionTiles[currentSkipIndex++];
ushort2 tile = exclusionTiles[currentSkipIndex++];
nextToSkip = tile.x + tile.y*NUM_BLOCKS - tile.y*(tile.y+1)/2;
nextToSkip = tile.x + tile.y*NUM_BLOCKS - tile.y*(tile.y+1)/2;
}
else
nextToSkip = end;
}
}
includeTile = (nextToSkip != pos);
else
nextToSkip = end;
}
}
includeTile = (nextToSkip != pos);
#endif
if (includeTile) {
if (includeTile) {
// Load the data for this tile.
// Load the data for this tile.
...
...
platforms/opencl/src/kernels/pme.cl
View file @
73183c61
__kernel
void
updateBsplines
(
__global
const
real4*
restrict
posq,
__global
real4*
restrict
pmeBsplineTheta,
__local
real4*
restrict
bsplinesCache,
__kernel
void
updateBsplines
(
__global
const
real4*
restrict
posq,
__global
real4*
restrict
pmeBsplineTheta,
__local
real4*
restrict
bsplinesCache,
__global
int2*
restrict
pmeAtomGridIndex,
real4
periodicBoxSize,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
__global
int2*
restrict
pmeAtomGridIndex,
real4
periodicBoxSize,
real4
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
const
real4
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
const
real4
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
for
(
int
i
=
get_global_id
(
0
)
; i < NUM_ATOMS; i += get_global_size(0)) {
for
(
int
i
=
get_global_id
(
0
)
; i < NUM_ATOMS; i += get_global_size(0)) {
__local
real4*
data
=
&bsplinesCache[get_local_id
(
0
)
*PME_ORDER]
;
__local
real4*
data
=
&bsplinesCache[get_local_id
(
0
)
*PME_ORDER]
;
real4
pos
=
posq[i]
;
real4
pos
=
posq[i]
;
APPLY_PERIODIC_TO_POS
(
pos
)
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.z*recipBoxVecZ.z
)
;
pos.z*recipBoxVecZ.z
)
;
...
@@ -83,7 +85,8 @@ __kernel void recordZIndex(__global int2* restrict pmeAtomGridIndex, __global co
...
@@ -83,7 +85,8 @@ __kernel void recordZIndex(__global int2* restrict pmeAtomGridIndex, __global co
#
pragma
OPENCL
EXTENSION
cl_khr_int64_base_atomics
:
enable
#
pragma
OPENCL
EXTENSION
cl_khr_int64_base_atomics
:
enable
__kernel
void
gridSpreadCharge
(
__global
const
real4*
restrict
posq,
__global
const
int2*
restrict
pmeAtomGridIndex,
__global
const
int*
restrict
pmeAtomRange,
__kernel
void
gridSpreadCharge
(
__global
const
real4*
restrict
posq,
__global
const
int2*
restrict
pmeAtomGridIndex,
__global
const
int*
restrict
pmeAtomRange,
__global
long*
restrict
pmeGrid,
__global
const
real4*
restrict
pmeBsplineTheta,
real4
periodicBoxSize,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
__global
long*
restrict
pmeGrid,
__global
const
real4*
restrict
pmeBsplineTheta,
real4
periodicBoxSize,
real4
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
const
real
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
const
real
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
real4
data[PME_ORDER]
;
real4
data[PME_ORDER]
;
...
@@ -93,9 +96,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
...
@@ -93,9 +96,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
for
(
int
i
=
get_global_id
(
0
)
; i < NUM_ATOMS; i += get_global_size(0)) {
for
(
int
i
=
get_global_id
(
0
)
; i < NUM_ATOMS; i += get_global_size(0)) {
int
atom
=
pmeAtomGridIndex[i].x
;
int
atom
=
pmeAtomGridIndex[i].x
;
real4
pos
=
posq[atom]
;
real4
pos
=
posq[atom]
;
pos.x
-=
floor
(
pos.x*recipBoxVecX.x
)
*periodicBoxSize.x
;
APPLY_PERIODIC_TO_POS
(
pos
)
pos.y
-=
floor
(
pos.y*recipBoxVecY.y
)
*periodicBoxSize.y
;
pos.z
-=
floor
(
pos.z*recipBoxVecZ.z
)
*periodicBoxSize.z
;
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.z*recipBoxVecZ.z
)
;
pos.z*recipBoxVecZ.z
)
;
...
@@ -165,7 +166,8 @@ __kernel void finishSpreadCharge(__global long* restrict fixedGrid, __global rea
...
@@ -165,7 +166,8 @@ __kernel void finishSpreadCharge(__global long* restrict fixedGrid, __global rea
}
}
#
elif
defined
(
DEVICE_IS_CPU
)
#
elif
defined
(
DEVICE_IS_CPU
)
__kernel
void
gridSpreadCharge
(
__global
const
real4*
restrict
posq,
__global
const
int2*
restrict
pmeAtomGridIndex,
__global
const
int*
restrict
pmeAtomRange,
__kernel
void
gridSpreadCharge
(
__global
const
real4*
restrict
posq,
__global
const
int2*
restrict
pmeAtomGridIndex,
__global
const
int*
restrict
pmeAtomRange,
__global
real*
restrict
pmeGrid,
__global
const
real4*
restrict
pmeBsplineTheta,
real4
periodicBoxSize,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
__global
real*
restrict
pmeGrid,
__global
const
real4*
restrict
pmeBsplineTheta,
real4
periodicBoxSize,
real4
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
const
int
firstx
=
get_global_id
(
0
)
*GRID_SIZE_X/get_global_size
(
0
)
;
const
int
firstx
=
get_global_id
(
0
)
*GRID_SIZE_X/get_global_size
(
0
)
;
const
int
lastx
=
(
get_global_id
(
0
)
+1
)
*GRID_SIZE_X/get_global_size
(
0
)
;
const
int
lastx
=
(
get_global_id
(
0
)
+1
)
*GRID_SIZE_X/get_global_size
(
0
)
;
if
(
firstx
==
lastx
)
if
(
firstx
==
lastx
)
...
@@ -179,9 +181,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
...
@@ -179,9 +181,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
for
(
int
i
=
0
; i < NUM_ATOMS; i++) {
for
(
int
i
=
0
; i < NUM_ATOMS; i++) {
int
atom
=
i
;//pmeAtomGridIndex[i].x;
int
atom
=
i
;//pmeAtomGridIndex[i].x;
real4
pos
=
posq[atom]
;
real4
pos
=
posq[atom]
;
pos.x
-=
floor
(
pos.x*recipBoxVecX.x
)
*periodicBoxSize.x
;
APPLY_PERIODIC_TO_POS
(
pos
)
pos.y
-=
floor
(
pos.y*recipBoxVecY.y
)
*periodicBoxSize.y
;
pos.z
-=
floor
(
pos.z*recipBoxVecZ.z
)
*periodicBoxSize.z
;
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.z*recipBoxVecZ.z
)
;
pos.z*recipBoxVecZ.z
)
;
...
@@ -370,7 +370,8 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe
...
@@ -370,7 +370,8 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe
}
}
__kernel
void
gridInterpolateForce
(
__global
const
real4*
restrict
posq,
__global
real4*
restrict
forceBuffers,
__global
const
real*
restrict
pmeGrid,
__kernel
void
gridInterpolateForce
(
__global
const
real4*
restrict
posq,
__global
real4*
restrict
forceBuffers,
__global
const
real*
restrict
pmeGrid,
real4
periodicBoxSize,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ,
__global
int2*
restrict
pmeAtomGridIndex
)
{
real4
periodicBoxSize,
real4
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ,
__global
int2*
restrict
pmeAtomGridIndex
)
{
const
real
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
const
real
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
real4
data[PME_ORDER]
;
real4
data[PME_ORDER]
;
real4
ddata[PME_ORDER]
;
real4
ddata[PME_ORDER]
;
...
@@ -382,9 +383,7 @@ __kernel void gridInterpolateForce(__global const real4* restrict posq, __global
...
@@ -382,9 +383,7 @@ __kernel void gridInterpolateForce(__global const real4* restrict posq, __global
int
atom
=
pmeAtomGridIndex[i].x
;
int
atom
=
pmeAtomGridIndex[i].x
;
real4
force
=
0.0f
;
real4
force
=
0.0f
;
real4
pos
=
posq[atom]
;
real4
pos
=
posq[atom]
;
pos.x
-=
floor
(
pos.x*recipBoxVecX.x
)
*periodicBoxSize.x
;
APPLY_PERIODIC_TO_POS
(
pos
)
pos.y
-=
floor
(
pos.y*recipBoxVecY.y
)
*periodicBoxSize.y
;
pos.z
-=
floor
(
pos.z*recipBoxVecZ.z
)
*periodicBoxSize.z
;
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
real3
t
=
(
real3
)
(
pos.x*recipBoxVecX.x+pos.y*recipBoxVecY.x+pos.z*recipBoxVecZ.x,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.y*recipBoxVecY.y+pos.z*recipBoxVecZ.y,
pos.z*recipBoxVecZ.z
)
;
pos.z*recipBoxVecZ.z
)
;
...
...
platforms/opencl/src/kernels/torsionForce.cl
View file @
73183c61
...
@@ -2,6 +2,11 @@ const real PI = 3.14159265358979323846f;
...
@@ -2,6 +2,11 @@ const real PI = 3.14159265358979323846f;
real4
v0
=
(
real4
)
(
pos1.xyz-pos2.xyz,
0.0f
)
;
real4
v0
=
(
real4
)
(
pos1.xyz-pos2.xyz,
0.0f
)
;
real4
v1
=
(
real4
)
(
pos3.xyz-pos2.xyz,
0.0f
)
;
real4
v1
=
(
real4
)
(
pos3.xyz-pos2.xyz,
0.0f
)
;
real4
v2
=
(
real4
)
(
pos3.xyz-pos4.xyz,
0.0f
)
;
real4
v2
=
(
real4
)
(
pos3.xyz-pos4.xyz,
0.0f
)
;
#
if
APPLY_PERIODIC
APPLY_PERIODIC_TO_DELTA
(
v0
)
APPLY_PERIODIC_TO_DELTA
(
v1
)
APPLY_PERIODIC_TO_DELTA
(
v2
)
#
endif
real4
cp0
=
cross
(
v0,
v1
)
;
real4
cp0
=
cross
(
v0,
v1
)
;
real4
cp1
=
cross
(
v1,
v2
)
;
real4
cp1
=
cross
(
v1,
v2
)
;
real
cosangle
=
dot
(
normalize
(
cp0
)
,
normalize
(
cp1
))
;
real
cosangle
=
dot
(
normalize
(
cp0
)
,
normalize
(
cp1
))
;
...
...
platforms/opencl/tests/OpenCLTests.h
View file @
73183c61
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2015 Stanford University and the Authors.
*
* Portions copyright (c) 2015
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -39,9 +39,9 @@ OpenMM::OpenCLPlatform platform;
...
@@ -39,9 +39,9 @@ OpenMM::OpenCLPlatform platform;
void
initializeTests
(
int
argc
,
char
*
argv
[])
{
void
initializeTests
(
int
argc
,
char
*
argv
[])
{
if
(
argc
>
1
)
if
(
argc
>
1
)
platform
.
setPropertyDefaultValue
(
"
OpenCL
Precision"
,
std
::
string
(
argv
[
1
]));
platform
.
setPropertyDefaultValue
(
"Precision"
,
std
::
string
(
argv
[
1
]));
if
(
argc
>
2
)
if
(
argc
>
2
)
platform
.
setPropertyDefaultValue
(
"OpenCLPlatformIndex"
,
std
::
string
(
argv
[
2
]));
platform
.
setPropertyDefaultValue
(
"OpenCLPlatformIndex"
,
std
::
string
(
argv
[
2
]));
if
(
argc
>
3
)
if
(
argc
>
3
)
platform
.
setPropertyDefaultValue
(
"
OpenCL
DeviceIndex"
,
std
::
string
(
argv
[
3
]));
platform
.
setPropertyDefaultValue
(
"DeviceIndex"
,
std
::
string
(
argv
[
3
]));
}
}
platforms/reference/include/ReferenceAngleBondIxn.h
View file @
73183c61
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
~
ReferenceAngleBondIxn
();
~
ReferenceAngleBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get dEdR and energy term for angle bond
Get dEdR and energy term for angle bond
...
...
platforms/reference/include/ReferenceCMAPTorsionIxn.h
View file @
73183c61
...
@@ -38,6 +38,8 @@ private:
...
@@ -38,6 +38,8 @@ private:
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -65,6 +67,16 @@ public:
...
@@ -65,6 +67,16 @@ public:
const
std
::
vector
<
int
>&
torsionMaps
,
const
std
::
vector
<
int
>&
torsionMaps
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
torsionIndices
);
const
std
::
vector
<
std
::
vector
<
int
>
>&
torsionIndices
);
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate torsion interaction
Calculate torsion interaction
...
...
platforms/reference/include/ReferenceCustomAngleIxn.h
View file @
73183c61
/* Portions copyright (c) 2010-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2010-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -39,6 +39,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
...
@@ -39,6 +39,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
double
*
energyTheta
;
double
*
energyTheta
;
double
*
forceTheta
;
double
*
forceTheta
;
int
numParameters
;
int
numParameters
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -59,6 +61,16 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
...
@@ -59,6 +61,16 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
~
ReferenceCustomAngleIxn
();
~
ReferenceCustomAngleIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Custom Angle Ixn
Calculate Custom Angle Ixn
...
...
platforms/reference/include/ReferenceCustomBondIxn.h
View file @
73183c61
/* Portions copyright (c) 2009-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -40,6 +40,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
...
@@ -40,6 +40,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
double
*
energyR
;
double
*
energyR
;
double
*
forceR
;
double
*
forceR
;
int
numParameters
;
int
numParameters
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -60,6 +62,16 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
...
@@ -60,6 +62,16 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
~
ReferenceCustomBondIxn
();
~
ReferenceCustomBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Custom Bond Ixn
Calculate Custom Bond Ixn
...
...
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
View file @
73183c61
/* Portions copyright (c) 2009-201
5
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -50,6 +50,8 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
...
@@ -50,6 +50,8 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -94,6 +96,16 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
...
@@ -94,6 +96,16 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
~
ReferenceCustomCentroidBondIxn
();
~
ReferenceCustomCentroidBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get the list of groups in each bond.
Get the list of groups in each bond.
...
...
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
View file @
73183c61
/* Portions copyright (c) 2009-201
2
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -48,6 +48,8 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
...
@@ -48,6 +48,8 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -91,6 +93,16 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
...
@@ -91,6 +93,16 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
~
ReferenceCustomCompoundBondIxn
();
~
ReferenceCustomCompoundBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get the list atoms in each bond.
Get the list atoms in each bond.
...
...
platforms/reference/include/ReferenceCustomDynamics.h
View file @
73183c61
/* Portions copyright (c) 2011-201
5
Stanford University and Simbios.
/* Portions copyright (c) 2011-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -29,7 +29,8 @@
...
@@ -29,7 +29,8 @@
#include "openmm/CustomIntegrator.h"
#include "openmm/CustomIntegrator.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/CustomIntegratorUtilities.h"
#include "openmm/internal/CustomIntegratorUtilities.h"
#include "lepton/ExpressionProgram.h"
#include "openmm/internal/CompiledExpressionSet.h"
#include "lepton/CompiledExpression.h"
#include <map>
#include <map>
#include <string>
#include <string>
...
@@ -44,23 +45,27 @@ private:
...
@@ -44,23 +45,27 @@ private:
std
::
vector
<
RealOpenMM
>
inverseMasses
;
std
::
vector
<
RealOpenMM
>
inverseMasses
;
std
::
vector
<
OpenMM
::
RealVec
>
sumBuffer
,
oldPos
;
std
::
vector
<
OpenMM
::
RealVec
>
sumBuffer
,
oldPos
;
std
::
vector
<
OpenMM
::
CustomIntegrator
::
ComputationType
>
stepType
;
std
::
vector
<
OpenMM
::
CustomIntegrator
::
ComputationType
>
stepType
;
std
::
vector
<
std
::
string
>
stepVariable
,
forceName
,
energyName
;
std
::
vector
<
std
::
string
>
stepVariable
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
stepExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
stepExpressions
;
std
::
vector
<
CustomIntegratorUtilities
::
Comparison
>
comparisons
;
std
::
vector
<
CustomIntegratorUtilities
::
Comparison
>
comparisons
;
std
::
vector
<
bool
>
invalidatesForces
,
needsForces
,
needsEnergy
,
computeBothForceAndEnergy
;
std
::
vector
<
bool
>
invalidatesForces
,
needsForces
,
needsEnergy
,
computeBothForceAndEnergy
;
std
::
vector
<
int
>
forceGroupFlags
,
blockEnd
;
std
::
vector
<
int
>
forceGroupFlags
,
blockEnd
;
RealOpenMM
energy
;
RealOpenMM
energy
;
Lepton
::
Expression
Program
kineticEnergyExpression
;
Lepton
::
Compiled
Expression
kineticEnergyExpression
;
bool
kineticEnergyNeedsForce
;
bool
kineticEnergyNeedsForce
;
CompiledExpressionSet
expressionSet
;
int
xIndex
,
vIndex
,
mIndex
,
fIndex
,
energyIndex
,
gaussianIndex
,
uniformIndex
;
std
::
vector
<
int
>
forceVariableIndex
,
energyVariableIndex
,
perDofVariableIndex
,
stepVariableIndex
;
void
initialize
(
OpenMM
::
ContextImpl
&
context
,
std
::
vector
<
RealOpenMM
>&
masses
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
void
computePerDof
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
results
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
void
computePerDof
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
results
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
const
std
::
vector
<
RealOpenMM
>&
masses
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
const
std
::
vector
<
RealOpenMM
>&
masses
,
const
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
,
const
std
::
vector
<
std
::
vector
<
OpenMM
::
RealVec
>
>&
perDof
,
const
std
::
vector
<
std
::
vector
<
OpenMM
::
RealVec
>
>&
perDof
,
const
Lepton
::
CompiledExpression
&
expression
,
int
forceIndex
);
const
Lepton
::
ExpressionProgram
&
expression
,
const
std
::
string
&
forceName
);
void
recordChangedParameters
(
OpenMM
::
ContextImpl
&
context
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
void
recordChangedParameters
(
OpenMM
::
ContextImpl
&
context
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
bool
evaluateCondition
(
int
step
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
bool
evaluateCondition
(
int
step
);
public:
public:
...
...
platforms/reference/include/ReferenceCustomTorsionIxn.h
View file @
73183c61
/* Portions copyright (c) 2010-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2010-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -39,6 +39,8 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
...
@@ -39,6 +39,8 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
double
*
energyTheta
;
double
*
energyTheta
;
double
*
forceTheta
;
double
*
forceTheta
;
int
numParameters
;
int
numParameters
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -59,6 +61,16 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
...
@@ -59,6 +61,16 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
~
ReferenceCustomTorsionIxn
();
~
ReferenceCustomTorsionIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Custom Torsion Ixn
Calculate Custom Torsion Ixn
...
...
platforms/reference/include/ReferenceForce.h
View file @
73183c61
...
@@ -83,6 +83,19 @@ class OPENMM_EXPORT ReferenceForce {
...
@@ -83,6 +83,19 @@ class OPENMM_EXPORT ReferenceForce {
static
void
getDeltaR
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
static
void
getDeltaR
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
RealOpenMM
*
deltaR
);
RealOpenMM
*
deltaR
);
/**---------------------------------------------------------------------------------------
Get deltaR between atomI and atomJ (static method)
deltaR: j - i
@param atomCoordinatesI atom i coordinates
@param atomCoordinatesI atom j coordinates
@return the displacement
--------------------------------------------------------------------------------------- */
static
RealVec
getDeltaR
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get deltaR and distance and distance**2 between atomI and atomJ, assuming periodic
Get deltaR and distance and distance**2 between atomI and atomJ, assuming periodic
...
@@ -113,6 +126,21 @@ class OPENMM_EXPORT ReferenceForce {
...
@@ -113,6 +126,21 @@ class OPENMM_EXPORT ReferenceForce {
static
void
getDeltaRPeriodic
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
static
void
getDeltaRPeriodic
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
const
OpenMM
::
RealVec
*
boxVectors
,
RealOpenMM
*
deltaR
);
const
OpenMM
::
RealVec
*
boxVectors
,
RealOpenMM
*
deltaR
);
/**---------------------------------------------------------------------------------------
Get deltaR between atomI and atomJ, assuming periodic boundary conditions (static method);
deltaR: j - i
@param atomCoordinatesI atom i coordinates
@param atomCoordinatesI atom j coordinates
@param boxVectors the vectors defining the periodic box
@return the displacement
--------------------------------------------------------------------------------------- */
static
RealVec
getDeltaRPeriodic
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
const
OpenMM
::
RealVec
*
boxVectors
);
/**
/**
* Get a pointer to the memory for setting a variable in a CompiledExpression. If the expression
* Get a pointer to the memory for setting a variable in a CompiledExpression. If the expression
* does not use the specified variable, return NULL.
* does not use the specified variable, return NULL.
...
...
platforms/reference/include/ReferenceHarmonicBondIxn.h
View file @
73183c61
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -32,6 +32,9 @@ namespace OpenMM {
...
@@ -32,6 +32,9 @@ namespace OpenMM {
class
ReferenceHarmonicBondIxn
:
public
ReferenceBondIxn
{
class
ReferenceHarmonicBondIxn
:
public
ReferenceBondIxn
{
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -51,6 +54,16 @@ class ReferenceHarmonicBondIxn : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class ReferenceHarmonicBondIxn : public ReferenceBondIxn {
~
ReferenceHarmonicBondIxn
();
~
ReferenceHarmonicBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Harmonic Bond Ixn
Calculate Harmonic Bond Ixn
...
...
platforms/reference/include/ReferenceKernels.h
View file @
73183c61
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -172,7 +172,7 @@ public:
...
@@ -172,7 +172,7 @@ public:
* @param b the vector defining the second edge of the periodic box
* @param b the vector defining the second edge of the periodic box
* @param c the vector defining the third edge of the periodic box
* @param c the vector defining the third edge of the periodic box
*/
*/
void
setPeriodicBoxVectors
(
ContextImpl
&
context
,
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
)
const
;
void
setPeriodicBoxVectors
(
ContextImpl
&
context
,
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
);
/**
/**
* Create a checkpoint recording the current state of the Context.
* Create a checkpoint recording the current state of the Context.
*
*
...
@@ -280,6 +280,7 @@ private:
...
@@ -280,6 +280,7 @@ private:
int
numBonds
;
int
numBonds
;
int
**
bondIndexArray
;
int
**
bondIndexArray
;
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -319,6 +320,7 @@ private:
...
@@ -319,6 +320,7 @@ private:
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -356,6 +358,7 @@ private:
...
@@ -356,6 +358,7 @@ private:
int
numAngles
;
int
numAngles
;
int
**
angleIndexArray
;
int
**
angleIndexArray
;
RealOpenMM
**
angleParamArray
;
RealOpenMM
**
angleParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -395,6 +398,7 @@ private:
...
@@ -395,6 +398,7 @@ private:
RealOpenMM
**
angleParamArray
;
RealOpenMM
**
angleParamArray
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -432,6 +436,7 @@ private:
...
@@ -432,6 +436,7 @@ private:
int
numTorsions
;
int
numTorsions
;
int
**
torsionIndexArray
;
int
**
torsionIndexArray
;
RealOpenMM
**
torsionParamArray
;
RealOpenMM
**
torsionParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -469,6 +474,7 @@ private:
...
@@ -469,6 +474,7 @@ private:
int
numTorsions
;
int
numTorsions
;
int
**
torsionIndexArray
;
int
**
torsionIndexArray
;
RealOpenMM
**
torsionParamArray
;
RealOpenMM
**
torsionParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -505,6 +511,7 @@ private:
...
@@ -505,6 +511,7 @@ private:
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -544,6 +551,7 @@ private:
...
@@ -544,6 +551,7 @@ private:
RealOpenMM
**
torsionParamArray
;
RealOpenMM
**
torsionParamArray
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -860,6 +868,7 @@ private:
...
@@ -860,6 +868,7 @@ private:
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
ReferenceCustomCentroidBondIxn
*
ixn
;
ReferenceCustomCentroidBondIxn
*
ixn
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -898,6 +907,7 @@ private:
...
@@ -898,6 +907,7 @@ private:
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
ReferenceCustomCompoundBondIxn
*
ixn
;
ReferenceCustomCompoundBondIxn
*
ixn
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
...
platforms/reference/include/ReferenceProperDihedralBond.h
View file @
73183c61
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
~
ReferenceProperDihedralBond
();
~
ReferenceProperDihedralBond
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate proper dihedral bond ixn
Calculate proper dihedral bond ixn
...
...
platforms/reference/include/ReferenceRbDihedralBond.h
View file @
73183c61
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
~
ReferenceRbDihedralBond
();
~
ReferenceRbDihedralBond
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Ryckaert-Bellemans bond ixn
Calculate Ryckaert-Bellemans bond ixn
...
...
platforms/reference/include/ReferenceTabulatedFunction.h
View file @
73183c61
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2014 Stanford University and the Authors.
*
* Portions copyright (c) 2014
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -55,6 +55,7 @@ public:
...
@@ -55,6 +55,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
CustomFunction
*
clone
()
const
;
private:
private:
ReferenceContinuous1DFunction
(
const
ReferenceContinuous1DFunction
&
other
);
const
Continuous1DFunction
&
function
;
const
Continuous1DFunction
&
function
;
double
min
,
max
;
double
min
,
max
;
std
::
vector
<
double
>
x
,
values
,
derivs
;
std
::
vector
<
double
>
x
,
values
,
derivs
;
...
@@ -71,6 +72,7 @@ public:
...
@@ -71,6 +72,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
CustomFunction
*
clone
()
const
;
private:
private:
ReferenceContinuous2DFunction
(
const
ReferenceContinuous2DFunction
&
other
);
const
Continuous2DFunction
&
function
;
const
Continuous2DFunction
&
function
;
int
xsize
,
ysize
;
int
xsize
,
ysize
;
double
xmin
,
xmax
,
ymin
,
ymax
;
double
xmin
,
xmax
,
ymin
,
ymax
;
...
@@ -89,6 +91,7 @@ public:
...
@@ -89,6 +91,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
CustomFunction
*
clone
()
const
;
private:
private:
ReferenceContinuous3DFunction
(
const
ReferenceContinuous3DFunction
&
other
);
const
Continuous3DFunction
&
function
;
const
Continuous3DFunction
&
function
;
int
xsize
,
ysize
,
zsize
;
int
xsize
,
ysize
,
zsize
;
double
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
;
double
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
;
...
...
Prev
1
2
3
4
5
6
7
8
9
10
…
14
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