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
6ab144ba
"wrappers/vscode:/vscode.git/clone" did not exist on "763cbaa14c6ef9f18fc969d6ca4297921134467d"
Commit
6ab144ba
authored
Jan 12, 2016
by
Peter Eastman
Browse files
Continuing CUDA implementation of extrapolated polarization
parent
f2f46bd5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+6
-3
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
+11
-10
No files found.
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
6ab144ba
...
...
@@ -1776,13 +1776,15 @@ void CudaCalcAmoebaMultipoleForceKernel::computeInducedField(void** recipBoxVect
cu
.
executeKernel
(
pmeInducedPotentialKernel
,
pmeInducedPotentialArgs
,
cu
.
getNumAtoms
());
if
(
polarizationType
==
AmoebaMultipoleForce
::
Extrapolated
)
{
void
*
pmeRecordInducedFieldDipolesArgs
[]
=
{
&
pmePhid
->
getDevicePointer
(),
&
pmePhip
->
getDevicePointer
(),
&
inducedField
->
getDevicePointer
(),
&
inducedFieldPolar
->
getDevicePointer
(),
&
inducedDipoleFieldGradient
->
getDevicePointer
(),
&
inducedDipoleFieldGradientPolar
->
getDevicePointer
(),
recipBoxVectorPointer
[
0
],
recipBoxVectorPointer
[
1
],
recipBoxVectorPointer
[
2
]};
&
inducedField
->
getDevicePointer
(),
&
inducedFieldPolar
->
getDevicePointer
(),
&
inducedDipole
->
getDevicePointer
(),
&
inducedDipolePolar
->
getDevicePointer
(),
&
inducedDipoleFieldGradient
->
getDevicePointer
(),
&
inducedDipoleFieldGradientPolar
->
getDevicePointer
(),
recipBoxVectorPointer
[
0
],
recipBoxVectorPointer
[
1
],
recipBoxVectorPointer
[
2
]};
cu
.
executeKernel
(
pmeRecordInducedFieldDipolesKernel
,
pmeRecordInducedFieldDipolesArgs
,
cu
.
getNumAtoms
());
}
else
{
void
*
pmeRecordInducedFieldDipolesArgs
[]
=
{
&
pmePhid
->
getDevicePointer
(),
&
pmePhip
->
getDevicePointer
(),
&
inducedField
->
getDevicePointer
(),
&
inducedFieldPolar
->
getDevicePointer
(),
recipBoxVectorPointer
[
0
],
recipBoxVectorPointer
[
1
],
recipBoxVectorPointer
[
2
]};
&
inducedField
->
getDevicePointer
(),
&
inducedFieldPolar
->
getDevicePointer
(),
&
inducedDipole
->
getDevicePointer
(),
&
inducedDipolePolar
->
getDevicePointer
(),
recipBoxVectorPointer
[
0
],
recipBoxVectorPointer
[
1
],
recipBoxVectorPointer
[
2
]};
cu
.
executeKernel
(
pmeRecordInducedFieldDipolesKernel
,
pmeRecordInducedFieldDipolesArgs
,
cu
.
getNumAtoms
());
}
}
...
...
@@ -1912,6 +1914,7 @@ void CudaCalcAmoebaMultipoleForceKernel::computeExtrapolatedDipoles(void** recip
void
*
computeArgs
[]
=
{
&
inducedDipole
->
getDevicePointer
(),
&
inducedDipolePolar
->
getDevicePointer
(),
&
extrapolatedDipole
->
getDevicePointer
(),
&
extrapolatedDipolePolar
->
getDevicePointer
()};
cu
.
executeKernel
(
computeExtrapolatedKernel
,
computeArgs
,
extrapolatedDipole
->
getSize
());
computeInducedField
(
recipBoxVectorPointer
);
}
void
CudaCalcAmoebaMultipoleForceKernel
::
ensureMultipolesValid
(
ContextImpl
&
context
)
{
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
View file @
6ab144ba
...
...
@@ -643,8 +643,8 @@ extern "C" __global__ void computeInducedPotentialFromGrid(const real2* __restri
// Process the atoms in spatially sorted order. This improves cache performance when loading
// the grid values.
for
(
int
i
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
i
<
NUM_ATOMS
;
i
+=
blockDim
.
x
*
gridDim
.
x
)
{
int
m
=
pmeAtomGridIndex
[
i
].
x
;
for
(
int
atom
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
atom
<
NUM_ATOMS
;
atom
+=
blockDim
.
x
*
gridDim
.
x
)
{
int
m
=
pmeAtomGridIndex
[
atom
].
x
;
real4
pos
=
posq
[
m
];
pos
-=
periodicBoxVecZ
*
floor
(
pos
.
z
*
recipBoxVecZ
.
z
+
0.5
f
);
pos
-=
periodicBoxVecY
*
floor
(
pos
.
y
*
recipBoxVecY
.
z
+
0.5
f
);
...
...
@@ -1073,8 +1073,8 @@ extern "C" __global__ void computeInducedDipoleForceAndEnergy(real4* __restrict_
energyBuffer
[
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
]
+=
0.25
f
*
EPSILON_FACTOR
*
energy
;
}
extern
"C"
__global__
void
recordInducedFieldDipoles
(
const
real
*
__restrict__
phid
,
real
*
const
__restrict__
phip
,
long
long
*
__restrict__
inducedField
,
l
on
g
long
*
__restrict__
induced
Field
Polar
,
extern
"C"
__global__
void
recordInducedFieldDipoles
(
const
real
*
__restrict__
phid
,
real
*
const
__restrict__
phip
,
long
long
*
__restrict__
inducedField
,
long
long
*
__restrict__
inducedField
Polar
,
c
on
st
real
*
__restrict__
inducedDipole
,
const
real
*
__restrict__
induced
Dipole
Polar
,
#ifdef EXTRAPOLATED_POLARIZATION
unsigned
long
long
*
__restrict__
fieldGradient
,
unsigned
long
long
*
__restrict__
fieldGradientPolar
,
#endif
...
...
@@ -1092,13 +1092,14 @@ extern "C" __global__ void recordInducedFieldDipoles(const real* __restrict__ ph
fracToCart
[
2
][
2
]
=
GRID_SIZE_Z
*
recipBoxVecZ
.
z
;
}
__syncthreads
();
real
selfDipoleScale
=
(
4
/
(
real
)
3
)
*
(
EWALD_ALPHA
*
EWALD_ALPHA
*
EWALD_ALPHA
)
/
SQRT_PI
;
for
(
int
i
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
i
<
NUM_ATOMS
;
i
+=
blockDim
.
x
*
gridDim
.
x
)
{
inducedField
[
i
]
-=
(
long
long
)
(
0x100000000
*
(
phid
[
i
+
NUM_ATOMS
]
*
fracToCart
[
0
][
0
]
+
phid
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
0
][
1
]
+
phid
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
0
][
2
]));
inducedField
[
i
+
PADDED_NUM_ATOMS
]
-=
(
long
long
)
(
0x100000000
*
(
phid
[
i
+
NUM_ATOMS
]
*
fracToCart
[
1
][
0
]
+
phid
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
1
][
1
]
+
phid
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
1
][
2
]));
inducedField
[
i
+
PADDED_NUM_ATOMS
*
2
]
-=
(
long
long
)
(
0x100000000
*
(
phid
[
i
+
NUM_ATOMS
]
*
fracToCart
[
2
][
0
]
+
phid
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
2
][
1
]
+
phid
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
2
][
2
]));
inducedFieldPolar
[
i
]
-=
(
long
long
)
(
0x100000000
*
(
phip
[
i
+
NUM_ATOMS
]
*
fracToCart
[
0
][
0
]
+
phip
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
0
][
1
]
+
phip
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
0
][
2
]));
inducedFieldPolar
[
i
+
PADDED_NUM_ATOMS
]
-=
(
long
long
)
(
0x100000000
*
(
phip
[
i
+
NUM_ATOMS
]
*
fracToCart
[
1
][
0
]
+
phip
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
1
][
1
]
+
phip
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
1
][
2
]));
inducedFieldPolar
[
i
+
PADDED_NUM_ATOMS
*
2
]
-=
(
long
long
)
(
0x100000000
*
(
phip
[
i
+
NUM_ATOMS
]
*
fracToCart
[
2
][
0
]
+
phip
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
2
][
1
]
+
phip
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
2
][
2
]));
inducedField
[
i
]
-=
(
long
long
)
(
0x100000000
*
(
phid
[
i
+
NUM_ATOMS
]
*
fracToCart
[
0
][
0
]
+
phid
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
0
][
1
]
+
phid
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
0
][
2
]
-
selfDipoleScale
*
inducedDipole
[
3
*
i
]
));
inducedField
[
i
+
PADDED_NUM_ATOMS
]
-=
(
long
long
)
(
0x100000000
*
(
phid
[
i
+
NUM_ATOMS
]
*
fracToCart
[
1
][
0
]
+
phid
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
1
][
1
]
+
phid
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
1
][
2
]
-
selfDipoleScale
*
inducedDipole
[
3
*
i
+
1
]
));
inducedField
[
i
+
PADDED_NUM_ATOMS
*
2
]
-=
(
long
long
)
(
0x100000000
*
(
phid
[
i
+
NUM_ATOMS
]
*
fracToCart
[
2
][
0
]
+
phid
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
2
][
1
]
+
phid
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
2
][
2
]
-
selfDipoleScale
*
inducedDipole
[
3
*
i
+
2
]
));
inducedFieldPolar
[
i
]
-=
(
long
long
)
(
0x100000000
*
(
phip
[
i
+
NUM_ATOMS
]
*
fracToCart
[
0
][
0
]
+
phip
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
0
][
1
]
+
phip
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
0
][
2
]
-
selfDipoleScale
*
inducedDipolePolar
[
3
*
i
]
));
inducedFieldPolar
[
i
+
PADDED_NUM_ATOMS
]
-=
(
long
long
)
(
0x100000000
*
(
phip
[
i
+
NUM_ATOMS
]
*
fracToCart
[
1
][
0
]
+
phip
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
1
][
1
]
+
phip
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
1
][
2
]
-
selfDipoleScale
*
inducedDipolePolar
[
3
*
i
+
1
]
));
inducedFieldPolar
[
i
+
PADDED_NUM_ATOMS
*
2
]
-=
(
long
long
)
(
0x100000000
*
(
phip
[
i
+
NUM_ATOMS
]
*
fracToCart
[
2
][
0
]
+
phip
[
i
+
NUM_ATOMS
*
2
]
*
fracToCart
[
2
][
1
]
+
phip
[
i
+
NUM_ATOMS
*
3
]
*
fracToCart
[
2
][
2
]
-
selfDipoleScale
*
inducedDipolePolar
[
3
*
i
+
2
]
));
#ifdef EXTRAPOLATED_POLARIZATION
// Compute and store the field gradients for later use.
...
...
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