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
6c0082a5
"tests/TestVectorizeAvx2.cpp" did not exist on "bf3a4db65fc57f8bbb93726ae8e649922aa98372"
Commit
6c0082a5
authored
Sep 17, 2012
by
Peter Eastman
Browse files
Bug fixes to AmoebaGeneralizedKirkwoodForce
parent
ec8b0037
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
15 deletions
+14
-15
plugins/amoeba/platforms/cuda2/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda2/src/AmoebaCudaKernels.cpp
+1
-6
plugins/amoeba/platforms/cuda2/src/kernels/amoebaGk.cu
plugins/amoeba/platforms/cuda2/src/kernels/amoebaGk.cu
+9
-7
plugins/amoeba/platforms/cuda2/src/kernels/gkEDiffPairForce.cu
...ns/amoeba/platforms/cuda2/src/kernels/gkEDiffPairForce.cu
+2
-0
plugins/amoeba/platforms/cuda2/src/kernels/gkPairForce.cu
plugins/amoeba/platforms/cuda2/src/kernels/gkPairForce.cu
+2
-2
No files found.
plugins/amoeba/platforms/cuda2/src/AmoebaCudaKernels.cpp
View file @
6c0082a5
...
@@ -1778,7 +1778,7 @@ void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System& syst
...
@@ -1778,7 +1778,7 @@ void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::initialize(const System& syst
defines
[
"GK_FD"
]
=
cu
.
doubleToString
(
2
*
(
1
-
solventDielectric
)
/
(
1
+
2
*
solventDielectric
));
defines
[
"GK_FD"
]
=
cu
.
doubleToString
(
2
*
(
1
-
solventDielectric
)
/
(
1
+
2
*
solventDielectric
));
defines
[
"GK_FQ"
]
=
cu
.
doubleToString
(
3
*
(
1
-
solventDielectric
)
/
(
2
+
3
*
solventDielectric
));
defines
[
"GK_FQ"
]
=
cu
.
doubleToString
(
3
*
(
1
-
solventDielectric
)
/
(
2
+
3
*
solventDielectric
));
defines
[
"EPSILON_FACTOR"
]
=
cu
.
doubleToString
(
138.9354558456
);
defines
[
"EPSILON_FACTOR"
]
=
cu
.
doubleToString
(
138.9354558456
);
defines
[
"ENERGY_SCALE_FACTOR"
]
=
cu
.
doubleToString
(
138.9354558456
/
solvent
Dielectric
);
defines
[
"ENERGY_SCALE_FACTOR"
]
=
cu
.
doubleToString
(
138.9354558456
/
force
.
getSolute
Dielectric
()
);
if
(
multipoles
->
getPolarizationType
()
==
AmoebaMultipoleForce
::
Direct
)
if
(
multipoles
->
getPolarizationType
()
==
AmoebaMultipoleForce
::
Direct
)
defines
[
"DIRECT_POLARIZATION"
]
=
""
;
defines
[
"DIRECT_POLARIZATION"
]
=
""
;
stringstream
forceSource
;
stringstream
forceSource
;
...
@@ -1843,11 +1843,6 @@ void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::finishComputation(CudaArray&
...
@@ -1843,11 +1843,6 @@ void CudaCalcAmoebaGeneralizedKirkwoodForceKernel::finishComputation(CudaArray&
&
labFrameQuadrupoles
.
getDevicePointer
(),
&
inducedDipoleS
->
getDevicePointer
(),
&
inducedDipolePolarS
->
getDevicePointer
(),
&
labFrameQuadrupoles
.
getDevicePointer
(),
&
inducedDipoleS
->
getDevicePointer
(),
&
inducedDipolePolarS
->
getDevicePointer
(),
&
bornRadii
->
getDevicePointer
(),
&
bornForce
->
getDevicePointer
()};
&
bornRadii
->
getDevicePointer
(),
&
bornForce
->
getDevicePointer
()};
cu
.
executeKernel
(
gkForceKernel
,
gkForceArgs
,
numForceThreadBlocks
*
forceThreadBlockSize
,
forceThreadBlockSize
);
cu
.
executeKernel
(
gkForceKernel
,
gkForceArgs
,
numForceThreadBlocks
*
forceThreadBlockSize
,
forceThreadBlockSize
);
printf
(
"bornForce
\n
"
);
vector
<
long
long
>
f
;
bornForce
->
download
(
f
);
for
(
int
i
=
0
;
i
<
cu
.
getNumAtoms
();
i
++
)
printf
(
"%d %g
\n
"
,
i
,
f
[
i
]
/
(
double
)
0xFFFFFFFF
);
// Compute cavity term...
// Compute cavity term...
...
...
plugins/amoeba/platforms/cuda2/src/kernels/amoebaGk.cu
View file @
6c0082a5
...
@@ -191,6 +191,7 @@ inline __device__ void zeroAtomData(AtomData2& data) {
...
@@ -191,6 +191,7 @@ inline __device__ void zeroAtomData(AtomData2& data) {
data
.
force
=
make_real3
(
0
);
data
.
force
=
make_real3
(
0
);
data
.
bornForce
=
0
;
data
.
bornForce
=
0
;
}
}
/**
/**
* Compute electrostatic interactions.
* Compute electrostatic interactions.
*/
*/
...
@@ -245,7 +246,7 @@ extern "C" __global__ void computeGKForces(
...
@@ -245,7 +246,7 @@ extern "C" __global__ void computeGKForces(
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
int
atom2
=
y
*
TILE_SIZE
+
j
;
int
atom2
=
y
*
TILE_SIZE
+
j
;
if
(
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
if
(
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
real3
tempForce
;
real3
tempForce
;
real
tempEnergy
;
real
tempEnergy
;
computeOneInteractionF1
(
data
,
localData
[
tbx
+
j
],
tempEnergy
,
tempForce
);
computeOneInteractionF1
(
data
,
localData
[
tbx
+
j
],
tempEnergy
,
tempForce
);
...
@@ -264,7 +265,7 @@ extern "C" __global__ void computeGKForces(
...
@@ -264,7 +265,7 @@ extern "C" __global__ void computeGKForces(
zeroAtomData
(
data
);
zeroAtomData
(
data
);
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
int
atom2
=
y
*
TILE_SIZE
+
j
;
int
atom2
=
y
*
TILE_SIZE
+
j
;
if
(
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
if
(
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
real3
tempTorque
;
real3
tempTorque
;
computeOneInteractionT1
(
data
,
localData
[
tbx
+
j
],
tempTorque
);
computeOneInteractionT1
(
data
,
localData
[
tbx
+
j
],
tempTorque
);
computeOneInteractionT2
(
data
,
localData
[
tbx
+
j
],
tempTorque
);
computeOneInteractionT2
(
data
,
localData
[
tbx
+
j
],
tempTorque
);
...
@@ -434,7 +435,7 @@ __device__ void computeBornChainRuleInteraction(AtomData3& atom1, AtomData3& ato
...
@@ -434,7 +435,7 @@ __device__ void computeBornChainRuleInteraction(AtomData3& atom1, AtomData3& ato
}
}
/**
/**
* Compute
electrostatic interaction
s.
* Compute
chain rule term
s.
*/
*/
extern
"C"
__global__
void
computeChainRuleForce
(
extern
"C"
__global__
void
computeChainRuleForce
(
unsigned
long
long
*
__restrict__
forceBuffers
,
const
real4
*
__restrict__
posq
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
unsigned
long
long
*
__restrict__
forceBuffers
,
const
real4
*
__restrict__
posq
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
...
@@ -472,10 +473,11 @@ extern "C" __global__ void computeChainRuleForce(
...
@@ -472,10 +473,11 @@ extern "C" __global__ void computeChainRuleForce(
localData
[
threadIdx
.
x
].
scaledRadius
=
data
.
scaledRadius
;
localData
[
threadIdx
.
x
].
scaledRadius
=
data
.
scaledRadius
;
localData
[
threadIdx
.
x
].
bornRadius
=
data
.
bornRadius
;
localData
[
threadIdx
.
x
].
bornRadius
=
data
.
bornRadius
;
localData
[
threadIdx
.
x
].
bornForce
=
data
.
bornForce
;
localData
[
threadIdx
.
x
].
bornForce
=
data
.
bornForce
;
localData
[
threadIdx
.
x
].
force
=
make_real3
(
0
);
// Compute forces.
// Compute forces.
for
(
unsigned
int
j
=
0
;
j
<
TILE_SIZE
;
j
++
)
{
for
(
unsigned
int
j
=
(
tgx
+
1
)
&
(
TILE_SIZE
-
1
);
j
!=
tgx
;
j
=
(
j
+
1
)
&
(
TILE_SIZE
-
1
)
)
{
int
atom2
=
y
*
TILE_SIZE
+
j
;
int
atom2
=
y
*
TILE_SIZE
+
j
;
if
(
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
if
(
atom1
!=
atom2
&&
atom1
<
NUM_ATOMS
&&
atom2
<
NUM_ATOMS
)
{
real3
tempForce
;
real3
tempForce
;
...
@@ -484,9 +486,9 @@ extern "C" __global__ void computeChainRuleForce(
...
@@ -484,9 +486,9 @@ extern "C" __global__ void computeChainRuleForce(
localData
[
tbx
+
j
].
force
+=
tempForce
;
localData
[
tbx
+
j
].
force
+=
tempForce
;
}
}
}
}
atomicAdd
(
&
forceBuffers
[
atom1
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
data
.
force
.
x
*
0xFFFFFFFF
)));
atomicAdd
(
&
forceBuffers
[
atom1
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
(
data
.
force
.
x
+
localData
[
threadIdx
.
x
].
force
.
x
)
*
0xFFFFFFFF
)));
atomicAdd
(
&
forceBuffers
[
atom1
+
PADDED_NUM_ATOMS
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
data
.
force
.
y
*
0xFFFFFFFF
)));
atomicAdd
(
&
forceBuffers
[
atom1
+
PADDED_NUM_ATOMS
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
(
data
.
force
.
y
+
localData
[
threadIdx
.
x
].
force
.
y
)
*
0xFFFFFFFF
)));
atomicAdd
(
&
forceBuffers
[
atom1
+
2
*
PADDED_NUM_ATOMS
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
data
.
force
.
z
*
0xFFFFFFFF
)));
atomicAdd
(
&
forceBuffers
[
atom1
+
2
*
PADDED_NUM_ATOMS
],
static_cast
<
unsigned
long
long
>
((
long
long
)
(
(
data
.
force
.
z
+
localData
[
threadIdx
.
x
].
force
.
z
)
*
0xFFFFFFFF
)));
}
}
else
{
else
{
// This is an off-diagonal tile.
// This is an off-diagonal tile.
...
...
plugins/amoeba/platforms/cuda2/src/kernels/gkEDiffPairForce.cu
View file @
6c0082a5
#define APPLY_SCALE
#if defined F1
#if defined F1
__device__
void
computeOneEDiffInteractionF1
(
AtomData4
&
atom1
,
volatile
AtomData4
&
atom2
,
float
dScale
,
float
pScale
,
real
&
outputEnergy
,
real3
&
outputForce
)
{
__device__
void
computeOneEDiffInteractionF1
(
AtomData4
&
atom1
,
volatile
AtomData4
&
atom2
,
float
dScale
,
float
pScale
,
real
&
outputEnergy
,
real3
&
outputForce
)
{
#elif defined T1
#elif defined T1
...
...
plugins/amoeba/platforms/cuda2/src/kernels/gkPairForce.cu
View file @
6c0082a5
...
@@ -1079,8 +1079,8 @@ __device__ void computeOneInteractionB1B2(AtomData2& atom1, volatile AtomData2&
...
@@ -1079,8 +1079,8 @@ __device__ void computeOneInteractionB1B2(AtomData2& atom1, volatile AtomData2&
#endif
#endif
#if defined F1
#if defined F1
outputEnergy
+
=
energy
;
outputEnergy
=
energy
;
if
((
xr
!=
0
||
yr
!=
0
||
zr
!=
0
))
{
if
((
xr
!=
0
||
yr
!=
0
||
zr
!=
0
))
{
force
.
x
=
dedx
;
force
.
x
=
dedx
;
...
...
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