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
bd9b78ba
Commit
bd9b78ba
authored
Dec 23, 2009
by
Peter Eastman
Browse files
Fixed compilation errors under Windows
parent
84819edd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
50 deletions
+80
-50
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+1
-1
platforms/opencl/src/OpenCLContext.h
platforms/opencl/src/OpenCLContext.h
+43
-13
platforms/opencl/src/OpenCLExpressionUtilities.cpp
platforms/opencl/src/OpenCLExpressionUtilities.cpp
+4
-4
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
+9
-9
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+22
-22
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
+1
-1
No files found.
platforms/opencl/src/OpenCLContext.cpp
View file @
bd9b78ba
...
@@ -79,7 +79,7 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
...
@@ -79,7 +79,7 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex) : time(0.0), ste
nonbonded
=
new
OpenCLNonbondedUtilities
(
*
this
);
nonbonded
=
new
OpenCLNonbondedUtilities
(
*
this
);
posq
=
new
OpenCLArray
<
mm_float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
,
true
);
posq
=
new
OpenCLArray
<
mm_float4
>
(
*
this
,
paddedNumAtoms
,
"posq"
,
true
);
velm
=
new
OpenCLArray
<
mm_float4
>
(
*
this
,
paddedNumAtoms
,
"velm"
,
true
);
velm
=
new
OpenCLArray
<
mm_float4
>
(
*
this
,
paddedNumAtoms
,
"velm"
,
true
);
posCellOffsets
.
resize
(
paddedNumAtoms
,
(
mm_int4
)
{
0
,
0
,
0
,
0
}
);
posCellOffsets
.
resize
(
paddedNumAtoms
,
mm_int4
(
0
,
0
,
0
,
0
)
);
}
}
catch
(
cl
::
Error
err
)
{
catch
(
cl
::
Error
err
)
{
std
::
stringstream
str
;
std
::
stringstream
str
;
...
...
platforms/opencl/src/OpenCLContext.h
View file @
bd9b78ba
...
@@ -27,9 +27,13 @@
...
@@ -27,9 +27,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
#define __CL_ENABLE_EXCEPTIONS
#include <map>
#include <map>
#include <string>
#include <string>
#define __CL_ENABLE_EXCEPTIONS
#ifdef _MSC_VER
// Prevent Windows from defining macros that interfere with other code.
#define NOMINMAX
#endif
#include <cl.hpp>
#include <cl.hpp>
namespace
OpenMM
{
namespace
OpenMM
{
...
@@ -47,24 +51,50 @@ class System;
...
@@ -47,24 +51,50 @@ class System;
* types to represent them on the host.
* types to represent them on the host.
*/
*/
typedef
struct
{
struct
mm_float2
{
cl_float
x
,
y
;
cl_float
x
,
y
;
}
mm_float2
;
mm_float2
()
{
typedef
struct
{
}
mm_float2
(
cl_float
x
,
cl_float
y
)
:
x
(
x
),
y
(
y
)
{
}
};
struct
mm_float4
{
cl_float
x
,
y
,
z
,
w
;
cl_float
x
,
y
,
z
,
w
;
}
mm_float4
;
mm_float4
()
{
typedef
struct
{
}
mm_float4
(
cl_float
x
,
cl_float
y
,
cl_float
z
,
cl_float
w
)
:
x
(
x
),
y
(
y
),
z
(
z
),
w
(
w
)
{
}
};
struct
mm_float8
{
cl_float
s0
,
s1
,
s2
,
s3
,
s4
,
s5
,
s6
,
s7
;
cl_float
s0
,
s1
,
s2
,
s3
,
s4
,
s5
,
s6
,
s7
;
}
mm_float8
;
mm_float8
()
{
typedef
struct
{
}
mm_float8
(
cl_float
s0
,
cl_float
s1
,
cl_float
s2
,
cl_float
s3
,
cl_float
s4
,
cl_float
s5
,
cl_float
s6
,
cl_float
s7
)
:
s0
(
s0
),
s1
(
s1
),
s2
(
s2
),
s3
(
s3
),
s4
(
s4
),
s5
(
s5
),
s6
(
s6
),
s7
(
s7
)
{
}
};
struct
mm_int2
{
cl_int
x
,
y
;
cl_int
x
,
y
;
}
mm_int2
;
mm_int2
()
{
typedef
struct
{
}
mm_int2
(
cl_int
x
,
cl_int
y
)
:
x
(
x
),
y
(
y
)
{
}
};
struct
mm_int4
{
cl_int
x
,
y
,
z
,
w
;
cl_int
x
,
y
,
z
,
w
;
}
mm_int4
;
mm_int4
()
{
typedef
struct
{
}
mm_int4
(
cl_int
x
,
cl_int
y
,
cl_int
z
,
cl_int
w
)
:
x
(
x
),
y
(
y
),
z
(
z
),
w
(
w
)
{
}
};
struct
mm_int8
{
cl_int
s0
,
s1
,
s2
,
s3
,
s4
,
s5
,
s6
,
s7
;
cl_int
s0
,
s1
,
s2
,
s3
,
s4
,
s5
,
s6
,
s7
;
}
mm_int8
;
mm_int8
()
{
}
mm_int8
(
cl_int
s0
,
cl_int
s1
,
cl_int
s2
,
cl_int
s3
,
cl_int
s4
,
cl_int
s5
,
cl_int
s6
,
cl_int
s7
)
:
s0
(
s0
),
s1
(
s1
),
s2
(
s2
),
s3
(
s3
),
s4
(
s4
),
s5
(
s5
),
s6
(
s6
),
s7
(
s7
)
{
}
};
/**
/**
* This class contains the information associated with a Context by the OpenCL Platform.
* This class contains the information associated with a Context by the OpenCL Platform.
...
...
platforms/opencl/src/OpenCLExpressionUtilities.cpp
View file @
bd9b78ba
...
@@ -333,15 +333,15 @@ vector<mm_float4> OpenCLExpressionUtilities::computeFunctionCoefficients(const v
...
@@ -333,15 +333,15 @@ vector<mm_float4> OpenCLExpressionUtilities::computeFunctionCoefficients(const v
vector
<
mm_float4
>
f
(
values
.
size
()
-
1
);
vector
<
mm_float4
>
f
(
values
.
size
()
-
1
);
for
(
int
i
=
0
;
i
<
(
int
)
values
.
size
()
-
1
;
i
++
)
{
for
(
int
i
=
0
;
i
<
(
int
)
values
.
size
()
-
1
;
i
++
)
{
if
(
interpolating
)
if
(
interpolating
)
f
[
i
]
=
(
mm_float4
)
{
(
cl_float
)
padded
[
i
+
1
],
f
[
i
]
=
mm_float4
(
(
cl_float
)
padded
[
i
+
1
],
(
cl_float
)
(
0.5
*
(
-
padded
[
i
]
+
padded
[
i
+
2
])),
(
cl_float
)
(
0.5
*
(
-
padded
[
i
]
+
padded
[
i
+
2
])),
(
cl_float
)
(
0.5
*
(
2.0
*
padded
[
i
]
-
5.0
*
padded
[
i
+
1
]
+
4.0
*
padded
[
i
+
2
]
-
padded
[
i
+
3
])),
(
cl_float
)
(
0.5
*
(
2.0
*
padded
[
i
]
-
5.0
*
padded
[
i
+
1
]
+
4.0
*
padded
[
i
+
2
]
-
padded
[
i
+
3
])),
(
cl_float
)
(
0.5
*
(
-
padded
[
i
]
+
3.0
*
padded
[
i
+
1
]
-
3.0
*
padded
[
i
+
2
]
+
padded
[
i
+
3
]))
}
;
(
cl_float
)
(
0.5
*
(
-
padded
[
i
]
+
3.0
*
padded
[
i
+
1
]
-
3.0
*
padded
[
i
+
2
]
+
padded
[
i
+
3
]))
)
;
else
else
f
[
i
]
=
(
mm_float4
)
{
(
cl_float
)
((
padded
[
i
]
+
4.0
*
padded
[
i
+
1
]
+
padded
[
i
+
2
])
/
6.0
),
f
[
i
]
=
mm_float4
(
(
cl_float
)
((
padded
[
i
]
+
4.0
*
padded
[
i
+
1
]
+
padded
[
i
+
2
])
/
6.0
),
(
cl_float
)
((
-
3.0
*
padded
[
i
]
+
3.0
*
padded
[
i
+
2
])
/
6.0
),
(
cl_float
)
((
-
3.0
*
padded
[
i
]
+
3.0
*
padded
[
i
+
2
])
/
6.0
),
(
cl_float
)
((
3.0
*
padded
[
i
]
-
6.0
*
padded
[
i
+
1
]
+
3.0
*
padded
[
i
+
2
])
/
6.0
),
(
cl_float
)
((
3.0
*
padded
[
i
]
-
6.0
*
padded
[
i
+
1
]
+
3.0
*
padded
[
i
+
2
])
/
6.0
),
(
cl_float
)
((
-
padded
[
i
]
+
3.0
*
padded
[
i
+
1
]
-
3.0
*
padded
[
i
+
2
]
+
padded
[
i
+
3
])
/
6.0
)
}
;
(
cl_float
)
((
-
padded
[
i
]
+
3.0
*
padded
[
i
+
1
]
-
3.0
*
padded
[
i
+
2
]
+
padded
[
i
+
3
])
/
6.0
)
)
;
}
}
return
f
;
return
f
;
}
}
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
View file @
bd9b78ba
...
@@ -73,7 +73,7 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
...
@@ -73,7 +73,7 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
posDelta
=
new
OpenCLArray
<
mm_float4
>
(
context
,
context
.
getPaddedNumAtoms
(),
"posDelta"
);
posDelta
=
new
OpenCLArray
<
mm_float4
>
(
context
,
context
.
getPaddedNumAtoms
(),
"posDelta"
);
stepSize
=
new
OpenCLArray
<
mm_float2
>
(
context
,
1
,
"stepSize"
,
true
);
stepSize
=
new
OpenCLArray
<
mm_float2
>
(
context
,
1
,
"stepSize"
,
true
);
stepSize
->
set
(
0
,
(
mm_float2
)
{
0.0
f
,
0.0
f
}
);
stepSize
->
set
(
0
,
mm_float2
(
0.0
f
,
0.0
f
)
);
stepSize
->
upload
();
stepSize
->
upload
();
// Create kernels for enforcing constraints.
// Create kernels for enforcing constraints.
...
@@ -140,18 +140,18 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
...
@@ -140,18 +140,18 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
float
dist23
=
settleConstraints
[
atom2
].
find
(
atom3
)
->
second
;
float
dist23
=
settleConstraints
[
atom2
].
find
(
atom3
)
->
second
;
if
(
dist12
==
dist13
)
{
if
(
dist12
==
dist13
)
{
// atom1 is the central atom
// atom1 is the central atom
atoms
.
push_back
(
(
mm_int4
)
{
atom1
,
atom2
,
atom3
,
0
}
);
atoms
.
push_back
(
mm_int4
(
atom1
,
atom2
,
atom3
,
0
)
);
params
.
push_back
(
(
mm_float2
)
{
dist12
,
dist23
}
);
params
.
push_back
(
mm_float2
(
dist12
,
dist23
)
);
}
}
else
if
(
dist12
==
dist23
)
{
else
if
(
dist12
==
dist23
)
{
// atom2 is the central atom
// atom2 is the central atom
atoms
.
push_back
(
(
mm_int4
)
{
atom2
,
atom1
,
atom3
,
0
}
);
atoms
.
push_back
(
mm_int4
(
atom2
,
atom1
,
atom3
,
0
)
);
params
.
push_back
(
(
mm_float2
)
{
dist12
,
dist13
}
);
params
.
push_back
(
mm_float2
(
dist12
,
dist13
)
);
}
}
else
if
(
dist13
==
dist23
)
{
else
if
(
dist13
==
dist23
)
{
// atom3 is the central atom
// atom3 is the central atom
atoms
.
push_back
(
(
mm_int4
)
{
atom3
,
atom1
,
atom2
,
0
}
);
atoms
.
push_back
(
mm_int4
(
atom3
,
atom1
,
atom2
,
0
)
);
params
.
push_back
(
(
mm_float2
)
{
dist13
,
dist12
}
);
params
.
push_back
(
mm_float2
(
dist13
,
dist12
)
);
}
}
else
else
throw
OpenMMException
(
"Two of the three distances constrained with SETTLE must be the same."
);
throw
OpenMMException
(
"Two of the three distances constrained with SETTLE must be the same."
);
...
@@ -231,8 +231,8 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
...
@@ -231,8 +231,8 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
const
ShakeCluster
&
cluster
=
iter
->
second
;
const
ShakeCluster
&
cluster
=
iter
->
second
;
if
(
!
cluster
.
valid
)
if
(
!
cluster
.
valid
)
continue
;
continue
;
atoms
.
push_back
(
(
mm_int4
)
{
cluster
.
centralID
,
cluster
.
peripheralID
[
0
],
(
cluster
.
size
>
1
?
cluster
.
peripheralID
[
1
]
:
-
1
),
(
cluster
.
size
>
2
?
cluster
.
peripheralID
[
2
]
:
-
1
)
}
);
atoms
.
push_back
(
mm_int4
(
cluster
.
centralID
,
cluster
.
peripheralID
[
0
],
(
cluster
.
size
>
1
?
cluster
.
peripheralID
[
1
]
:
-
1
),
(
cluster
.
size
>
2
?
cluster
.
peripheralID
[
2
]
:
-
1
)
)
);
params
.
push_back
(
(
mm_float4
)
{
cluster
.
centralInvMass
,
0.5
f
/
(
cluster
.
centralInvMass
+
cluster
.
peripheralInvMass
),
cluster
.
distance
*
cluster
.
distance
,
cluster
.
peripheralInvMass
}
);
params
.
push_back
(
mm_float4
(
cluster
.
centralInvMass
,
0.5
f
/
(
cluster
.
centralInvMass
+
cluster
.
peripheralInvMass
),
cluster
.
distance
*
cluster
.
distance
,
cluster
.
peripheralInvMass
)
);
isShakeAtom
[
cluster
.
centralID
]
=
true
;
isShakeAtom
[
cluster
.
centralID
]
=
true
;
isShakeAtom
[
cluster
.
peripheralID
[
0
]]
=
true
;
isShakeAtom
[
cluster
.
peripheralID
[
0
]]
=
true
;
if
(
cluster
.
size
>
1
)
if
(
cluster
.
size
>
1
)
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
bd9b78ba
...
@@ -126,7 +126,7 @@ void OpenCLUpdateStateDataKernel::setPositions(ContextImpl& context, const std::
...
@@ -126,7 +126,7 @@ void OpenCLUpdateStateDataKernel::setPositions(ContextImpl& context, const std::
}
}
posq
.
upload
();
posq
.
upload
();
for
(
int
i
=
0
;
i
<
cl
.
getPosCellOffsets
().
size
();
i
++
)
for
(
int
i
=
0
;
i
<
cl
.
getPosCellOffsets
().
size
();
i
++
)
cl
.
getPosCellOffsets
()[
i
]
=
(
mm_int4
)
{
0
,
0
,
0
,
0
}
;
cl
.
getPosCellOffsets
()[
i
]
=
mm_int4
(
0
,
0
,
0
,
0
)
;
}
}
void
OpenCLUpdateStateDataKernel
::
getVelocities
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
velocities
)
{
void
OpenCLUpdateStateDataKernel
::
getVelocities
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
velocities
)
{
...
@@ -213,8 +213,8 @@ void OpenCLCalcHarmonicBondForceKernel::initialize(const System& system, const H
...
@@ -213,8 +213,8 @@ void OpenCLCalcHarmonicBondForceKernel::initialize(const System& system, const H
int
particle1
,
particle2
;
int
particle1
,
particle2
;
double
length
,
k
;
double
length
,
k
;
force
.
getBondParameters
(
i
,
particle1
,
particle2
,
length
,
k
);
force
.
getBondParameters
(
i
,
particle1
,
particle2
,
length
,
k
);
paramVector
[
i
]
=
(
mm_float2
)
{
(
cl_float
)
length
,
(
cl_float
)
k
}
;
paramVector
[
i
]
=
mm_float2
(
(
cl_float
)
length
,
(
cl_float
)
k
)
;
indicesVector
[
i
]
=
(
mm_int4
)
{
particle1
,
particle2
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
}
;
indicesVector
[
i
]
=
mm_int4
(
particle1
,
particle2
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
)
;
}
}
params
->
upload
(
paramVector
);
params
->
upload
(
paramVector
);
indices
->
upload
(
indicesVector
);
indices
->
upload
(
indicesVector
);
...
@@ -306,7 +306,7 @@ void OpenCLCalcCustomBondForceKernel::initialize(const System& system, const Cus
...
@@ -306,7 +306,7 @@ void OpenCLCalcCustomBondForceKernel::initialize(const System& system, const Cus
paramVector
[
i
].
resize
(
parameters
.
size
());
paramVector
[
i
].
resize
(
parameters
.
size
());
for
(
int
j
=
0
;
j
<
parameters
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
parameters
.
size
();
j
++
)
paramVector
[
i
][
j
]
=
(
cl_float
)
parameters
[
j
];
paramVector
[
i
][
j
]
=
(
cl_float
)
parameters
[
j
];
indicesVector
[
i
]
=
(
mm_int4
)
{
particle1
,
particle2
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
}
;
indicesVector
[
i
]
=
mm_int4
(
particle1
,
particle2
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
)
;
}
}
params
->
setParameterValues
(
paramVector
);
params
->
setParameterValues
(
paramVector
);
indices
->
upload
(
indicesVector
);
indices
->
upload
(
indicesVector
);
...
@@ -447,9 +447,9 @@ void OpenCLCalcHarmonicAngleForceKernel::initialize(const System& system, const
...
@@ -447,9 +447,9 @@ void OpenCLCalcHarmonicAngleForceKernel::initialize(const System& system, const
int
particle1
,
particle2
,
particle3
;
int
particle1
,
particle2
,
particle3
;
double
angle
,
k
;
double
angle
,
k
;
force
.
getAngleParameters
(
i
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
force
.
getAngleParameters
(
i
,
particle1
,
particle2
,
particle3
,
angle
,
k
);
paramVector
[
i
]
=
(
mm_float2
)
{
(
cl_float
)
angle
,
(
cl_float
)
k
}
;
paramVector
[
i
]
=
mm_float2
(
(
cl_float
)
angle
,
(
cl_float
)
k
)
;
indicesVector
[
i
]
=
(
mm_int8
)
{
particle1
,
particle2
,
particle3
,
indicesVector
[
i
]
=
mm_int8
(
particle1
,
particle2
,
particle3
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
,
forceBufferCounter
[
particle3
]
++
,
0
,
0
}
;
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
,
forceBufferCounter
[
particle3
]
++
,
0
,
0
)
;
}
}
params
->
upload
(
paramVector
);
params
->
upload
(
paramVector
);
...
@@ -531,9 +531,9 @@ void OpenCLCalcPeriodicTorsionForceKernel::initialize(const System& system, cons
...
@@ -531,9 +531,9 @@ void OpenCLCalcPeriodicTorsionForceKernel::initialize(const System& system, cons
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
double
phase
,
k
;
double
phase
,
k
;
force
.
getTorsionParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
,
phase
,
k
);
force
.
getTorsionParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
,
phase
,
k
);
paramVector
[
i
]
=
(
mm_float4
)
{
(
cl_float
)
k
,
(
cl_float
)
phase
,
(
cl_float
)
periodicity
,
0.0
f
}
;
paramVector
[
i
]
=
mm_float4
(
(
cl_float
)
k
,
(
cl_float
)
phase
,
(
cl_float
)
periodicity
,
0.0
f
)
;
indicesVector
[
i
]
=
(
mm_int8
)
{
particle1
,
particle2
,
particle3
,
particle4
,
indicesVector
[
i
]
=
mm_int8
(
particle1
,
particle2
,
particle3
,
particle4
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
,
forceBufferCounter
[
particle3
]
++
,
forceBufferCounter
[
particle4
]
++
}
;
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
,
forceBufferCounter
[
particle3
]
++
,
forceBufferCounter
[
particle4
]
++
)
;
}
}
params
->
upload
(
paramVector
);
params
->
upload
(
paramVector
);
...
@@ -615,9 +615,9 @@ void OpenCLCalcRBTorsionForceKernel::initialize(const System& system, const RBTo
...
@@ -615,9 +615,9 @@ void OpenCLCalcRBTorsionForceKernel::initialize(const System& system, const RBTo
int
particle1
,
particle2
,
particle3
,
particle4
;
int
particle1
,
particle2
,
particle3
,
particle4
;
double
c0
,
c1
,
c2
,
c3
,
c4
,
c5
;
double
c0
,
c1
,
c2
,
c3
,
c4
,
c5
;
force
.
getTorsionParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
c0
,
c1
,
c2
,
c3
,
c4
,
c5
);
force
.
getTorsionParameters
(
i
,
particle1
,
particle2
,
particle3
,
particle4
,
c0
,
c1
,
c2
,
c3
,
c4
,
c5
);
paramVector
[
i
]
=
(
mm_float8
)
{
(
cl_float
)
c0
,
(
cl_float
)
c1
,
(
cl_float
)
c2
,
(
cl_float
)
c3
,
(
cl_float
)
c4
,
(
cl_float
)
c5
,
0.0
f
,
0.0
f
}
;
paramVector
[
i
]
=
mm_float8
(
(
cl_float
)
c0
,
(
cl_float
)
c1
,
(
cl_float
)
c2
,
(
cl_float
)
c3
,
(
cl_float
)
c4
,
(
cl_float
)
c5
,
0.0
f
,
0.0
f
)
;
indicesVector
[
i
]
=
(
mm_int8
)
{
particle1
,
particle2
,
particle3
,
particle4
,
indicesVector
[
i
]
=
mm_int8
(
particle1
,
particle2
,
particle3
,
particle4
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
,
forceBufferCounter
[
particle3
]
++
,
forceBufferCounter
[
particle4
]
++
}
;
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
,
forceBufferCounter
[
particle3
]
++
,
forceBufferCounter
[
particle4
]
++
)
;
}
}
params
->
upload
(
paramVector
);
params
->
upload
(
paramVector
);
...
@@ -721,7 +721,7 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb
...
@@ -721,7 +721,7 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb
double
charge
,
sigma
,
epsilon
;
double
charge
,
sigma
,
epsilon
;
force
.
getParticleParameters
(
i
,
charge
,
sigma
,
epsilon
);
force
.
getParticleParameters
(
i
,
charge
,
sigma
,
epsilon
);
posq
[
i
].
w
=
(
float
)
charge
;
posq
[
i
].
w
=
(
float
)
charge
;
sigmaEpsilonVector
[
i
]
=
(
mm_float2
)
{
(
float
)
(
0.5
*
sigma
),
(
float
)
(
2.0
*
sqrt
(
epsilon
))
}
;
sigmaEpsilonVector
[
i
]
=
mm_float2
(
(
float
)
(
0.5
*
sigma
),
(
float
)
(
2.0
*
sqrt
(
epsilon
))
)
;
exclusionList
[
i
].
push_back
(
i
);
exclusionList
[
i
].
push_back
(
i
);
sumSquaredCharges
+=
charge
*
charge
;
sumSquaredCharges
+=
charge
*
charge
;
if
(
charge
!=
0.0
)
if
(
charge
!=
0.0
)
...
@@ -804,8 +804,8 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb
...
@@ -804,8 +804,8 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb
int
particle1
,
particle2
;
int
particle1
,
particle2
;
double
chargeProd
,
sigma
,
epsilon
;
double
chargeProd
,
sigma
,
epsilon
;
force
.
getExceptionParameters
(
exceptions
[
i
],
particle1
,
particle2
,
chargeProd
,
sigma
,
epsilon
);
force
.
getExceptionParameters
(
exceptions
[
i
],
particle1
,
particle2
,
chargeProd
,
sigma
,
epsilon
);
exceptionParamsVector
[
i
]
=
(
mm_float4
)
{
(
float
)
(
ONE_4PI_EPS0
*
chargeProd
),
(
float
)
sigma
,
(
float
)
(
4.0
*
epsilon
),
0.0
f
}
;
exceptionParamsVector
[
i
]
=
mm_float4
(
(
float
)
(
ONE_4PI_EPS0
*
chargeProd
),
(
float
)
sigma
,
(
float
)
(
4.0
*
epsilon
),
0.0
f
)
;
exceptionIndicesVector
[
i
]
=
(
mm_int4
)
{
particle1
,
particle2
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
}
;
exceptionIndicesVector
[
i
]
=
mm_int4
(
particle1
,
particle2
,
forceBufferCounter
[
particle1
]
++
,
forceBufferCounter
[
particle2
]
++
)
;
}
}
exceptionParams
->
upload
(
exceptionParamsVector
);
exceptionParams
->
upload
(
exceptionParamsVector
);
exceptionIndices
->
upload
(
exceptionIndicesVector
);
exceptionIndices
->
upload
(
exceptionIndicesVector
);
...
@@ -946,7 +946,7 @@ void OpenCLCalcCustomNonbondedForceKernel::initialize(const System& system, cons
...
@@ -946,7 +946,7 @@ void OpenCLCalcCustomNonbondedForceKernel::initialize(const System& system, cons
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functions
[
name
]
=
&
fp
;
functions
[
name
]
=
&
fp
;
tabulatedFunctionParamsVec
[
i
]
=
(
mm_float4
)
{
(
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
0.0
f
}
;
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
(
(
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
0.0
f
)
;
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
@@ -1071,7 +1071,7 @@ void OpenCLCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOB
...
@@ -1071,7 +1071,7 @@ void OpenCLCalcGBSAOBCForceKernel::initialize(const System& system, const GBSAOB
double
charge
,
radius
,
scalingFactor
;
double
charge
,
radius
,
scalingFactor
;
force
.
getParticleParameters
(
i
,
charge
,
radius
,
scalingFactor
);
force
.
getParticleParameters
(
i
,
charge
,
radius
,
scalingFactor
);
radius
-=
dielectricOffset
;
radius
-=
dielectricOffset
;
paramsVector
[
i
]
=
(
mm_float2
)
{
(
float
)
radius
,
(
float
)
(
scalingFactor
*
radius
)
}
;
paramsVector
[
i
]
=
mm_float2
(
(
float
)
radius
,
(
float
)
(
scalingFactor
*
radius
)
)
;
posq
[
i
].
w
=
(
float
)
charge
;
posq
[
i
].
w
=
(
float
)
charge
;
}
}
posq
.
upload
();
posq
.
upload
();
...
@@ -1288,7 +1288,7 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
...
@@ -1288,7 +1288,7 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functions
[
name
]
=
&
fp
;
functions
[
name
]
=
&
fp
;
tabulatedFunctionParamsVec
[
i
]
=
(
mm_float4
)
{
(
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
0.0
f
}
;
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
(
(
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
0.0
f
)
;
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
@@ -2013,7 +2013,7 @@ void OpenCLIntegrateVerletStepKernel::execute(ContextImpl& context, const Verlet
...
@@ -2013,7 +2013,7 @@ void OpenCLIntegrateVerletStepKernel::execute(ContextImpl& context, const Verlet
}
}
if
(
dt
!=
prevStepSize
)
{
if
(
dt
!=
prevStepSize
)
{
vector
<
mm_float2
>
stepSizeVec
(
1
);
vector
<
mm_float2
>
stepSizeVec
(
1
);
stepSizeVec
[
0
]
=
(
mm_float2
)
{
dt
,
dt
}
;
stepSizeVec
[
0
]
=
mm_float2
(
dt
,
dt
)
;
cl
.
getIntegrationUtilities
().
getStepSize
().
upload
(
stepSizeVec
);
cl
.
getIntegrationUtilities
().
getStepSize
().
upload
(
stepSizeVec
);
prevStepSize
=
dt
;
prevStepSize
=
dt
;
}
}
...
@@ -2058,7 +2058,7 @@ void OpenCLIntegrateLangevinStepKernel::initialize(const System& system, const L
...
@@ -2058,7 +2058,7 @@ void OpenCLIntegrateLangevinStepKernel::initialize(const System& system, const L
params
=
new
OpenCLArray
<
cl_float
>
(
cl
,
11
,
"langevinParams"
);
params
=
new
OpenCLArray
<
cl_float
>
(
cl
,
11
,
"langevinParams"
);
xVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"xVector"
);
xVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"xVector"
);
vVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"vVector"
);
vVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"vVector"
);
vector
<
mm_float4
>
initialXVector
(
xVector
->
getSize
(),
(
mm_float4
)
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
}
);
vector
<
mm_float4
>
initialXVector
(
xVector
->
getSize
(),
mm_float4
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
)
);
xVector
->
upload
(
initialXVector
);
xVector
->
upload
(
initialXVector
);
prevStepSize
=
-
1.0
;
prevStepSize
=
-
1.0
;
}
}
...
@@ -2326,7 +2326,7 @@ void OpenCLIntegrateVariableLangevinStepKernel::initialize(const System& system,
...
@@ -2326,7 +2326,7 @@ void OpenCLIntegrateVariableLangevinStepKernel::initialize(const System& system,
params
=
new
OpenCLArray
<
cl_float
>
(
cl
,
11
,
"langevinParams"
);
params
=
new
OpenCLArray
<
cl_float
>
(
cl
,
11
,
"langevinParams"
);
xVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"xVector"
);
xVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"xVector"
);
vVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"vVector"
);
vVector
=
new
OpenCLArray
<
mm_float4
>
(
cl
,
cl
.
getPaddedNumAtoms
(),
"vVector"
);
vector
<
mm_float4
>
initialXVector
(
xVector
->
getSize
(),
(
mm_float4
)
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
}
);
vector
<
mm_float4
>
initialXVector
(
xVector
->
getSize
(),
mm_float4
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
)
);
xVector
->
upload
(
initialXVector
);
xVector
->
upload
(
initialXVector
);
blockSize
=
std
::
min
(
256
,
system
.
getNumParticles
());
blockSize
=
std
::
min
(
256
,
system
.
getNumParticles
());
blockSize
=
std
::
max
(
blockSize
,
params
->
getSize
());
blockSize
=
std
::
max
(
blockSize
,
params
->
getSize
());
...
...
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
View file @
bd9b78ba
...
@@ -211,7 +211,7 @@ void OpenCLNonbondedUtilities::initialize(const System& system) {
...
@@ -211,7 +211,7 @@ void OpenCLNonbondedUtilities::initialize(const System& system) {
Vec3
boxVectors
[
3
];
Vec3
boxVectors
[
3
];
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
system
.
getPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
periodicBoxSize
=
(
mm_float4
)
{
(
float
)
boxVectors
[
0
][
0
],
(
float
)
boxVectors
[
1
][
1
],
(
float
)
boxVectors
[
2
][
2
],
0.0
f
}
;
periodicBoxSize
=
mm_float4
(
(
float
)
boxVectors
[
0
][
0
],
(
float
)
boxVectors
[
1
][
1
],
(
float
)
boxVectors
[
2
][
2
],
0.0
f
)
;
// Create data structures for the neighbor list.
// Create data structures for the neighbor list.
...
...
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