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
b1232a0f
Commit
b1232a0f
authored
Jul 29, 2010
by
Peter Eastman
Browse files
Fixed error when evaluating a tabulated function exactly at its end
parent
0df95c59
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
platforms/opencl/src/OpenCLExpressionUtilities.cpp
platforms/opencl/src/OpenCLExpressionUtilities.cpp
+1
-0
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+3
-3
No files found.
platforms/opencl/src/OpenCLExpressionUtilities.cpp
View file @
b1232a0f
...
...
@@ -121,6 +121,7 @@ void OpenCLExpressionUtilities::processExpression(stringstream& out, const Expre
out
<<
"float x = "
<<
getTempName
(
node
.
getChildren
()[
0
],
temps
)
<<
";
\n
"
;
out
<<
"if (x >= params.x && x <= params.y) {
\n
"
;
out
<<
"int index = (int) (floor((x-params.x)*params.z));
\n
"
;
out
<<
"index = min(index, (int) params.w);
\n
"
;
out
<<
"float4 coeff = "
<<
functions
[
i
].
second
<<
"[index];
\n
"
;
out
<<
"x = (x-params.x)*params.z-index;
\n
"
;
if
(
valueNode
!=
NULL
)
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
b1232a0f
...
...
@@ -1583,7 +1583,7 @@ void OpenCLCalcCustomNonbondedForceKernel::initialize(const System& system, cons
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
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
)),
values
.
size
()
-
2
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
...
@@ -1922,7 +1922,7 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
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
)),
values
.
size
()
-
2
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
...
@@ -2962,7 +2962,7 @@ void OpenCLCalcCustomHbondForceKernel::initialize(const System& system, const Cu
string
arrayName
=
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
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
)),
values
.
size
()
-
2
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
interpolating
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
...
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