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
3bb595ce
Commit
3bb595ce
authored
Jan 13, 2016
by
Peter Eastman
Browse files
Finished CUDA implementation of PME with extrapolated polarization
parent
6ab144ba
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
6 deletions
+8
-6
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+2
-0
plugins/amoeba/platforms/cuda/src/kernels/multipoleInducedField.cu
...moeba/platforms/cuda/src/kernels/multipoleInducedField.cu
+2
-2
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
+1
-1
plugins/amoeba/platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
.../platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
+1
-1
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaExtrapolatedPolarization.cpp
...rms/cuda/tests/TestCudaAmoebaExtrapolatedPolarization.cpp
+1
-1
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaExtrapolatedPolarization.cpp
...nce/tests/TestReferenceAmoebaExtrapolatedPolarization.cpp
+1
-1
No files found.
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
3bb595ce
...
@@ -1239,6 +1239,8 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
...
@@ -1239,6 +1239,8 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
pmeDefines
[
"SQRT_PI"
]
=
cu
.
doubleToString
(
sqrt
(
M_PI
));
pmeDefines
[
"SQRT_PI"
]
=
cu
.
doubleToString
(
sqrt
(
M_PI
));
if
(
polarizationType
==
AmoebaMultipoleForce
::
Direct
)
if
(
polarizationType
==
AmoebaMultipoleForce
::
Direct
)
pmeDefines
[
"DIRECT_POLARIZATION"
]
=
""
;
pmeDefines
[
"DIRECT_POLARIZATION"
]
=
""
;
else
if
(
polarizationType
==
AmoebaMultipoleForce
::
Mutual
)
pmeDefines
[
"MUTUAL_POLARIZATION"
]
=
""
;
else
if
(
polarizationType
==
AmoebaMultipoleForce
::
Extrapolated
)
else
if
(
polarizationType
==
AmoebaMultipoleForce
::
Extrapolated
)
pmeDefines
[
"EXTRAPOLATED_POLARIZATION"
]
=
""
;
pmeDefines
[
"EXTRAPOLATED_POLARIZATION"
]
=
""
;
CUmodule
module
=
cu
.
createModule
(
CudaKernelSources
::
vectorOps
+
CudaAmoebaKernelSources
::
multipolePme
,
pmeDefines
);
CUmodule
module
=
cu
.
createModule
(
CudaKernelSources
::
vectorOps
+
CudaAmoebaKernelSources
::
multipolePme
,
pmeDefines
);
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipoleInducedField.cu
View file @
3bb595ce
...
@@ -639,8 +639,8 @@ extern "C" __global__ void recordInducedDipolesForDIIS(const long long* __restri
...
@@ -639,8 +639,8 @@ extern "C" __global__ void recordInducedDipolesForDIIS(const long long* __restri
real
oldDipole
=
inducedDipole
[
dipoleIndex
];
real
oldDipole
=
inducedDipole
[
dipoleIndex
];
real
oldDipolePolar
=
inducedDipolePolar
[
dipoleIndex
];
real
oldDipolePolar
=
inducedDipolePolar
[
dipoleIndex
];
long
long
fixedS
=
(
fixedFieldS
==
NULL
?
(
long
long
)
0
:
fixedFieldS
[
fieldIndex
]);
long
long
fixedS
=
(
fixedFieldS
==
NULL
?
(
long
long
)
0
:
fixedFieldS
[
fieldIndex
]);
real
newDipole
=
scale
*
((
fixedField
[
fieldIndex
]
+
fixedS
+
inducedField
[
fieldIndex
])
*
fieldScale
+
ewaldScale
*
oldDipole
);
real
newDipole
=
scale
*
((
fixedField
[
fieldIndex
]
+
fixedS
+
inducedField
[
fieldIndex
])
*
fieldScale
);
real
newDipolePolar
=
scale
*
((
fixedFieldPolar
[
fieldIndex
]
+
fixedS
+
inducedFieldPolar
[
fieldIndex
])
*
fieldScale
+
ewaldScale
*
oldDipolePolar
);
real
newDipolePolar
=
scale
*
((
fixedFieldPolar
[
fieldIndex
]
+
fixedS
+
inducedFieldPolar
[
fieldIndex
])
*
fieldScale
);
int
storePrevIndex
=
dipoleIndex
+
min
(
iteration
,
MAX_PREV_DIIS_DIPOLES
-
1
)
*
NUM_ATOMS
*
3
;
int
storePrevIndex
=
dipoleIndex
+
min
(
iteration
,
MAX_PREV_DIIS_DIPOLES
-
1
)
*
NUM_ATOMS
*
3
;
prevDipoles
[
storePrevIndex
]
=
newDipole
;
prevDipoles
[
storePrevIndex
]
=
newDipole
;
prevDipolesPolar
[
storePrevIndex
]
=
newDipolePolar
;
prevDipolesPolar
[
storePrevIndex
]
=
newDipolePolar
;
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
View file @
3bb595ce
...
@@ -1051,7 +1051,7 @@ extern "C" __global__ void computeInducedDipoleForceAndEnergy(real4* __restrict_
...
@@ -1051,7 +1051,7 @@ extern "C" __global__ void computeInducedDipoleForceAndEnergy(real4* __restrict_
f
.
x
+=
(
inducedDipole
[
k
]
+
inducedDipolePolar
[
k
])
*
phi
[
i
+
NUM_ATOMS
*
j1
];
f
.
x
+=
(
inducedDipole
[
k
]
+
inducedDipolePolar
[
k
])
*
phi
[
i
+
NUM_ATOMS
*
j1
];
f
.
y
+=
(
inducedDipole
[
k
]
+
inducedDipolePolar
[
k
])
*
phi
[
i
+
NUM_ATOMS
*
j2
];
f
.
y
+=
(
inducedDipole
[
k
]
+
inducedDipolePolar
[
k
])
*
phi
[
i
+
NUM_ATOMS
*
j2
];
f
.
z
+=
(
inducedDipole
[
k
]
+
inducedDipolePolar
[
k
])
*
phi
[
i
+
NUM_ATOMS
*
j3
];
f
.
z
+=
(
inducedDipole
[
k
]
+
inducedDipolePolar
[
k
])
*
phi
[
i
+
NUM_ATOMS
*
j3
];
#if
n
def
DIRECT
_POLARIZATION
#ifdef
MUTUAL
_POLARIZATION
f
.
x
+=
(
inducedDipole
[
k
]
*
phip
[
i
+
NUM_ATOMS
*
j1
]
+
inducedDipolePolar
[
k
]
*
phid
[
i
+
NUM_ATOMS
*
j1
]);
f
.
x
+=
(
inducedDipole
[
k
]
*
phip
[
i
+
NUM_ATOMS
*
j1
]
+
inducedDipolePolar
[
k
]
*
phid
[
i
+
NUM_ATOMS
*
j1
]);
f
.
y
+=
(
inducedDipole
[
k
]
*
phip
[
i
+
NUM_ATOMS
*
j2
]
+
inducedDipolePolar
[
k
]
*
phid
[
i
+
NUM_ATOMS
*
j2
]);
f
.
y
+=
(
inducedDipole
[
k
]
*
phip
[
i
+
NUM_ATOMS
*
j2
]
+
inducedDipolePolar
[
k
]
*
phid
[
i
+
NUM_ATOMS
*
j2
]);
f
.
z
+=
(
inducedDipole
[
k
]
*
phip
[
i
+
NUM_ATOMS
*
j3
]
+
inducedDipolePolar
[
k
]
*
phid
[
i
+
NUM_ATOMS
*
j3
]);
f
.
z
+=
(
inducedDipole
[
k
]
*
phip
[
i
+
NUM_ATOMS
*
j3
]
+
inducedDipolePolar
[
k
]
*
phid
[
i
+
NUM_ATOMS
*
j3
]);
...
...
plugins/amoeba/platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
View file @
3bb595ce
...
@@ -365,7 +365,7 @@ __device__ void computeOneInteraction(AtomData& atom1, AtomData& atom2, bool has
...
@@ -365,7 +365,7 @@ __device__ void computeOneInteraction(AtomData& atom1, AtomData& atom2, bool has
real
iEIY
=
qiUinpI
.
x
*
Vijp
[
1
]
+
qiUindI
.
x
*
Vijd
[
1
]
-
qiUinpI
.
y
*
Vijp
[
0
]
-
qiUindI
.
y
*
Vijd
[
0
];
real
iEIY
=
qiUinpI
.
x
*
Vijp
[
1
]
+
qiUindI
.
x
*
Vijd
[
1
]
-
qiUinpI
.
y
*
Vijp
[
0
]
-
qiUindI
.
y
*
Vijd
[
0
];
real
iEJY
=
qiUinpJ
.
x
*
Vjip
[
1
]
+
qiUindJ
.
x
*
Vjid
[
1
]
-
qiUinpJ
.
y
*
Vjip
[
0
]
-
qiUindJ
.
y
*
Vjid
[
0
];
real
iEJY
=
qiUinpJ
.
x
*
Vjip
[
1
]
+
qiUindJ
.
x
*
Vjid
[
1
]
-
qiUinpJ
.
y
*
Vjip
[
0
]
-
qiUindJ
.
y
*
Vjid
[
0
];
#ifdef
USE_
MUTUAL_POLARIZATION
#ifdef MUTUAL_POLARIZATION
// Uind-Uind terms (m=0)
// Uind-Uind terms (m=0)
real
eCoef
=
-
fourThirds
*
rInvVec
[
3
]
*
(
3
*
(
thole_d0
+
bVec
[
3
])
+
alphaRVec
[
3
]
*
X
);
real
eCoef
=
-
fourThirds
*
rInvVec
[
3
]
*
(
3
*
(
thole_d0
+
bVec
[
3
])
+
alphaRVec
[
3
]
*
X
);
real
dCoef
=
rInvVec
[
4
]
*
(
6
*
(
dthole_d0
+
bVec
[
3
])
+
4
*
alphaRVec
[
5
]
*
X
);
real
dCoef
=
rInvVec
[
4
]
*
(
6
*
(
dthole_d0
+
bVec
[
3
])
+
4
*
alphaRVec
[
5
]
*
X
);
...
...
plugins/amoeba/platforms/cuda/tests/TestCudaAmoebaExtrapolatedPolarization.cpp
View file @
3bb595ce
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
#define ASSERT_EQUAL_TOL_MOD(expected, found, tol, testname) {double _scale_ = std::abs(expected) > 1.0 ? std::abs(expected) : 1.0; if (!(std::abs((expected)-(found))/_scale_ <= (tol))) {std::stringstream details; details << testname << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_TOL_MOD(expected, found, tol, testname) {double _scale_ = std::abs(expected) > 1.0 ? std::abs(expected) : 1.0; if (!(std::abs((expected)-(found))/_scale_ <= (tol))) {std::stringstream details; details << testname << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_VEC_MOD(expected, found, tol,testname) {
ASSERT_EQUAL_TOL_MOD
((expected
)
[0]
,
(found
)
[0]
, (tol),(testname)); ASSERT_EQUAL_TOL_MOD((expected)[1], (found)[1], (tol),(testname)); ASSERT_EQUAL_TOL_MOD((expected)[2], (found)[2], (tol),(testname
));};
#define ASSERT_EQUAL_VEC_MOD(expected, found, tol,
testname) {
double _norm_ = std::sqrt(expected.dot(expected)); double _scale_ = _norm_ > 1.0 ? _norm_ : 1.0; if ((std::abs
((expected[0]
)-
(found[0]
))/_scale_ > (tol)) || (std::abs((expected[1])-(found[1]))/_scale_ > (tol)) || (std::abs((expected[2])-(found[2]))/_scale_ > (tol))) {std::stringstream details; details << testname << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str(
));}
}
;
using
namespace
OpenMM
;
using
namespace
OpenMM
;
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaExtrapolatedPolarization.cpp
View file @
3bb595ce
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
#define ASSERT_EQUAL_TOL_MOD(expected, found, tol, testname) {double _scale_ = std::abs(expected) > 1.0 ? std::abs(expected) : 1.0; if (!(std::abs((expected)-(found))/_scale_ <= (tol))) {std::stringstream details; details << testname << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_TOL_MOD(expected, found, tol, testname) {double _scale_ = std::abs(expected) > 1.0 ? std::abs(expected) : 1.0; if (!(std::abs((expected)-(found))/_scale_ <= (tol))) {std::stringstream details; details << testname << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_VEC_MOD(expected, found, tol,testname) {
ASSERT_EQUAL_TOL_MOD
((expected
)
[0]
,
(found
)
[0]
, (tol),(testname)); ASSERT_EQUAL_TOL_MOD((expected)[1], (found)[1], (tol),(testname)); ASSERT_EQUAL_TOL_MOD((expected)[2], (found)[2], (tol),(testname
));};
#define ASSERT_EQUAL_VEC_MOD(expected, found, tol,
testname) {
double _norm_ = std::sqrt(expected.dot(expected)); double _scale_ = _norm_ > 1.0 ? _norm_ : 1.0; if ((std::abs
((expected[0]
)-
(found[0]
))/_scale_ > (tol)) || (std::abs((expected[1])-(found[1]))/_scale_ > (tol)) || (std::abs((expected[2])-(found[2]))/_scale_ > (tol))) {std::stringstream details; details << testname << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str(
));}
}
;
using
namespace
OpenMM
;
using
namespace
OpenMM
;
...
...
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