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
5270f858
Commit
5270f858
authored
Jun 25, 2020
by
Charlles Abreu
Browse files
resolved PR #2611 merge conflicts
parents
697ab72e
eec9cd69
Changes
91
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
148 additions
and
28 deletions
+148
-28
platforms/cpu/src/CpuKernels.cpp
platforms/cpu/src/CpuKernels.cpp
+12
-1
platforms/cpu/src/CpuNeighborList.cpp
platforms/cpu/src/CpuNeighborList.cpp
+1
-1
platforms/cpu/src/CpuNonbondedForceAvx.cpp
platforms/cpu/src/CpuNonbondedForceAvx.cpp
+5
-5
platforms/cpu/src/CpuNonbondedForceAvx2.cpp
platforms/cpu/src/CpuNonbondedForceAvx2.cpp
+44
-0
platforms/cpu/src/CpuNonbondedForceFvec.cpp
platforms/cpu/src/CpuNonbondedForceFvec.cpp
+11
-5
platforms/opencl/tests/TestOpenCLCheckpoints.cpp
platforms/opencl/tests/TestOpenCLCheckpoints.cpp
+4
-1
platforms/opencl/tests/TestOpenCLCustomAngleForce.cpp
platforms/opencl/tests/TestOpenCLCustomAngleForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLCustomBondForce.cpp
platforms/opencl/tests/TestOpenCLCustomBondForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLCustomCompoundBondForce.cpp
platforms/opencl/tests/TestOpenCLCustomCompoundBondForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLCustomExternalForce.cpp
platforms/opencl/tests/TestOpenCLCustomExternalForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLCustomNonbondedForce.cpp
platforms/opencl/tests/TestOpenCLCustomNonbondedForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLCustomTorsionForce.cpp
platforms/opencl/tests/TestOpenCLCustomTorsionForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLHarmonicAngleForce.cpp
platforms/opencl/tests/TestOpenCLHarmonicAngleForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLHarmonicBondForce.cpp
platforms/opencl/tests/TestOpenCLHarmonicBondForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLNonbondedForce.cpp
platforms/opencl/tests/TestOpenCLNonbondedForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLPeriodicTorsionForce.cpp
platforms/opencl/tests/TestOpenCLPeriodicTorsionForce.cpp
+5
-1
platforms/opencl/tests/TestOpenCLRBTorsionForce.cpp
platforms/opencl/tests/TestOpenCLRBTorsionForce.cpp
+5
-1
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+12
-1
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
.../reference/src/SimTKReference/ReferenceCustomDynamics.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceNoseHooverDynamics.cpp
...erence/src/SimTKReference/ReferenceNoseHooverDynamics.cpp
+2
-1
No files found.
platforms/cpu/src/CpuKernels.cpp
View file @
5270f858
...
...
@@ -712,12 +712,23 @@ double CpuCalcNonbondedForceKernel::execute(ContextImpl& context, bool includeFo
void
CpuCalcNonbondedForceKernel
::
copyParametersToContext
(
ContextImpl
&
context
,
const
NonbondedForce
&
force
)
{
if
(
force
.
getNumParticles
()
!=
numParticles
)
throw
OpenMMException
(
"updateParametersInContext: The number of particles has changed"
);
// Identify which exceptions are 1-4 interactions.
set
<
int
>
exceptionsWithOffsets
;
for
(
int
i
=
0
;
i
<
force
.
getNumExceptionParameterOffsets
();
i
++
)
{
string
param
;
int
exception
;
double
charge
,
sigma
,
epsilon
;
force
.
getExceptionParameterOffset
(
i
,
param
,
exception
,
charge
,
sigma
,
epsilon
);
exceptionsWithOffsets
.
insert
(
exception
);
}
vector
<
int
>
nb14s
;
for
(
int
i
=
0
;
i
<
force
.
getNumExceptions
();
i
++
)
{
int
particle1
,
particle2
;
double
chargeProd
,
sigma
,
epsilon
;
force
.
getExceptionParameters
(
i
,
particle1
,
particle2
,
chargeProd
,
sigma
,
epsilon
);
if
(
chargeProd
!=
0.0
||
epsilon
!=
0.0
)
if
(
chargeProd
!=
0.0
||
epsilon
!=
0.0
||
exceptionsWithOffsets
.
find
(
i
)
!=
exceptionsWithOffsets
.
end
()
)
nb14s
.
push_back
(
i
);
}
if
(
nb14s
.
size
()
!=
num14
)
...
...
platforms/cpu/src/CpuNeighborList.cpp
View file @
5270f858
...
...
@@ -501,7 +501,7 @@ int CpuNeighborList::getBlockSize() const {
return
blockSize
;
}
const
std
::
vector
<
int
>&
CpuNeighborList
::
getSortedAtoms
()
const
{
const
std
::
vector
<
int
32_t
>&
CpuNeighborList
::
getSortedAtoms
()
const
{
return
sortedAtoms
;
}
...
...
platforms/cpu/src/CpuNonbondedForce
Vec8
.cpp
→
platforms/cpu/src/CpuNonbondedForce
Avx
.cpp
View file @
5270f858
...
...
@@ -27,9 +27,9 @@
#ifdef __AVX__
#include "openmm/internal/vectorize
8
.h"
#include "openmm/internal/vectorize
Avx
.h"
bool
is
Vec8
Supported
()
{
bool
is
Avx
Supported
()
{
// Make sure the CPU supports AVX.
int
cpuInfo
[
4
];
cpuid
(
cpuInfo
,
0
);
...
...
@@ -40,16 +40,16 @@ bool isVec8Supported() {
return
false
;
}
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForce
Vec8
()
{
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForce
Avx
()
{
return
new
OpenMM
::
CpuNonbondedForceFvec
<
fvec8
>
();
}
#else
bool
is
Vec8
Supported
()
{
bool
is
Avx
Supported
()
{
return
false
;
}
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForce
Vec8
()
{
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForce
Avx
()
{
throw
OpenMM
::
OpenMMException
(
"Internal error: OpenMM was compiled without AVX support"
);
}
#endif
platforms/cpu/src/CpuNonbondedForceAvx2.cpp
0 → 100644
View file @
5270f858
/* Portions copyright (c) 2006-2015 Stanford University and Simbios.
* Contributors: Daniel Towner
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "CpuNonbondedForceFvec.h"
#include "openmm/OpenMMException.h"
#ifdef __AVX2__
#include "openmm/internal/vectorizeAvx2.h"
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceAvx2
()
{
return
new
OpenMM
::
CpuNonbondedForceFvec
<
fvecAvx2
>
();
}
#else
bool
isAvx2Supported
()
{
return
false
;
}
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceAvx2
()
{
throw
OpenMM
::
OpenMMException
(
"Internal error: OpenMM was compiled without AVX2 support"
);
}
#endif
platforms/cpu/src/CpuNonbondedForceFvec.cpp
View file @
5270f858
...
...
@@ -25,19 +25,25 @@
#include "CpuNonbondedForceFvec.h"
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceVec4
();
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceVec8
();
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceAvx
();
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceAvx2
();
bool
isVec8Supported
();
bool
isAvxSupported
();
bool
isAvx2Supported
();
#include <iostream>
OpenMM
::
CpuNonbondedForce
*
createCpuNonbondedForceVec
()
{
if
(
isVec8Supported
())
return
createCpuNonbondedForceVec8
();
if
(
isAvx2Supported
())
return
createCpuNonbondedForceAvx2
();
else
if
(
isAvxSupported
())
return
createCpuNonbondedForceAvx
();
else
return
createCpuNonbondedForceVec4
();
}
int
getVecBlockSize
()
{
if
(
is
Vec8
Supported
())
if
(
is
Avx2Supported
()
||
isAvx
Supported
())
return
8
;
else
return
4
;
...
...
platforms/opencl/tests/TestOpenCLCheckpoints.cpp
View file @
5270f858
...
...
@@ -95,9 +95,12 @@ void testCheckpoint() {
// Create a new Context that uses multiple devices.
string
deviceIndex
=
platform
.
getPropertyValue
(
context
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
VerletIntegrator
integrator2
(
0.001
);
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
...
...
platforms/opencl/tests/TestOpenCLCustomAngleForce.cpp
View file @
5270f858
...
...
@@ -50,9 +50,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLCustomBondForce.cpp
View file @
5270f858
...
...
@@ -50,9 +50,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLCustomCompoundBondForce.cpp
View file @
5270f858
...
...
@@ -54,9 +54,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLCustomExternalForce.cpp
View file @
5270f858
...
...
@@ -53,9 +53,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLCustomNonbondedForce.cpp
View file @
5270f858
...
...
@@ -58,9 +58,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLCustomTorsionForce.cpp
View file @
5270f858
...
...
@@ -50,9 +50,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLHarmonicAngleForce.cpp
View file @
5270f858
...
...
@@ -51,9 +51,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLHarmonicBondForce.cpp
View file @
5270f858
...
...
@@ -50,9 +50,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLNonbondedForce.cpp
View file @
5270f858
...
...
@@ -62,9 +62,13 @@ void testParallelComputation(NonbondedForce::NonbondedMethod method) {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLPeriodicTorsionForce.cpp
View file @
5270f858
...
...
@@ -49,9 +49,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/opencl/tests/TestOpenCLRBTorsionForce.cpp
View file @
5270f858
...
...
@@ -49,9 +49,13 @@ void testParallelComputation() {
context1
.
setPositions
(
positions
);
State
state1
=
context1
.
getState
(
State
::
Forces
|
State
::
Energy
);
VerletIntegrator
integrator2
(
0.01
);
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
map
<
string
,
string
>
props
;
string
deviceIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLDeviceIndex
());
props
[
OpenCLPlatform
::
OpenCLDeviceIndex
()]
=
deviceIndex
+
","
+
deviceIndex
;
string
platformIndex
=
platform
.
getPropertyValue
(
context1
,
OpenCLPlatform
::
OpenCLPlatformIndex
());
props
[
OpenCLPlatform
::
OpenCLPlatformIndex
()]
=
platformIndex
;
Context
context2
(
system
,
integrator2
,
platform
,
props
);
context2
.
setPositions
(
positions
);
State
state2
=
context2
.
getState
(
State
::
Forces
|
State
::
Energy
);
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
5270f858
...
...
@@ -1015,12 +1015,23 @@ double ReferenceCalcNonbondedForceKernel::execute(ContextImpl& context, bool inc
void
ReferenceCalcNonbondedForceKernel
::
copyParametersToContext
(
ContextImpl
&
context
,
const
NonbondedForce
&
force
)
{
if
(
force
.
getNumParticles
()
!=
numParticles
)
throw
OpenMMException
(
"updateParametersInContext: The number of particles has changed"
);
// Identify which exceptions are 1-4 interactions.
set
<
int
>
exceptionsWithOffsets
;
for
(
int
i
=
0
;
i
<
force
.
getNumExceptionParameterOffsets
();
i
++
)
{
string
param
;
int
exception
;
double
charge
,
sigma
,
epsilon
;
force
.
getExceptionParameterOffset
(
i
,
param
,
exception
,
charge
,
sigma
,
epsilon
);
exceptionsWithOffsets
.
insert
(
exception
);
}
vector
<
int
>
nb14s
;
for
(
int
i
=
0
;
i
<
force
.
getNumExceptions
();
i
++
)
{
int
particle1
,
particle2
;
double
chargeProd
,
sigma
,
epsilon
;
force
.
getExceptionParameters
(
i
,
particle1
,
particle2
,
chargeProd
,
sigma
,
epsilon
);
if
(
chargeProd
!=
0.0
||
epsilon
!=
0.0
)
if
(
chargeProd
!=
0.0
||
epsilon
!=
0.0
||
exceptionsWithOffsets
.
find
(
i
)
!=
exceptionsWithOffsets
.
end
()
)
nb14s
.
push_back
(
i
);
}
if
(
nb14s
.
size
()
!=
num14
)
...
...
platforms/reference/src/SimTKReference/ReferenceCustomDynamics.cpp
View file @
5270f858
/* Portions copyright (c) 2011-20
17
Stanford University and Simbios.
/* Portions copyright (c) 2011-20
20
Stanford University and Simbios.
* Contributors: Peter Eastman
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -171,7 +171,7 @@ void ReferenceCustomDynamics::initialize(ContextImpl& context, vector<double>& m
// Record the force group flags for each step.
forceGroupFlags
.
resize
(
numSteps
,
-
1
);
forceGroupFlags
.
resize
(
numSteps
,
integrator
.
getIntegrationForceGroups
()
);
for
(
int
i
=
0
;
i
<
numSteps
;
i
++
)
if
(
forceGroup
[
i
]
>
-
1
)
forceGroupFlags
[
i
]
=
1
<<
forceGroup
[
i
];
...
...
platforms/reference/src/SimTKReference/ReferenceNoseHooverDynamics.cpp
View file @
5270f858
...
...
@@ -26,6 +26,7 @@
#include <iostream>
#include <sstream>
#include "openmm/Integrator.h"
#include "openmm/OpenMMException.h"
#include "SimTKOpenMMUtilities.h"
#include "openmm/internal/ContextImpl.h"
...
...
@@ -55,7 +56,7 @@ void ReferenceNoseHooverDynamics::step1(OpenMM::ContextImpl &context, const Open
double
maxPairDistance
)
{
// first-time-through initialization
if
(
!
forcesAreValid
)
context
.
calcForcesAndEnergy
(
true
,
false
);
if
(
!
forcesAreValid
)
context
.
calcForcesAndEnergy
(
true
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
if
(
getTimeStep
()
==
0
)
{
// invert masses
...
...
Prev
1
2
3
4
5
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