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
44b26295
"...ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "4a1e96838155e65cca01223fcd89384f9c861892"
Commit
44b26295
authored
Feb 03, 2010
by
Peter Eastman
Browse files
Fixed bug in AndersenThermostat
parent
160a491e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
platforms/cuda/src/kernels/kCalculateAndersenThermostat.cu
platforms/cuda/src/kernels/kCalculateAndersenThermostat.cu
+3
-2
platforms/opencl/src/kernels/andersenThermostat.cl
platforms/opencl/src/kernels/andersenThermostat.cl
+3
-2
No files found.
platforms/cuda/src/kernels/kCalculateAndersenThermostat.cu
View file @
44b26295
...
@@ -58,12 +58,13 @@ __global__ void kCalculateAndersenThermostat_kernel()
...
@@ -58,12 +58,13 @@ __global__ void kCalculateAndersenThermostat_kernel()
__syncthreads
();
__syncthreads
();
float
collisionProbability
=
1.0
f
-
exp
(
-
cSim
.
collisionFrequency
*
cSim
.
pStepSize
[
0
].
y
);
float
collisionProbability
=
1.0
f
-
exp
(
-
cSim
.
collisionFrequency
*
cSim
.
pStepSize
[
0
].
y
);
float
randomRange
=
erf
(
collisionProbability
/
sqrt
(
2.0
f
));
while
(
pos
<
cSim
.
atoms
)
while
(
pos
<
cSim
.
atoms
)
{
{
float4
velocity
=
cSim
.
pVelm4
[
pos
];
float4
velocity
=
cSim
.
pVelm4
[
pos
];
float4
random4a
=
cSim
.
pRandom4a
[
rpos
+
pos
];
float4
random4a
=
cSim
.
pRandom4a
[
rpos
+
pos
];
float
scale
=
(
random4a
.
w
<
collisionProbability
?
0.0
:
1.0
);
float
scale
=
(
random4a
.
w
>
-
randomRange
&&
random4a
.
w
<
randomRange
?
0.0
f
:
1.0
f
);
float
add
=
(
1.0
-
scale
)
*
sqrt
(
cSim
.
kT
*
velocity
.
w
);
float
add
=
(
1.0
f
-
scale
)
*
sqrt
(
cSim
.
kT
*
velocity
.
w
);
velocity
.
x
=
scale
*
velocity
.
x
+
add
*
random4a
.
x
;
velocity
.
x
=
scale
*
velocity
.
x
+
add
*
random4a
.
x
;
velocity
.
y
=
scale
*
velocity
.
y
+
add
*
random4a
.
y
;
velocity
.
y
=
scale
*
velocity
.
y
+
add
*
random4a
.
y
;
velocity
.
z
=
scale
*
velocity
.
z
+
add
*
random4a
.
z
;
velocity
.
z
=
scale
*
velocity
.
z
+
add
*
random4a
.
z
;
...
...
platforms/opencl/src/kernels/andersenThermostat.cl
View file @
44b26295
...
@@ -5,11 +5,12 @@
...
@@ -5,11 +5,12 @@
__kernel
void
applyAndersenThermostat
(
float
collisionFrequency,
float
kT,
__global
float4*
velm,
__global
float2*
stepSize,
__global
float4*
random,
unsigned
int
randomIndex
)
{
__kernel
void
applyAndersenThermostat
(
float
collisionFrequency,
float
kT,
__global
float4*
velm,
__global
float2*
stepSize,
__global
float4*
random,
unsigned
int
randomIndex
)
{
randomIndex
+=
get_global_id
(
0
)
;
randomIndex
+=
get_global_id
(
0
)
;
float
collisionProbability
=
1.0f-exp
(
-collisionFrequency*stepSize[0].y
)
;
float
collisionProbability
=
1.0f-exp
(
-collisionFrequency*stepSize[0].y
)
;
float
randomRange
=
erf
(
collisionProbability/sqrt
(
2.0f
))
;
for
(
int
index
=
get_global_id
(
0
)
; index < NUM_ATOMS; index += get_global_size(0)) {
for
(
int
index
=
get_global_id
(
0
)
; index < NUM_ATOMS; index += get_global_size(0)) {
float4
velocity
=
velm[index]
;
float4
velocity
=
velm[index]
;
float4
rand
=
random[randomIndex]
;
float4
rand
=
random[randomIndex]
;
float
scale
=
(
rand.w
<
collisionProbability
?
0.0
:
1.0
)
;
float
scale
=
(
rand.w
>
-randomRange
&&
rand.w
<
randomRange
?
0.0
f
:
1.0
f
)
;
float
add
=
(
1.0-scale
)
*sqrt
(
kT*velocity.w
)
;
float
add
=
(
1.0
f
-scale
)
*sqrt
(
kT*velocity.w
)
;
velocity.xyz
=
scale*velocity.xyz
+
add*rand.xyz
;
velocity.xyz
=
scale*velocity.xyz
+
add*rand.xyz
;
velm[index]
=
velocity
;
velm[index]
=
velocity
;
randomIndex
+=
get_global_size
(
0
)
;
randomIndex
+=
get_global_size
(
0
)
;
...
...
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