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
4c6d48ba
Commit
4c6d48ba
authored
Sep 03, 2015
by
peastman
Browse files
Added NonbondedForce::getPMEParametersInContext()
parent
cef58048
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
0 deletions
+62
-0
platforms/opencl/tests/TestOpenCLEwald.cpp
platforms/opencl/tests/TestOpenCLEwald.cpp
+14
-0
platforms/reference/include/ReferenceKernels.h
platforms/reference/include/ReferenceKernels.h
+9
-0
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+9
-0
platforms/reference/tests/TestReferenceEwald.cpp
platforms/reference/tests/TestReferenceEwald.cpp
+14
-0
plugins/cpupme/src/CpuPmeKernels.cpp
plugins/cpupme/src/CpuPmeKernels.cpp
+7
-0
plugins/cpupme/src/CpuPmeKernels.h
plugins/cpupme/src/CpuPmeKernels.h
+9
-0
No files found.
platforms/opencl/tests/TestOpenCLEwald.cpp
View file @
4c6d48ba
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "openmm/LangevinIntegrator.h"
#include "openmm/LangevinIntegrator.h"
#include "openmm/VerletIntegrator.h"
#include "openmm/VerletIntegrator.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/NonbondedForceImpl.h"
#include "SimTKOpenMMRealType.h"
#include "SimTKOpenMMRealType.h"
#include "sfmt/SFMT.h"
#include "sfmt/SFMT.h"
#include <iostream>
#include <iostream>
...
@@ -299,6 +300,19 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
...
@@ -299,6 +300,19 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
diff
=
sqrt
(
diff
)
/
norm
;
diff
=
sqrt
(
diff
)
/
norm
;
ASSERT
(
diff
<
2
*
tol
);
ASSERT
(
diff
<
2
*
tol
);
}
}
if
(
method
==
NonbondedForce
::
PME
)
{
// See if the PME parameters were calculated correctly.
double
expectedAlpha
,
actualAlpha
;
int
expectedSize
[
3
],
actualSize
[
3
];
NonbondedForceImpl
::
calcPMEParameters
(
system
,
*
force
,
expectedAlpha
,
expectedSize
[
0
],
expectedSize
[
1
],
expectedSize
[
2
]);
force
->
getPMEParametersInContext
(
context
,
actualAlpha
,
actualSize
[
0
],
actualSize
[
1
],
actualSize
[
2
]);
ASSERT_EQUAL_TOL
(
expectedAlpha
,
actualAlpha
,
1e-5
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
ASSERT
(
actualSize
[
i
]
>=
expectedSize
[
i
]);
ASSERT
(
actualSize
[
i
]
<
expectedSize
[
i
]
+
10
);
}
}
}
}
}
}
}
}
...
...
platforms/reference/include/ReferenceKernels.h
View file @
4c6d48ba
...
@@ -578,6 +578,15 @@ public:
...
@@ -578,6 +578,15 @@ public:
* @param force the NonbondedForce to copy the parameters from
* @param force the NonbondedForce to copy the parameters from
*/
*/
void
copyParametersToContext
(
ContextImpl
&
context
,
const
NonbondedForce
&
force
);
void
copyParametersToContext
(
ContextImpl
&
context
,
const
NonbondedForce
&
force
);
/**
* Get the parameters being used for PME.
*
* @param alpha the separation parameter
* @param nx the number of grid points along the X axis
* @param ny the number of grid points along the Y axis
* @param nz the number of grid points along the Z axis
*/
void
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
private:
private:
int
numParticles
,
num14
;
int
numParticles
,
num14
;
int
**
bonded14IndexArray
;
int
**
bonded14IndexArray
;
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
4c6d48ba
...
@@ -969,6 +969,15 @@ void ReferenceCalcNonbondedForceKernel::copyParametersToContext(ContextImpl& con
...
@@ -969,6 +969,15 @@ void ReferenceCalcNonbondedForceKernel::copyParametersToContext(ContextImpl& con
dispersionCoefficient
=
NonbondedForceImpl
::
calcDispersionCorrection
(
context
.
getSystem
(),
force
);
dispersionCoefficient
=
NonbondedForceImpl
::
calcDispersionCorrection
(
context
.
getSystem
(),
force
);
}
}
void
ReferenceCalcNonbondedForceKernel
::
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
if
(
nonbondedMethod
!=
PME
)
throw
OpenMMException
(
"getPMEParametersInContext: This Context is not using PME"
);
alpha
=
ewaldAlpha
;
nx
=
gridSize
[
0
];
ny
=
gridSize
[
1
];
nz
=
gridSize
[
2
];
}
ReferenceCalcCustomNonbondedForceKernel
::~
ReferenceCalcCustomNonbondedForceKernel
()
{
ReferenceCalcCustomNonbondedForceKernel
::~
ReferenceCalcCustomNonbondedForceKernel
()
{
disposeRealArray
(
particleParamArray
,
numParticles
);
disposeRealArray
(
particleParamArray
,
numParticles
);
if
(
neighborList
!=
NULL
)
if
(
neighborList
!=
NULL
)
...
...
platforms/reference/tests/TestReferenceEwald.cpp
View file @
4c6d48ba
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "SimTKOpenMMRealType.h"
#include "SimTKOpenMMRealType.h"
#include "sfmt/SFMT.h"
#include "sfmt/SFMT.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/internal/NonbondedForceImpl.h"
#include <iostream>
#include <iostream>
#include <vector>
#include <vector>
...
@@ -397,6 +398,19 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
...
@@ -397,6 +398,19 @@ void testErrorTolerance(NonbondedForce::NonbondedMethod method) {
diff
=
sqrt
(
diff
)
/
norm
;
diff
=
sqrt
(
diff
)
/
norm
;
ASSERT
(
diff
<
2
*
tol
);
ASSERT
(
diff
<
2
*
tol
);
}
}
if
(
method
==
NonbondedForce
::
PME
)
{
// See if the PME parameters were calculated correctly.
double
expectedAlpha
,
actualAlpha
;
int
expectedSize
[
3
],
actualSize
[
3
];
NonbondedForceImpl
::
calcPMEParameters
(
system
,
*
force
,
expectedAlpha
,
expectedSize
[
0
],
expectedSize
[
1
],
expectedSize
[
2
]);
force
->
getPMEParametersInContext
(
context
,
actualAlpha
,
actualSize
[
0
],
actualSize
[
1
],
actualSize
[
2
]);
ASSERT_EQUAL_TOL
(
expectedAlpha
,
actualAlpha
,
1e-5
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
ASSERT
(
actualSize
[
i
]
>=
expectedSize
[
i
]);
ASSERT
(
actualSize
[
i
]
<
expectedSize
[
i
]
+
10
);
}
}
}
}
}
}
}
}
...
...
plugins/cpupme/src/CpuPmeKernels.cpp
View file @
4c6d48ba
...
@@ -583,6 +583,13 @@ bool CpuCalcPmeReciprocalForceKernel::isProcessorSupported() {
...
@@ -583,6 +583,13 @@ bool CpuCalcPmeReciprocalForceKernel::isProcessorSupported() {
return
isVec4Supported
();
return
isVec4Supported
();
}
}
void
CpuCalcPmeReciprocalForceKernel
::
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
alpha
=
this
->
alpha
;
nx
=
gridx
;
ny
=
gridy
;
nz
=
gridz
;
}
int
CpuCalcPmeReciprocalForceKernel
::
findFFTDimension
(
int
minimum
,
bool
isZ
)
{
int
CpuCalcPmeReciprocalForceKernel
::
findFFTDimension
(
int
minimum
,
bool
isZ
)
{
if
(
minimum
<
1
)
if
(
minimum
<
1
)
return
1
;
return
1
;
...
...
plugins/cpupme/src/CpuPmeKernels.h
View file @
4c6d48ba
...
@@ -91,6 +91,15 @@ public:
...
@@ -91,6 +91,15 @@ public:
* Get whether the current CPU supports all features needed by this kernel.
* Get whether the current CPU supports all features needed by this kernel.
*/
*/
static
bool
isProcessorSupported
();
static
bool
isProcessorSupported
();
/**
* Get the parameters being used for PME.
*
* @param alpha the separation parameter
* @param nx the number of grid points along the X axis
* @param ny the number of grid points along the Y axis
* @param nz the number of grid points along the Z axis
*/
void
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
private:
private:
class
ComputeTask
;
class
ComputeTask
;
/**
/**
...
...
Prev
1
2
Next
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