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
047934e2
Commit
047934e2
authored
Mar 01, 2017
by
Rafal P. Wiewiora
Browse files
Merge remote-tracking branch 'upstream/master'
parents
ce3a5dc0
d12c9bd1
Changes
351
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
271 additions
and
276 deletions
+271
-276
platforms/opencl/src/kernels/nonbonded.cl
platforms/opencl/src/kernels/nonbonded.cl
+1
-1
platforms/opencl/src/kernels/nonbonded_cpu.cl
platforms/opencl/src/kernels/nonbonded_cpu.cl
+1
-1
platforms/opencl/src/kernels/pme.cl
platforms/opencl/src/kernels/pme.cl
+94
-11
platforms/opencl/src/kernels/sort.cl
platforms/opencl/src/kernels/sort.cl
+12
-17
platforms/opencl/src/kernels/utilities.cl
platforms/opencl/src/kernels/utilities.cl
+8
-0
platforms/opencl/staticTarget/CMakeLists.txt
platforms/opencl/staticTarget/CMakeLists.txt
+1
-2
platforms/opencl/tests/TestOpenCLDispersionPME.cpp
platforms/opencl/tests/TestOpenCLDispersionPME.cpp
+36
-0
platforms/reference/include/ObcParameters.h
platforms/reference/include/ObcParameters.h
+37
-37
platforms/reference/include/RealVec.h
platforms/reference/include/RealVec.h
+4
-133
platforms/reference/include/ReferenceAndersenThermostat.h
platforms/reference/include/ReferenceAndersenThermostat.h
+3
-2
platforms/reference/include/ReferenceAngleBondIxn.h
platforms/reference/include/ReferenceAngleBondIxn.h
+8
-7
platforms/reference/include/ReferenceBondForce.h
platforms/reference/include/ReferenceBondForce.h
+3
-3
platforms/reference/include/ReferenceBondIxn.h
platforms/reference/include/ReferenceBondIxn.h
+11
-11
platforms/reference/include/ReferenceBrownianDynamics.h
platforms/reference/include/ReferenceBrownianDynamics.h
+7
-7
platforms/reference/include/ReferenceCCMAAlgorithm.h
platforms/reference/include/ReferenceCCMAAlgorithm.h
+17
-17
platforms/reference/include/ReferenceCMAPTorsionIxn.h
platforms/reference/include/ReferenceCMAPTorsionIxn.h
+10
-10
platforms/reference/include/ReferenceConstraintAlgorithm.h
platforms/reference/include/ReferenceConstraintAlgorithm.h
+6
-5
platforms/reference/include/ReferenceConstraints.h
platforms/reference/include/ReferenceConstraints.h
+2
-2
platforms/reference/include/ReferenceCustomAngleIxn.h
platforms/reference/include/ReferenceCustomAngleIxn.h
+5
-5
platforms/reference/include/ReferenceCustomBondIxn.h
platforms/reference/include/ReferenceCustomBondIxn.h
+5
-5
No files found.
platforms/opencl/src/kernels/nonbonded.cl
View file @
047934e2
...
...
@@ -269,7 +269,7 @@ __kernel void computeNonbonded(
LOAD_ATOM1_PARAMETERS
const unsigned int localAtomIndex = get_local_id(0);
#ifdef USE_CUTOFF
unsigned int j =
(numTiles <= maxTiles ?
interactingAtoms[pos*TILE_SIZE+tgx]
: y*TILE_SIZE + tgx)
;
unsigned int j = interactingAtoms[pos*TILE_SIZE+tgx];
#else
unsigned int j = y*TILE_SIZE + tgx;
#endif
...
...
platforms/opencl/src/kernels/nonbonded_cpu.cl
View file @
047934e2
...
...
@@ -269,7 +269,7 @@ __kernel void computeNonbonded(
for (int localAtomIndex = 0; localAtomIndex < TILE_SIZE; localAtomIndex++) {
#ifdef USE_CUTOFF
unsigned int j =
(numTiles <= maxTiles ?
interactingAtoms[pos*TILE_SIZE+localAtomIndex]
: y*TILE_SIZE+localAtomIndex)
;
unsigned int j = interactingAtoms[pos*TILE_SIZE+localAtomIndex];
#else
unsigned int j = y*TILE_SIZE+localAtomIndex;
#endif
...
...
platforms/opencl/src/kernels/pme.cl
View file @
047934e2
__kernel
void
updateBsplines
(
__global
const
real4*
restrict
posq,
__global
real4*
restrict
pmeBsplineTheta,
__local
real4*
restrict
bsplinesCache,
__global
int2*
restrict
pmeAtomGridIndex,
real4
periodicBoxSize,
real4
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
#
ifdef
USE_LJPME
,
__global
const
float2*
restrict
sigmaEpsilon
#
endif
)
{
const
real4
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
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]
;
...
...
@@ -33,7 +37,13 @@ __kernel void updateBsplines(__global const real4* restrict posq, __global real4
data[PME_ORDER-j-1]
=
scale*
((
dr+
(
real4
)
j
)
*data[PME_ORDER-j-2]
+
(
-dr+
(
real4
)
(
PME_ORDER-j
))
*data[PME_ORDER-j-1]
)
;
data[0]
=
scale*
(
-dr+1.0f
)
*data[0]
;
for
(
int
j
=
0
; j < PME_ORDER; j++) {
data[j].w
=
pos.w
; // Storing the charge here improves cache coherency in the charge spreading kernel
#
ifdef
USE_LJPME
const
float2
sigEps
=
sigmaEpsilon[i]
;
const
real
charge
=
8*sigEps.x*sigEps.x*sigEps.x*sigEps.y
;
#
else
const
real
charge
=
pos.w
;
#
endif
data[j].w
=
charge
; // Storing the charge here improves cache coherency in the charge spreading kernel
pmeBsplineTheta[i+j*NUM_ATOMS]
=
data[j]
;
}
#
endif
...
...
@@ -86,7 +96,11 @@ __kernel void recordZIndex(__global int2* restrict pmeAtomGridIndex, __global co
__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
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
#
ifdef
USE_LJPME
,
__global
const
float2*
restrict
sigmaEpsilon
#
endif
)
{
const
real
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
real4
data[PME_ORDER]
;
...
...
@@ -128,6 +142,12 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
//
Spread
the
charge
from
this
atom
onto
each
grid
point.
#
ifdef
USE_LJPME
const
float2
sigEps
=
sigmaEpsilon[atom]
;
const
real
charge
=
8*sigEps.x*sigEps.x*sigEps.x*sigEps.y
;
#
else
const
real
charge
=
pos.w
;
#
endif
for
(
int
ix
=
0
; ix < PME_ORDER; ix++) {
int
xindex
=
gridIndex.x+ix
;
xindex
-=
(
xindex
>=
GRID_SIZE_X
?
GRID_SIZE_X
:
0
)
;
...
...
@@ -138,7 +158,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
int
zindex
=
gridIndex.z+iz
;
zindex
-=
(
zindex
>=
GRID_SIZE_Z
?
GRID_SIZE_Z
:
0
)
;
int
index
=
xindex*GRID_SIZE_Y*GRID_SIZE_Z
+
yindex*GRID_SIZE_Z
+
zindex
;
real
add
=
pos.w
*data[ix].x*data[iy].y*data[iz].z
;
real
add
=
charge
*data[ix].x*data[iy].y*data[iz].z
;
#
ifdef
USE_ALTERNATE_MEMORY_ACCESS_PATTERN
//
On
Nvidia
devices
(
at
least
Maxwell
anyway
)
,
this
split
ordering
produces
much
higher
performance.
Why?
//
I
have
no
idea!
And
of
course
on
AMD
it
produces
slower
performance.
GPUs
are
not
meant
to
be
understood.
...
...
@@ -167,7 +187,11 @@ __kernel void finishSpreadCharge(__global long* restrict fixedGrid, __global rea
#
elif
defined
(
DEVICE_IS_CPU
)
__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
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
)
{
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ
#
ifdef
USE_LJPME
,
__global
const
float2*
restrict
sigmaEpsilon
#
endif
)
{
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
)
;
if
(
firstx
==
lastx
)
...
...
@@ -194,6 +218,12 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
//
Spread
the
charge
from
this
atom
onto
each
grid
point.
#
ifdef
USE_LJPME
const
float2
sigEps
=
sigmaEpsilon[atom]
;
const
real
charge
=
8*sigEps.x*sigEps.x*sigEps.x*sigEps.y
;
#
else
const
real
charge
=
pos.w
;
#
endif
bool
hasComputedThetas
=
false
;
for
(
int
ix
=
0
; ix < PME_ORDER; ix++) {
int
xindex
=
gridIndex.x+ix
;
...
...
@@ -229,7 +259,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
int zindex = gridIndex.z+iz;
zindex -= (zindex >= GRID_SIZE_Z ? GRID_SIZE_Z : 0);
int index = xindex*GRID_SIZE_Y*GRID_SIZE_Z + yindex*GRID_SIZE_Z + zindex;
pmeGrid[index] += EPSILON_FACTOR*
pos.w
*data[ix].x*data[iy].y*data[iz].z;
pmeGrid[index] += EPSILON_FACTOR*
charge
*data[ix].x*data[iy].y*data[iz].z;
}
}
}
...
...
@@ -237,7 +267,11 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
}
#else
__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) {
__global real* restrict pmeGrid, __global const real4* restrict pmeBsplineTheta
#ifdef USE_LJPME
, __global const float2* restrict sigmaEpsilon
#endif
) {
unsigned int numGridPoints = GRID_SIZE_X*GRID_SIZE_Y*GRID_SIZE_Z;
for (int gridIndex = get_global_id(0); gridIndex < numGridPoints; gridIndex += get_global_size(0)) {
// Compute the charge on a grid point.
...
...
@@ -298,7 +332,15 @@ __kernel void reciprocalConvolution(__global real2* restrict pmeGrid, __global c
__global const real* restrict pmeBsplineModuliY, __global const real* restrict pmeBsplineModuliZ, real4 recipBoxVecX, real4 recipBoxVecY, real4 recipBoxVecZ) {
// R2C stores into a half complex matrix where the last dimension is cut by half
const unsigned int gridSize = GRID_SIZE_X*GRID_SIZE_Y*(GRID_SIZE_Z/2+1);
#ifdef USE_LJPME
const real recipScaleFactor = -(2*M_PI/6)*SQRT(M_PI)*recipBoxVecX.x*recipBoxVecY.y*recipBoxVecZ.z;
real bfac = M_PI / EWALD_ALPHA;
real fac1 = 2*M_PI*M_PI*M_PI*SQRT(M_PI);
real fac2 = EWALD_ALPHA*EWALD_ALPHA*EWALD_ALPHA;
real fac3 = -2*EWALD_ALPHA*M_PI*M_PI;
#else
const real recipScaleFactor = (1.0f/M_PI)*recipBoxVecX.x*recipBoxVecY.y*recipBoxVecZ.z;
#endif
for (int index = get_global_id(0); index < gridSize; index += get_global_size(0)) {
// real indices
...
...
@@ -317,11 +359,23 @@ __kernel void reciprocalConvolution(__global real2* restrict pmeGrid, __global c
real bz = pmeBsplineModuliZ[kz];
real2 grid = pmeGrid[index];
real m2 = mhx*mhx+mhy*mhy+mhz*mhz;
#ifdef USE_LJPME
real denom = recipScaleFactor/(bx*by*bz);
real m = SQRT(m2);
real m3 = m*m2;
real b = bfac*m;
real expfac = -b*b;
real expterm = EXP(expfac);
real erfcterm = erfc(b);
real eterm = (fac1*erfcterm*m3 + expterm*(fac2 + fac3*m2)) * denom;
pmeGrid[index] = (real2) (grid.x*eterm, grid.y*eterm);
#else
real denom = m2*bx*by*bz;
real eterm = recipScaleFactor*EXP(-RECIP_EXP_FACTOR*m2)/denom;
if (kx != 0 || ky != 0 || kz != 0) {
pmeGrid[index] = (real2) (grid.x*eterm, grid.y*eterm);
}
#endif
}
}
...
...
@@ -330,7 +384,15 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe
real4 recipBoxVecX, real4 recipBoxVecY, real4 recipBoxVecZ) {
// R2C stores into a half complex matrix where the last dimension is cut by half
const unsigned int gridSize = GRID_SIZE_X*GRID_SIZE_Y*GRID_SIZE_Z;
#ifdef USE_LJPME
const real recipScaleFactor = -(2*M_PI/6)*SQRT(M_PI)*recipBoxVecX.x*recipBoxVecY.y*recipBoxVecZ.z;
real bfac = M_PI / EWALD_ALPHA;
real fac1 = 2*M_PI*M_PI*M_PI*SQRT(M_PI);
real fac2 = EWALD_ALPHA*EWALD_ALPHA*EWALD_ALPHA;
real fac3 = -2*EWALD_ALPHA*M_PI*M_PI;
#else
const real recipScaleFactor = (1.0f/M_PI)*recipBoxVecX.x*recipBoxVecY.y*recipBoxVecZ.z;
#endif
mixed energy = 0;
for (int index = get_global_id(0); index < gridSize; index += get_global_size(0)) {
...
...
@@ -349,8 +411,19 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe
real bx = pmeBsplineModuliX[kx];
real by = pmeBsplineModuliY[ky];
real bz = pmeBsplineModuliZ[kz];
#ifdef USE_LJPME
real denom = recipScaleFactor/(bx*by*bz);
real m = SQRT(m2);
real m3 = m*m2;
real b = bfac*m;
real expfac = -b*b;
real expterm = EXP(expfac);
real erfcterm = erfc(b);
real eterm = (fac1*erfcterm*m3 + expterm*(fac2 + fac3*m2)) * denom;
#else
real denom = m2*bx*by*bz;
real eterm = recipScaleFactor*EXP(-RECIP_EXP_FACTOR*m2)/denom;
#endif
if (kz >= (GRID_SIZE_Z/2+1)) {
kx = ((kx == 0) ? kx : GRID_SIZE_X-kx);
ky = ((ky == 0) ? ky : GRID_SIZE_Y-ky);
...
...
@@ -358,11 +431,12 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe
}
int indexInHalfComplexGrid = kz + ky*(GRID_SIZE_Z/2+1)+kx*(GRID_SIZE_Y*(GRID_SIZE_Z/2+1));
real2 grid = pmeGrid[indexInHalfComplexGrid];
if (kx != 0 || ky != 0 |
|
kz
!=
0
)
{
#ifndef USE_LJPME
if (kx != 0 || ky != 0 |
|
kz
!=
0
)
#
endif
energy
+=
eterm*
(
grid.x*grid.x
+
grid.y*grid.y
)
;
}
}
#
ifdef
USE_PME_STREAM
#
if
defined
(
USE_PME_STREAM
)
&&
!defined
(
USE_LJPME
)
energyBuffer[get_global_id
(
0
)
]
=
0.5f*energy
;
#
else
energyBuffer[get_global_id
(
0
)
]
+=
0.5f*energy
;
...
...
@@ -371,7 +445,11 @@ __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,
real4
periodicBoxSize,
real4
invPeriodicBoxSize,
real4
periodicBoxVecX,
real4
periodicBoxVecY,
real4
periodicBoxVecZ,
real4
recipBoxVecX,
real4
recipBoxVecY,
real4
recipBoxVecZ,
__global
int2*
restrict
pmeAtomGridIndex
)
{
real4
recipBoxVecY,
real4
recipBoxVecZ,
__global
int2*
restrict
pmeAtomGridIndex
#
ifdef
USE_LJPME
,
__global
const
float2*
restrict
sigmaEpsilon
#
endif
)
{
const
real
scale
=
1/
(
real
)
(
PME_ORDER-1
)
;
real4
data[PME_ORDER]
;
real4
ddata[PME_ORDER]
;
...
...
@@ -436,7 +514,12 @@ __kernel void gridInterpolateForce(__global const real4* restrict posq, __global
}
}
real4
totalForce
=
forceBuffers[atom]
;
#
ifdef
USE_LJPME
const
float2
sigEps
=
sigmaEpsilon[atom]
;
real
q
=
8*sigEps.x*sigEps.x*sigEps.x*sigEps.y
;
#
else
real
q
=
pos.w*EPSILON_FACTOR
;
#
endif
totalForce.x
-=
q*
(
force.x*GRID_SIZE_X*recipBoxVecX.x
)
;
totalForce.y
-=
q*
(
force.x*GRID_SIZE_X*recipBoxVecY.x+force.y*GRID_SIZE_Y*recipBoxVecY.y
)
;
totalForce.z
-=
q*
(
force.x*GRID_SIZE_X*recipBoxVecZ.x+force.y*GRID_SIZE_Y*recipBoxVecZ.y+force.z*GRID_SIZE_Z*recipBoxVecZ.z
)
;
...
...
platforms/opencl/src/kernels/sort.cl
View file @
047934e2
...
...
@@ -8,7 +8,7 @@ KEY_TYPE getValue(DATA_TYPE value) {
*
Sort
a
list
that
is
short
enough
to
entirely
fit
in
local
memory.
This
is
executed
as
*
a
single
thread
block.
*/
__kernel
void
sortShortList
(
__global
DATA_TYPE*
__
restrict
__
data,
uint
length,
__local
DATA_TYPE*
dataBuffer
)
{
__kernel
void
sortShortList
(
__global
DATA_TYPE*
restrict
data,
uint
length,
__local
DATA_TYPE*
dataBuffer
)
{
//
Load
the
data
into
local
memory.
for
(
int
index
=
get_local_id
(
0
)
; index < length; index += get_local_size(0))
...
...
@@ -49,8 +49,8 @@ __kernel void sortShortList(__global DATA_TYPE* __restrict__ data, uint length,
*
Calculate
the
minimum
and
maximum
value
in
the
array
to
be
sorted.
This
kernel
*
is
executed
as
a
single
work
group.
*/
__kernel
void
computeRange
(
__global
const
DATA_TYPE*
restrict
data,
uint
length,
__global
KEY_TYPE*
restrict
range,
__local
KEY_TYPE*
restrict
b
uffer,
uint
numBuckets,
__global
uint*
restrict
bucketOffset
)
{
__kernel
void
computeRange
(
__global
const
DATA_TYPE*
restrict
data,
uint
length,
__global
KEY_TYPE*
restrict
range,
__local
KEY_TYPE*
restrict
minB
uffer,
__local
KEY_TYPE*
restrict
maxBuffer,
uint
numBuckets,
__global
uint*
restrict
bucketOffset
)
{
KEY_TYPE
minimum
=
MAX_KEY
;
KEY_TYPE
maximum
=
MIN_KEY
;
...
...
@@ -64,23 +64,18 @@ __kernel void computeRange(__global const DATA_TYPE* restrict data, uint length,
//
Now
reduce
them.
buffer[get_local_id
(
0
)
]
=
minimum
;
minBuffer[get_local_id
(
0
)
]
=
minimum
;
maxBuffer[get_local_id
(
0
)
]
=
maximum
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
for
(
uint
step
=
1
; step < get_local_size(0); step *= 2) {
if
(
get_local_id
(
0
)
+step
<
get_local_size
(
0
)
&&
get_local_id
(
0
)
%
(
2*step
)
==
0
)
b
uffer[get_local_id
(
0
)
]
=
min
(
b
uffer[get_local_id
(
0
)
],
b
uffer[get_local_id
(
0
)
+step]
)
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
if
(
get_local_id
(
0
)
+step
<
get_local_size
(
0
)
&&
get_local_id
(
0
)
%
(
2*step
)
==
0
)
{
minB
uffer[get_local_id
(
0
)
]
=
min
(
minB
uffer[get_local_id
(
0
)
],
minB
uffer[get_local_id
(
0
)
+step]
)
;
maxBuffer[get_local_id
(
0
)
]
=
max
(
maxBuffer[get_local_id
(
0
)
],
maxBuffer[get_local_id
(
0
)
+step]
)
;
}
minimum
=
buffer[0]
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
buffer[get_local_id
(
0
)
]
=
maximum
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
for
(
uint
step
=
1
; step < get_local_size(0); step *= 2) {
if
(
get_local_id
(
0
)
+step
<
get_local_size
(
0
)
&&
get_local_id
(
0
)
%
(
2*step
)
==
0
)
buffer[get_local_id
(
0
)
]
=
max
(
buffer[get_local_id
(
0
)
],
buffer[get_local_id
(
0
)
+step]
)
;
barrier
(
CLK_LOCAL_MEM_FENCE
)
;
}
maximum
=
buffer[0]
;
minimum
=
minBuffer[0]
;
maximum
=
maxBuffer[0]
;
if
(
get_local_id
(
0
)
==
0
)
{
range[0]
=
minimum
;
range[1]
=
maximum
;
...
...
@@ -96,7 +91,7 @@ __kernel void computeRange(__global const DATA_TYPE* restrict data, uint length,
*
Assign
elements
to
buckets.
*/
__kernel
void
assignElementsToBuckets
(
__global
const
DATA_TYPE*
restrict
data,
uint
length,
uint
numBuckets,
__global
const
KEY_TYPE*
restrict
range,
__global
uint*
bucketOffset,
__global
uint*
restrict
bucketOfElement,
__global
uint*
restrict
offsetInBucket
)
{
__global
uint*
restrict
bucketOffset,
__global
uint*
restrict
bucketOfElement,
__global
uint*
restrict
offsetInBucket
)
{
#
ifdef
AMD_ATOMIC_WORK_AROUND
//
Do
a
byte
write
to
force
all
memory
accesses
to
interactionCount
to
use
the
complete
path.
//
This
avoids
the
atomic
access
from
causing
all
word
accesses
to
other
buffers
from
using
the
slow
complete
path.
...
...
platforms/opencl/src/kernels/utilities.cl
View file @
047934e2
...
...
@@ -107,3 +107,11 @@ __kernel void determineNativeAccuracy(__global float8* restrict values, int numV
values[i]
=
(
float8
)
(
v,
native_sqrt
(
v
)
,
native_rsqrt
(
v
)
,
native_recip
(
v
)
,
native_exp
(
v
)
,
native_log
(
v
)
,
0.0f,
0.0f
)
;
}
}
/**
*
Record
the
atomic
charges
into
the
posq
array.
*/
__kernel
void
setCharges
(
__global
real*
restrict
charges,
__global
real4*
restrict
posq,
__global
int*
restrict
atomOrder,
int
numAtoms
)
{
for
(
int
i
=
get_global_id
(
0
)
; i < numAtoms; i += get_global_size(0))
posq[i].w
=
charges[atomOrder[i]]
;
}
\ No newline at end of file
platforms/opencl/staticTarget/CMakeLists.txt
View file @
047934e2
...
...
@@ -14,7 +14,6 @@ SET_SOURCE_FILES_PROPERTIES(${CL_KERNELS_CPP} ${CL_KERNELS_H} PROPERTIES GENERAT
ADD_LIBRARY
(
${
STATIC_TARGET
}
STATIC
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
TARGET_LINK_LIBRARIES
(
${
STATIC_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
OPENCL_LIBRARIES
}
${
PTHREADS_LIB_STATIC
}
)
#-DPTW32_STATIC_LIB only works for the windows pthreads.
SET_TARGET_PROPERTIES
(
${
STATIC_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_OPENCL_BUILDING_STATIC_LIBRARY -DPTW32_STATIC_LIB"
)
SET_TARGET_PROPERTIES
(
${
STATIC_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_OPENCL_BUILDING_STATIC_LIBRARY"
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
STATIC_TARGET
}
)
platforms/opencl/tests/TestOpenCLDispersionPME.cpp
0 → 100644
View file @
047934e2
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2017 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "OpenCLTests.h"
#include "TestDispersionPME.h"
void
runPlatformTests
()
{
}
platforms/reference/include/ObcParameters.h
View file @
047934e2
...
...
@@ -25,7 +25,7 @@
#ifndef __ObcParameters_H__
#define __ObcParameters_H__
#include "
Real
Vec.h"
#include "
openmm/
Vec
3
.h"
#include <vector>
namespace
OpenMM
{
...
...
@@ -44,29 +44,29 @@ class ObcParameters {
int
_numberOfAtoms
;
RealOpenMM
_solventDielectric
;
RealOpenMM
_soluteDielectric
;
RealOpenMM
_electricConstant
;
RealOpenMM
_probeRadius
;
RealOpenMM
_pi4Asolv
;
double
_solventDielectric
;
double
_soluteDielectric
;
double
_electricConstant
;
double
_probeRadius
;
double
_pi4Asolv
;
RealOpenMM
_dielectricOffset
;
RealOpenMM
_alphaObc
;
RealOpenMM
_betaObc
;
RealOpenMM
_gammaObc
;
double
_dielectricOffset
;
double
_alphaObc
;
double
_betaObc
;
double
_gammaObc
;
ObcType
_obcType
;
// scaled radius factors (S_kk in HCT paper)
std
::
vector
<
RealOpenMM
>
_atomicRadii
;
std
::
vector
<
RealOpenMM
>
_scaledRadiusFactors
;
std
::
vector
<
double
>
_atomicRadii
;
std
::
vector
<
double
>
_scaledRadiusFactors
;
// cutoff and periodic boundary conditions
bool
_cutoff
;
bool
_periodic
;
OpenMM
::
Real
Vec
_periodicBoxVectors
[
3
];
RealOpenMM
_cutoffDistance
;
OpenMM
::
Vec
3
_periodicBoxVectors
[
3
];
double
_cutoffDistance
;
/**---------------------------------------------------------------------------------------
...
...
@@ -76,7 +76,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setDielectricOffset
(
RealOpenMM
dielectricOffset
);
void
setDielectricOffset
(
double
dielectricOffset
);
public:
...
...
@@ -116,7 +116,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getElectricConstant
()
const
;
double
getElectricConstant
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -126,7 +126,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getProbeRadius
()
const
;
double
getProbeRadius
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -136,18 +136,18 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setProbeRadius
(
RealOpenMM
probeRadius
);
void
setProbeRadius
(
double
probeRadius
);
/**---------------------------------------------------------------------------------------
Get pi4Asolv: used in ACE approximation for nonpolar term
((RealOpenMM)
M_PI
)
*4.0f*0.0049f*1000.0f; (Simbios)
M_PI*4.0f*0.0049f*1000.0f; (Simbios)
@return pi4Asolv
--------------------------------------------------------------------------------------- */
RealOpenMM
getPi4Asolv
()
const
;
double
getPi4Asolv
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -155,7 +155,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setPi4Asolv
(
RealOpenMM
pi4Asolv
);
void
setPi4Asolv
(
double
pi4Asolv
);
/**---------------------------------------------------------------------------------------
...
...
@@ -165,7 +165,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getSolventDielectric
()
const
;
double
getSolventDielectric
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -175,7 +175,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setSolventDielectric
(
RealOpenMM
solventDielectric
);
void
setSolventDielectric
(
double
solventDielectric
);
/**---------------------------------------------------------------------------------------
...
...
@@ -185,7 +185,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getSoluteDielectric
()
const
;
double
getSoluteDielectric
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -195,7 +195,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setSoluteDielectric
(
RealOpenMM
soluteDielectric
);
void
setSoluteDielectric
(
double
soluteDielectric
);
/**---------------------------------------------------------------------------------------
...
...
@@ -225,7 +225,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getAlphaObc
()
const
;
double
getAlphaObc
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -235,7 +235,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getBetaObc
()
const
;
double
getBetaObc
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -245,7 +245,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getGammaObc
()
const
;
double
getGammaObc
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -255,7 +255,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getDielectricOffset
()
const
;
double
getDielectricOffset
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -265,7 +265,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
const
std
::
vector
<
RealOpenMM
>&
getScaledRadiusFactors
()
const
;
const
std
::
vector
<
double
>&
getScaledRadiusFactors
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -275,7 +275,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setScaledRadiusFactors
(
const
std
::
vector
<
RealOpenMM
>&
scaledRadiusFactors
);
void
setScaledRadiusFactors
(
const
std
::
vector
<
double
>&
scaledRadiusFactors
);
/**---------------------------------------------------------------------------------------
...
...
@@ -285,7 +285,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
const
std
::
vector
<
RealOpenMM
>&
getAtomicRadii
()
const
;
const
std
::
vector
<
double
>&
getAtomicRadii
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -295,7 +295,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setAtomicRadii
(
const
std
::
vector
<
RealOpenMM
>&
atomicRadii
);
void
setAtomicRadii
(
const
std
::
vector
<
double
>&
atomicRadii
);
/**---------------------------------------------------------------------------------------
...
...
@@ -306,7 +306,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setUseCutoff
(
RealOpenMM
distance
);
void
setUseCutoff
(
double
distance
);
/**---------------------------------------------------------------------------------------
...
...
@@ -322,7 +322,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
RealOpenMM
getCutoffDistance
()
const
;
double
getCutoffDistance
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -334,7 +334,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
Real
Vec
*
vectors
);
void
setPeriodic
(
OpenMM
::
Vec
3
*
vectors
);
/**---------------------------------------------------------------------------------------
...
...
@@ -350,7 +350,7 @@ class ObcParameters {
--------------------------------------------------------------------------------------- */
const
OpenMM
::
Real
Vec
*
getPeriodicBox
();
const
OpenMM
::
Vec
3
*
getPeriodicBox
();
};
...
...
platforms/reference/include/RealVec.h
View file @
047934e2
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
7
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -34,143 +34,14 @@
#include "SimTKOpenMMRealType.h"
#include "openmm/Vec3.h"
#include <cassert>
#include <iosfwd>
namespace
OpenMM
{
/**
* This is identical to Vec3, except that the components are of type RealOpenMM, so
* it can be compiled in either single or double precision. Automatic conversion
* between this class and Vec3 is supported.
*/
class
RealVec
{
public:
/**
* Create a RealVec whose elements are all 0.
*/
RealVec
()
{
data
[
0
]
=
data
[
1
]
=
data
[
2
]
=
0.0
;
}
/**
* Create a RealVec with specified x, y, and z components.
*/
RealVec
(
RealOpenMM
x
,
RealOpenMM
y
,
RealOpenMM
z
)
{
data
[
0
]
=
x
;
data
[
1
]
=
y
;
data
[
2
]
=
z
;
}
/**
* Create a RealVec from a Vec3.
* This file exists only for backward compatibility. RealVec is now just a typedef for Vec3.
*/
RealVec
(
Vec3
v
)
{
data
[
0
]
=
v
[
0
];
data
[
1
]
=
v
[
1
];
data
[
2
]
=
v
[
2
];
}
/**
* Create a Vec3 from a RealVec.
*/
operator
Vec3
()
const
{
return
Vec3
(
data
[
0
],
data
[
1
],
data
[
2
]);
}
RealOpenMM
operator
[](
int
index
)
const
{
assert
(
index
>=
0
&&
index
<
3
);
return
data
[
index
];
}
RealOpenMM
&
operator
[](
int
index
)
{
assert
(
index
>=
0
&&
index
<
3
);
return
data
[
index
];
}
// Arithmetic operators
// unary plus
RealVec
operator
+
()
const
{
return
RealVec
(
*
this
);
}
// plus
RealVec
operator
+
(
const
RealVec
&
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
return
RealVec
(
lhs
[
0
]
+
rhs
[
0
],
lhs
[
1
]
+
rhs
[
1
],
lhs
[
2
]
+
rhs
[
2
]);
}
RealVec
&
operator
+=
(
const
RealVec
&
rhs
)
{
data
[
0
]
+=
rhs
[
0
];
data
[
1
]
+=
rhs
[
1
];
data
[
2
]
+=
rhs
[
2
];
return
*
this
;
}
// unary minus
RealVec
operator
-
()
const
{
const
RealVec
&
lhs
=
*
this
;
return
RealVec
(
-
lhs
[
0
],
-
lhs
[
1
],
-
lhs
[
2
]);
}
// minus
RealVec
operator
-
(
const
RealVec
&
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
return
RealVec
(
lhs
[
0
]
-
rhs
[
0
],
lhs
[
1
]
-
rhs
[
1
],
lhs
[
2
]
-
rhs
[
2
]);
}
RealVec
&
operator
-=
(
const
RealVec
&
rhs
)
{
data
[
0
]
-=
rhs
[
0
];
data
[
1
]
-=
rhs
[
1
];
data
[
2
]
-=
rhs
[
2
];
return
*
this
;
}
// scalar product
RealVec
operator
*
(
RealOpenMM
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
return
RealVec
(
lhs
[
0
]
*
rhs
,
lhs
[
1
]
*
rhs
,
lhs
[
2
]
*
rhs
);
}
RealVec
&
operator
*=
(
RealOpenMM
rhs
)
{
data
[
0
]
*=
rhs
;
data
[
1
]
*=
rhs
;
data
[
2
]
*=
rhs
;
return
*
this
;
}
// scalar division
RealVec
operator
/
(
double
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
double
scale
=
1.0
/
rhs
;
return
RealVec
(
lhs
[
0
]
*
scale
,
lhs
[
1
]
*
scale
,
lhs
[
2
]
*
scale
);
}
RealVec
&
operator
/=
(
double
rhs
)
{
double
scale
=
1.0
/
rhs
;
data
[
0
]
*=
scale
;
data
[
1
]
*=
scale
;
data
[
2
]
*=
scale
;
return
*
this
;
}
// dot product
RealOpenMM
dot
(
const
RealVec
&
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
return
lhs
[
0
]
*
rhs
[
0
]
+
lhs
[
1
]
*
rhs
[
1
]
+
lhs
[
2
]
*
rhs
[
2
];
}
// cross product
RealVec
cross
(
const
RealVec
&
rhs
)
const
{
return
RealVec
(
data
[
1
]
*
rhs
[
2
]
-
data
[
2
]
*
rhs
[
1
],
data
[
2
]
*
rhs
[
0
]
-
data
[
0
]
*
rhs
[
2
],
data
[
0
]
*
rhs
[
1
]
-
data
[
1
]
*
rhs
[
0
]);
}
private:
RealOpenMM
data
[
3
];
};
namespace
OpenMM
{
template
<
class
CHAR
,
class
TRAITS
>
std
::
basic_ostream
<
CHAR
,
TRAITS
>&
operator
<<
(
std
::
basic_ostream
<
CHAR
,
TRAITS
>&
o
,
const
RealVec
&
v
)
{
o
<<
'['
<<
v
[
0
]
<<
", "
<<
v
[
1
]
<<
", "
<<
v
[
2
]
<<
']'
;
return
o
;
}
typedef
Vec3
RealVec
;
}
// namespace OpenMM
...
...
platforms/reference/include/ReferenceAndersenThermostat.h
View file @
047934e2
...
...
@@ -25,6 +25,7 @@
#ifndef __ReferenceAndersenThermostat_H__
#define __ReferenceAndersenThermostat_H__
#include "openmm/Vec3.h"
#include <vector>
namespace
OpenMM
{
...
...
@@ -64,8 +65,8 @@ class ReferenceAndersenThermostat {
--------------------------------------------------------------------------------------- */
void
applyThermostat
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
atomGroups
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomVelocities
,
std
::
vector
<
RealOpenMM
>&
atomMasses
,
RealOpenMM
temperature
,
RealOpenMM
collisionFrequency
,
RealOpenMM
stepSize
)
const
;
void
applyThermostat
(
const
std
::
vector
<
std
::
vector
<
int
>
>&
atomGroups
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomVelocities
,
std
::
vector
<
double
>&
atomMasses
,
double
temperature
,
double
collisionFrequency
,
double
stepSize
)
const
;
};
...
...
platforms/reference/include/ReferenceAngleBondIxn.h
View file @
047934e2
...
...
@@ -26,6 +26,7 @@
#define __ReferenceAngleBondIxn_H__
#include "ReferenceBondIxn.h"
#include "openmm/Vec3.h"
namespace
OpenMM
{
...
...
@@ -34,7 +35,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
private:
bool
usePeriodic
;
Real
Vec
boxVectors
[
3
];
Vec
3
boxVectors
[
3
];
public:
...
...
@@ -62,7 +63,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
Real
Vec
*
vectors
);
void
setPeriodic
(
OpenMM
::
Vec
3
*
vectors
);
/**---------------------------------------------------------------------------------------
...
...
@@ -76,8 +77,8 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
getPrefactorsGivenAngleCosine
(
RealOpenMM
cosine
,
RealOpenMM
*
angleParameters
,
RealOpenMM
*
dEdR
,
RealOpenMM
*
energyTerm
)
const
;
void
getPrefactorsGivenAngleCosine
(
double
cosine
,
double
*
angleParameters
,
double
*
dEdR
,
double
*
energyTerm
)
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -92,9 +93,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
);
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
};
...
...
platforms/reference/include/ReferenceBondForce.h
View file @
047934e2
...
...
@@ -68,9 +68,9 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */
void
calculateForce
(
int
numberOfBonds
,
int
**
atomIndices
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
RealOpenMM
**
parameters
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
double
**
parameters
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
};
...
...
platforms/reference/include/ReferenceBondIxn.h
View file @
047934e2
...
...
@@ -25,7 +25,7 @@
#ifndef __ReferenceBondIxn_H__
#define __ReferenceBondIxn_H__
#include "
Real
Vec.h"
#include "
openmm/
Vec
3
.h"
#include "openmm/internal/windowsExport.h"
#include <vector>
...
...
@@ -65,9 +65,9 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
virtual
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
);
virtual
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
/**---------------------------------------------------------------------------------------
...
...
@@ -82,7 +82,7 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getNormedDotProduct
(
RealOpenMM
*
vector1
,
RealOpenMM
*
vector2
,
int
hasREntry
);
static
double
getNormedDotProduct
(
double
*
vector1
,
double
*
vector2
,
int
hasREntry
);
/**---------------------------------------------------------------------------------------
...
...
@@ -98,8 +98,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getAngleBetweenTwoVectors
(
RealOpenMM
*
vector1
,
RealOpenMM
*
vector2
,
RealOpenMM
*
outputDotProduct
,
int
hasREntry
);
static
double
getAngleBetweenTwoVectors
(
double
*
vector1
,
double
*
vector2
,
double
*
outputDotProduct
,
int
hasREntry
);
/**---------------------------------------------------------------------------------------
...
...
@@ -119,10 +119,10 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
static
RealOpenMM
getDihedralAngleBetweenThreeVectors
(
RealOpenMM
*
vector1
,
RealOpenMM
*
vector2
,
RealOpenMM
*
vector3
,
RealOpenMM
**
outputCrossProduct
,
RealOpenMM
*
cosineOfAngle
,
RealOpenMM
*
signVector
,
RealOpenMM
*
signOfAngle
,
int
hasREntry
);
static
double
getDihedralAngleBetweenThreeVectors
(
double
*
vector1
,
double
*
vector2
,
double
*
vector3
,
double
**
outputCrossProduct
,
double
*
cosineOfAngle
,
double
*
signVector
,
double
*
signOfAngle
,
int
hasREntry
);
};
...
...
platforms/reference/include/ReferenceBrownianDynamics.h
View file @
047934e2
...
...
@@ -33,9 +33,9 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
private:
std
::
vector
<
OpenMM
::
Real
Vec
>
xPrime
;
std
::
vector
<
RealOpenMM
>
inverseMasses
;
RealOpenMM
friction
;
std
::
vector
<
OpenMM
::
Vec
3
>
xPrime
;
std
::
vector
<
double
>
inverseMasses
;
double
friction
;
public:
...
...
@@ -50,7 +50,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
ReferenceBrownianDynamics
(
int
numberOfAtoms
,
RealOpenMM
deltaT
,
RealOpenMM
friction
,
RealOpenMM
temperature
);
ReferenceBrownianDynamics
(
int
numberOfAtoms
,
double
deltaT
,
double
friction
,
double
temperature
);
/**---------------------------------------------------------------------------------------
...
...
@@ -68,7 +68,7 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
RealOpenMM
getFriction
()
const
;
double
getFriction
()
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -83,8 +83,8 @@ class ReferenceBrownianDynamics : public ReferenceDynamics {
--------------------------------------------------------------------------------------- */
void
update
(
const
OpenMM
::
System
&
system
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
velocities
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
std
::
vector
<
RealOpenMM
>&
masses
,
RealOpenMM
tolerance
);
void
update
(
const
OpenMM
::
System
&
system
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
velocities
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
std
::
vector
<
double
>&
masses
,
double
tolerance
);
};
...
...
platforms/reference/include/ReferenceCCMAAlgorithm.h
View file @
047934e2
...
...
@@ -37,23 +37,23 @@ class OPENMM_EXPORT ReferenceCCMAAlgorithm : public ReferenceConstraintAlgorithm
protected:
int
_maximumNumberOfIterations
;
RealOpenMM
_elementCutoff
;
double
_elementCutoff
;
int
_numberOfConstraints
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
_atomIndices
;
std
::
vector
<
RealOpenMM
>
_distance
;
std
::
vector
<
double
>
_distance
;
std
::
vector
<
OpenMM
::
Real
Vec
>
_r_ij
;
RealOpenMM
*
_d_ij2
;
RealOpenMM
*
_distanceTolerance
;
RealOpenMM
*
_reducedMasses
;
std
::
vector
<
OpenMM
::
Vec
3
>
_r_ij
;
double
*
_d_ij2
;
double
*
_distanceTolerance
;
double
*
_reducedMasses
;
bool
_hasInitializedMasses
;
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
RealOpenMM
>
>
>
_matrix
;
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
double
>
>
>
_matrix
;
private:
void
applyConstraints
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
bool
constrainingVelocities
,
RealOpenMM
tolerance
);
void
applyConstraints
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinatesP
,
std
::
vector
<
double
>&
inverseMasses
,
bool
constrainingVelocities
,
double
tolerance
);
public:
class
AngleInfo
;
...
...
@@ -69,7 +69,7 @@ public:
* @param angles angle force field terms
* @param elementCutoff the cutoff for which elements of the inverse matrix to keep
*/
ReferenceCCMAAlgorithm
(
int
numberOfAtoms
,
int
numberOfConstraints
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
atomIndices
,
const
std
::
vector
<
RealOpenMM
>&
distance
,
std
::
vector
<
RealOpenMM
>&
masses
,
std
::
vector
<
AngleInfo
>&
angles
,
RealOpenMM
elementCutoff
);
ReferenceCCMAAlgorithm
(
int
numberOfAtoms
,
int
numberOfConstraints
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
atomIndices
,
const
std
::
vector
<
double
>&
distance
,
std
::
vector
<
double
>&
masses
,
std
::
vector
<
AngleInfo
>&
angles
,
double
elementCutoff
);
~
ReferenceCCMAAlgorithm
();
...
...
@@ -96,8 +96,8 @@ public:
* @param inverseMasses 1/mass
* @param tolerance the constraint tolerance
*/
void
apply
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
RealOpenMM
tolerance
);
void
apply
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinatesP
,
std
::
vector
<
double
>&
inverseMasses
,
double
tolerance
);
/**
* Apply the constraint algorithm to velocities.
...
...
@@ -107,14 +107,14 @@ public:
* @param inverseMasses 1/mass
* @param tolerance the constraint tolerance
*/
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
velocities
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
RealOpenMM
tolerance
);
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
velocities
,
std
::
vector
<
double
>&
inverseMasses
,
double
tolerance
);
/**
* Get the inverse constraint matrix. Each element represents one column, and contains a list
* of all non-zero elements in the form (index, value).
*/
const
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
RealOpenMM
>
>
>&
getMatrix
()
const
;
const
std
::
vector
<
std
::
vector
<
std
::
pair
<
int
,
double
>
>
>&
getMatrix
()
const
;
};
...
...
@@ -122,8 +122,8 @@ class ReferenceCCMAAlgorithm::AngleInfo
{
public:
int
atom1
,
atom2
,
atom3
;
RealOpenMM
angle
;
AngleInfo
(
int
atom1
,
int
atom2
,
int
atom3
,
RealOpenMM
angle
)
:
double
angle
;
AngleInfo
(
int
atom1
,
int
atom2
,
int
atom3
,
double
angle
)
:
atom1
(
atom1
),
atom2
(
atom2
),
atom3
(
atom3
),
angle
(
angle
)
{
}
...
...
platforms/reference/include/ReferenceCMAPTorsionIxn.h
View file @
047934e2
...
...
@@ -35,11 +35,11 @@ class ReferenceCMAPTorsionIxn : public ReferenceBondIxn {
private:
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>
coeff
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
bool
usePeriodic
;
Real
Vec
boxVectors
[
3
];
Vec
3
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
...
...
@@ -52,8 +52,8 @@ private:
--------------------------------------------------------------------------------------- */
void
calculateOneIxn
(
int
index
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
void
calculateOneIxn
(
int
index
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
)
const
;
public:
...
...
@@ -63,7 +63,7 @@ public:
--------------------------------------------------------------------------------------- */
ReferenceCMAPTorsionIxn
(
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>&
coeff
,
ReferenceCMAPTorsionIxn
(
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
coeff
,
const
std
::
vector
<
int
>&
torsionMaps
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
torsionIndices
);
...
...
@@ -75,7 +75,7 @@ public:
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
Real
Vec
*
vectors
);
void
setPeriodic
(
OpenMM
::
Vec
3
*
vectors
);
/**---------------------------------------------------------------------------------------
...
...
@@ -87,7 +87,7 @@ public:
--------------------------------------------------------------------------------------- */
void
calculateIxn
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
;
void
calculateIxn
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
)
const
;
/**---------------------------------------------------------------------------------------
...
...
@@ -95,9 +95,9 @@ public:
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
);
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceConstraintAlgorithm.h
View file @
047934e2
...
...
@@ -25,8 +25,9 @@
#ifndef __ReferenceConstraintAlgorithm_H__
#define __ReferenceConstraintAlgorithm_H__
#include "
Real
Vec.h"
#include "
openmm/
Vec
3
.h"
#include "openmm/internal/windowsExport.h"
#include "SimTKOpenMMRealType.h"
#include <vector>
namespace
OpenMM
{
...
...
@@ -47,8 +48,8 @@ public:
* @param inverseMasses 1/mass
* @param tolerance the constraint tolerance
*/
virtual
void
apply
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
RealOpenMM
tolerance
)
=
0
;
virtual
void
apply
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinatesP
,
std
::
vector
<
double
>&
inverseMasses
,
double
tolerance
)
=
0
;
/**
* Apply the constraint algorithm to velocities.
...
...
@@ -58,8 +59,8 @@ public:
* @param inverseMasses 1/mass
* @param tolerance the constraint tolerance
*/
virtual
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
velocities
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
RealOpenMM
tolerance
)
=
0
;
virtual
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
velocities
,
std
::
vector
<
double
>&
inverseMasses
,
double
tolerance
)
=
0
;
};
}
// namespace OpenMM
...
...
platforms/reference/include/ReferenceConstraints.h
View file @
047934e2
...
...
@@ -55,7 +55,7 @@ public:
* @param inverseMasses 1/mass
* @param tolerance the constraint tolerance
*/
void
apply
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinatesP
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
RealOpenMM
tolerance
);
void
apply
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinatesP
,
std
::
vector
<
double
>&
inverseMasses
,
double
tolerance
);
/**
* Apply the constraint algorithm to velocities.
...
...
@@ -65,7 +65,7 @@ public:
* @param inverseMasses 1/mass
* @param tolerance the constraint tolerance
*/
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
velocities
,
std
::
vector
<
RealOpenMM
>&
inverseMasses
,
RealOpenMM
tolerance
);
void
applyToVelocities
(
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec
3
>&
velocities
,
std
::
vector
<
double
>&
inverseMasses
,
double
tolerance
);
ReferenceConstraintAlgorithm
*
ccma
;
ReferenceConstraintAlgorithm
*
settle
;
};
...
...
platforms/reference/include/ReferenceCustomAngleIxn.h
View file @
047934e2
...
...
@@ -40,7 +40,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
int
thetaIndex
;
int
numParameters
;
bool
usePeriodic
;
Real
Vec
boxVectors
[
3
];
Vec
3
boxVectors
[
3
];
public:
...
...
@@ -70,7 +70,7 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
Real
Vec
*
vectors
);
void
setPeriodic
(
OpenMM
::
Vec
3
*
vectors
);
/**---------------------------------------------------------------------------------------
...
...
@@ -84,9 +84,9 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
);
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
};
...
...
platforms/reference/include/ReferenceCustomBondIxn.h
View file @
047934e2
...
...
@@ -41,7 +41,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
int
rIndex
;
int
numParameters
;
bool
usePeriodic
;
Real
Vec
boxVectors
[
3
];
Vec
3
boxVectors
[
3
];
public:
...
...
@@ -71,7 +71,7 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
Real
Vec
*
vectors
);
void
setPeriodic
(
OpenMM
::
Vec
3
*
vectors
);
/**---------------------------------------------------------------------------------------
...
...
@@ -85,9 +85,9 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
std
::
vector
<
OpenMM
::
Real
Vec
>&
forces
,
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
);
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec
3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec
3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
};
...
...
Prev
1
…
4
5
6
7
8
9
10
11
12
…
18
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