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
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
304 additions
and
36 deletions
+304
-36
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+3
-3
plugins/drude/platforms/common/src/CommonDrudeKernels.cpp
plugins/drude/platforms/common/src/CommonDrudeKernels.cpp
+4
-4
plugins/drude/platforms/opencl/tests/CMakeLists.txt
plugins/drude/platforms/opencl/tests/CMakeLists.txt
+3
-3
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
...s/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
+2
-2
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
+2
-1
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
+2
-1
plugins/rpmd/platforms/opencl/tests/CMakeLists.txt
plugins/rpmd/platforms/opencl/tests/CMakeLists.txt
+3
-3
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
...ins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
+2
-1
tests/CMakeLists.txt
tests/CMakeLists.txt
+5
-2
tests/TestBrownianIntegrator.h
tests/TestBrownianIntegrator.h
+28
-1
tests/TestCustomIntegrator.h
tests/TestCustomIntegrator.h
+9
-4
tests/TestLangevinIntegrator.h
tests/TestLangevinIntegrator.h
+28
-1
tests/TestLangevinMiddleIntegrator.h
tests/TestLangevinMiddleIntegrator.h
+28
-1
tests/TestLocalEnergyMinimizer.h
tests/TestLocalEnergyMinimizer.h
+30
-1
tests/TestNoseHooverIntegrator.h
tests/TestNoseHooverIntegrator.h
+27
-1
tests/TestVariableLangevinIntegrator.h
tests/TestVariableLangevinIntegrator.h
+28
-1
tests/TestVariableVerletIntegrator.h
tests/TestVariableVerletIntegrator.h
+28
-1
tests/TestVectorizeAvx.cpp
tests/TestVectorizeAvx.cpp
+1
-1
tests/TestVectorizeAvx2.cpp
tests/TestVectorizeAvx2.cpp
+69
-0
tests/TestVectorizeGeneric.h
tests/TestVectorizeGeneric.h
+2
-4
No files found.
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-20
18
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman, Mark Friedrichs *
* Authors: Peter Eastman, Mark Friedrichs *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -1782,7 +1782,7 @@ void CudaCalcAmoebaMultipoleForceKernel::ensureMultipolesValid(ContextImpl& cont
...
@@ -1782,7 +1782,7 @@ void CudaCalcAmoebaMultipoleForceKernel::ensureMultipolesValid(ContextImpl& cont
}
}
}
}
if
(
!
multipolesAreValid
)
if
(
!
multipolesAreValid
)
context
.
calcForcesAndEnergy
(
false
,
false
,
-
1
);
context
.
calcForcesAndEnergy
(
false
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
}
}
...
@@ -3650,7 +3650,7 @@ void CudaCalcHippoNonbondedForceKernel::ensureMultipolesValid(ContextImpl& conte
...
@@ -3650,7 +3650,7 @@ void CudaCalcHippoNonbondedForceKernel::ensureMultipolesValid(ContextImpl& conte
}
}
}
}
if
(
!
multipolesAreValid
)
if
(
!
multipolesAreValid
)
context
.
calcForcesAndEnergy
(
false
,
false
,
-
1
);
context
.
calcForcesAndEnergy
(
false
,
false
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
}
}
void
CudaCalcHippoNonbondedForceKernel
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
void
CudaCalcHippoNonbondedForceKernel
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
...
...
plugins/drude/platforms/common/src/CommonDrudeKernels.cpp
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2013-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2013-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -282,7 +282,7 @@ void CommonIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, const
...
@@ -282,7 +282,7 @@ void CommonIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, const
if
(
cc
.
getUseMixedPrecision
())
if
(
cc
.
getUseMixedPrecision
())
kernel2
->
addArg
(
cc
.
getPosqCorrection
());
kernel2
->
addArg
(
cc
.
getPosqCorrection
());
else
else
kernel2
->
addArg
(
NULL
);
kernel2
->
addArg
(
nullptr
);
kernel2
->
addArg
(
integration
.
getPosDelta
());
kernel2
->
addArg
(
integration
.
getPosDelta
());
kernel2
->
addArg
(
cc
.
getVelm
());
kernel2
->
addArg
(
cc
.
getVelm
());
kernel2
->
addArg
(
integration
.
getStepSize
());
kernel2
->
addArg
(
integration
.
getStepSize
());
...
@@ -290,7 +290,7 @@ void CommonIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, const
...
@@ -290,7 +290,7 @@ void CommonIntegrateDrudeLangevinStepKernel::execute(ContextImpl& context, const
if
(
cc
.
getUseMixedPrecision
())
if
(
cc
.
getUseMixedPrecision
())
hardwallKernel
->
addArg
(
cc
.
getPosqCorrection
());
hardwallKernel
->
addArg
(
cc
.
getPosqCorrection
());
else
else
hardwallKernel
->
addArg
(
NULL
);
hardwallKernel
->
addArg
(
nullptr
);
hardwallKernel
->
addArg
(
cc
.
getVelm
());
hardwallKernel
->
addArg
(
cc
.
getVelm
());
hardwallKernel
->
addArg
(
pairParticles
);
hardwallKernel
->
addArg
(
pairParticles
);
hardwallKernel
->
addArg
(
integration
.
getStepSize
());
hardwallKernel
->
addArg
(
integration
.
getStepSize
());
...
@@ -516,7 +516,7 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
...
@@ -516,7 +516,7 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
// Compute the forces and energy for this configuration.
// Compute the forces and energy for this configuration.
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
long
long
*
force
=
(
long
long
*
)
cc
.
getPinnedBuffer
();
long
long
*
force
=
(
long
long
*
)
cc
.
getPinnedBuffer
();
cc
.
getLongForceBuffer
().
download
(
force
);
cc
.
getLongForceBuffer
().
download
(
force
);
double
forceScale
=
-
1.0
/
0x100000000
;
double
forceScale
=
-
1.0
/
0x100000000
;
...
...
plugins/drude/platforms/opencl/tests/CMakeLists.txt
View file @
5270f858
...
@@ -17,10 +17,10 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -17,10 +17,10 @@ FOREACH(TEST_PROG ${TEST_PROGS})
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_DRUDE_TARGET
}
${
SHARED_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_DRUDE_TARGET
}
${
SHARED_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
"
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
"
)
ADD_TEST
(
${
TEST_ROOT
}
Single
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
single
)
ADD_TEST
(
${
TEST_ROOT
}
Single
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
single
${
OPENCL_TEST_PLATFORM_INDEX
}
${
OPENCL_TEST_DEVICE_INDEX
}
)
IF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
IF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ADD_TEST
(
${
TEST_ROOT
}
Mixed
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
mixed
)
ADD_TEST
(
${
TEST_ROOT
}
Mixed
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
mixed
${
OPENCL_TEST_PLATFORM_INDEX
}
${
OPENCL_TEST_DEVICE_INDEX
}
)
ADD_TEST
(
${
TEST_ROOT
}
Double
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
double
)
ADD_TEST
(
${
TEST_ROOT
}
Double
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
double
${
OPENCL_TEST_PLATFORM_INDEX
}
${
OPENCL_TEST_DEVICE_INDEX
}
)
ENDIF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ENDIF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
plugins/drude/platforms/reference/src/ReferenceDrudeKernels.cpp
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2011-20
14
Stanford University and the Authors. *
* Portions copyright (c) 2011-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -497,7 +497,7 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
...
@@ -497,7 +497,7 @@ static lbfgsfloatval_t evaluate(void *instance, const lbfgsfloatval_t *x, lbfgsf
vector
<
Vec3
>&
force
=
extractForces
(
context
);
vector
<
Vec3
>&
force
=
extractForces
(
context
);
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
pos
[
drudeParticles
[
i
]]
=
Vec3
(
x
[
3
*
i
],
x
[
3
*
i
+
1
],
x
[
3
*
i
+
2
]);
pos
[
drudeParticles
[
i
]]
=
Vec3
(
x
[
3
*
i
],
x
[
3
*
i
+
1
],
x
[
3
*
i
+
2
]);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
);
double
energy
=
context
.
calcForcesAndEnergy
(
true
,
true
,
context
.
getIntegrator
().
getIntegrationForceGroups
()
);
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numDrudeParticles
;
i
++
)
{
Vec3
f
=
force
[
drudeParticles
[
i
]];
Vec3
f
=
force
[
drudeParticles
[
i
]];
g
[
3
*
i
]
=
-
f
[
0
];
g
[
3
*
i
]
=
-
f
[
0
];
...
...
plugins/rpmd/platforms/cuda/src/CudaRpmdKernels.cpp
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2011-20
18
Stanford University and the Authors. *
* Portions copyright (c) 2011-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -123,6 +123,7 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
...
@@ -123,6 +123,7 @@ void CudaIntegrateRPMDStepKernel::initialize(const System& system, const RPMDInt
groupsNotContracted
-=
1
<<
group
;
groupsNotContracted
-=
1
<<
group
;
}
}
}
}
groupsNotContracted
&=
integrator
.
getIntegrationForceGroups
();
if
(
maxContractedCopies
>
0
)
{
if
(
maxContractedCopies
>
0
)
{
contractedForces
.
initialize
<
long
long
>
(
cu
,
maxContractedCopies
*
paddedParticles
*
3
,
"rpmdContractedForces"
);
contractedForces
.
initialize
<
long
long
>
(
cu
,
maxContractedCopies
*
paddedParticles
*
3
,
"rpmdContractedForces"
);
contractedPositions
.
initialize
(
cu
,
maxContractedCopies
*
paddedParticles
,
elementSize
,
"rpmdContractedPositions"
);
contractedPositions
.
initialize
(
cu
,
maxContractedCopies
*
paddedParticles
,
elementSize
,
"rpmdContractedPositions"
);
...
...
plugins/rpmd/platforms/opencl/src/OpenCLRpmdKernels.cpp
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2011-20
18
Stanford University and the Authors. *
* Portions copyright (c) 2011-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -103,6 +103,7 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
...
@@ -103,6 +103,7 @@ void OpenCLIntegrateRPMDStepKernel::initialize(const System& system, const RPMDI
groupsNotContracted
-=
1
<<
group
;
groupsNotContracted
-=
1
<<
group
;
}
}
}
}
groupsNotContracted
&=
integrator
.
getIntegrationForceGroups
();
if
(
maxContractedCopies
>
0
)
{
if
(
maxContractedCopies
>
0
)
{
contractedForces
.
initialize
(
cl
,
maxContractedCopies
*
paddedParticles
,
forceElementSize
,
"rpmdContractedForces"
);
contractedForces
.
initialize
(
cl
,
maxContractedCopies
*
paddedParticles
,
forceElementSize
,
"rpmdContractedForces"
);
contractedPositions
.
initialize
(
cl
,
maxContractedCopies
*
paddedParticles
,
elementSize
,
"rpmdContractedPositions"
);
contractedPositions
.
initialize
(
cl
,
maxContractedCopies
*
paddedParticles
,
elementSize
,
"rpmdContractedPositions"
);
...
...
plugins/rpmd/platforms/opencl/tests/CMakeLists.txt
View file @
5270f858
...
@@ -15,10 +15,10 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -15,10 +15,10 @@ FOREACH(TEST_PROG ${TEST_PROGS})
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_RPMD_TARGET
}
${
SHARED_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_RPMD_TARGET
}
${
SHARED_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
"
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
"
)
ADD_TEST
(
${
TEST_ROOT
}
Single
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
single
)
ADD_TEST
(
${
TEST_ROOT
}
Single
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
single
${
OPENCL_TEST_PLATFORM_INDEX
}
${
OPENCL_TEST_DEVICE_INDEX
}
)
IF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
IF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ADD_TEST
(
${
TEST_ROOT
}
Mixed
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
mixed
)
ADD_TEST
(
${
TEST_ROOT
}
Mixed
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
mixed
${
OPENCL_TEST_PLATFORM_INDEX
}
${
OPENCL_TEST_DEVICE_INDEX
}
)
ADD_TEST
(
${
TEST_ROOT
}
Double
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
double
)
ADD_TEST
(
${
TEST_ROOT
}
Double
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
double
${
OPENCL_TEST_PLATFORM_INDEX
}
${
OPENCL_TEST_DEVICE_INDEX
}
)
ENDIF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ENDIF
(
OPENMM_BUILD_OPENCL_DOUBLE_PRECISION_TESTS
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
plugins/rpmd/platforms/reference/src/ReferenceRpmdKernels.cpp
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2011-20
13
Stanford University and the Authors. *
* Portions copyright (c) 2011-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -99,6 +99,7 @@ void ReferenceIntegrateRPMDStepKernel::initialize(const System& system, const RP
...
@@ -99,6 +99,7 @@ void ReferenceIntegrateRPMDStepKernel::initialize(const System& system, const RP
groupsNotContracted
-=
1
<<
group
;
groupsNotContracted
-=
1
<<
group
;
}
}
}
}
groupsNotContracted
&=
integrator
.
getIntegrationForceGroups
();
// Create workspace for doing contractions.
// Create workspace for doing contractions.
...
...
tests/CMakeLists.txt
View file @
5270f858
...
@@ -8,7 +8,7 @@ ENABLE_TESTING()
...
@@ -8,7 +8,7 @@ ENABLE_TESTING()
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
FOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
FOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
GET_FILENAME_COMPONENT
(
TEST_ROOT
${
TEST_PROG
}
NAME_WE
)
GET_FILENAME_COMPONENT
(
TEST_ROOT
${
TEST_PROG
}
NAME_WE
)
IF
((
${
TEST_ROOT
}
MATCHES TestVectorize
8
)
AND NOT X86
)
IF
((
${
TEST_ROOT
}
MATCHES TestVectorize
Avx*
)
AND NOT X86
)
CONTINUE
()
CONTINUE
()
ENDIF
()
ENDIF
()
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
...
@@ -21,9 +21,12 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -21,9 +21,12 @@ FOREACH(TEST_PROG ${TEST_PROGS})
IF
((
${
TEST_ROOT
}
MATCHES TestVectorize
)
AND X86 AND NOT MSVC
)
IF
((
${
TEST_ROOT
}
MATCHES TestVectorize
)
AND X86 AND NOT MSVC
)
SET
(
EXTRA_TEST_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-msse4.1"
)
SET
(
EXTRA_TEST_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-msse4.1"
)
ENDIF
()
ENDIF
()
IF
((
${
TEST_ROOT
}
MATCHES TestVectorize
8
)
AND X86 AND NOT MSVC
)
IF
((
${
TEST_ROOT
}
MATCHES TestVectorize
Avx
)
AND X86 AND NOT MSVC
)
SET
(
EXTRA_TEST_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-mavx"
)
SET
(
EXTRA_TEST_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-mavx"
)
ENDIF
()
ENDIF
()
IF
((
${
TEST_ROOT
}
MATCHES TestVectorizeAvx2
)
AND X86 AND NOT MSVC
)
SET
(
EXTRA_TEST_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-mfma -mavx2"
)
ENDIF
()
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_TEST_FLAGS
}
"
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_LINK_FLAGS
}
"
COMPILE_FLAGS
"
${
EXTRA_TEST_FLAGS
}
"
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
...
...
tests/TestBrownianIntegrator.h
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-20
15
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/Context.h"
#include "openmm/Context.h"
#include "openmm/CustomExternalForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/System.h"
#include "openmm/System.h"
...
@@ -279,6 +280,31 @@ void testInitialTemperature() {
...
@@ -279,6 +280,31 @@ void testInitialTemperature() {
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
}
}
void
testForceGroups
()
{
System
system
;
system
.
addParticle
(
1.0
);
BrownianIntegrator
integrator
(
0
,
1.0
,
0.001
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
CustomExternalForce
*
f1
=
new
CustomExternalForce
(
"x"
);
f1
->
addParticle
(
0
);
f1
->
setForceGroup
(
1
);
CustomExternalForce
*
f2
=
new
CustomExternalForce
(
"y"
);
f2
->
addParticle
(
0
);
f2
->
setForceGroup
(
2
);
system
.
addForce
(
f1
);
system
.
addForce
(
f2
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
vector
<
Vec3
>
(
1
));
// Take one step and verify that the position was updated based only on f1.
integrator
.
step
(
1
);
Vec3
pos
=
context
.
getState
(
State
::
Positions
).
getPositions
()[
0
];
ASSERT
(
pos
[
0
]
<
0
);
ASSERT
(
pos
[
1
]
==
0
);
ASSERT
(
pos
[
2
]
==
0
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -290,6 +316,7 @@ int main(int argc, char* argv[]) {
...
@@ -290,6 +316,7 @@ int main(int argc, char* argv[]) {
testConstrainedMasslessParticles
();
testConstrainedMasslessParticles
();
testRandomSeed
();
testRandomSeed
();
testInitialTemperature
();
testInitialTemperature
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestCustomIntegrator.h
View file @
5270f858
...
@@ -597,6 +597,7 @@ void testForceGroups() {
...
@@ -597,6 +597,7 @@ void testForceGroups() {
integrator
.
addComputeGlobal
(
"oute"
,
"energy"
);
integrator
.
addComputeGlobal
(
"oute"
,
"energy"
);
integrator
.
addComputeGlobal
(
"oute1"
,
"energy1"
);
integrator
.
addComputeGlobal
(
"oute1"
,
"energy1"
);
integrator
.
addComputeGlobal
(
"oute2"
,
"energy2"
);
integrator
.
addComputeGlobal
(
"oute2"
,
"energy2"
);
integrator
.
setIntegrationForceGroups
((
1
<<
1
)
+
(
1
<<
2
));
HarmonicBondForce
*
bonds
=
new
HarmonicBondForce
();
HarmonicBondForce
*
bonds
=
new
HarmonicBondForce
();
bonds
->
addBond
(
0
,
1
,
1.5
,
1.1
);
bonds
->
addBond
(
0
,
1
,
1.5
,
1.1
);
bonds
->
setForceGroup
(
1
);
bonds
->
setForceGroup
(
1
);
...
@@ -606,6 +607,10 @@ void testForceGroups() {
...
@@ -606,6 +607,10 @@ void testForceGroups() {
nb
->
addParticle
(
0.2
,
1
,
0
);
nb
->
addParticle
(
0.2
,
1
,
0
);
nb
->
setForceGroup
(
2
);
nb
->
setForceGroup
(
2
);
system
.
addForce
(
nb
);
system
.
addForce
(
nb
);
CustomExternalForce
*
external
=
new
CustomExternalForce
(
"x"
);
external
->
addParticle
(
0
);
external
->
setForceGroup
(
3
);
system
.
addForce
(
external
);
Context
context
(
system
,
integrator
,
platform
);
Context
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
2
);
vector
<
Vec3
>
positions
(
2
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
positions
[
0
]
=
Vec3
(
-
1
,
0
,
0
);
...
@@ -633,13 +638,13 @@ void testForceGroups() {
...
@@ -633,13 +638,13 @@ void testForceGroups() {
// Make sure they also match the values returned by the Context.
// Make sure they also match the values returned by the Context.
State
s
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
);
State
s
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
,
6
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
,
2
);
State
s1
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
,
2
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
,
4
);
State
s2
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
,
false
,
4
);
vector
<
Vec3
>
c
,
c1
,
c2
;
vector
<
Vec3
>
c
,
c1
,
c2
;
c
=
context
.
getState
(
State
::
Forces
,
false
)
.
getForces
();
c
=
s
.
getForces
();
c1
=
context
.
getState
(
State
::
Forces
,
false
,
2
)
.
getForces
();
c1
=
s1
.
getForces
();
c2
=
context
.
getState
(
State
::
Forces
,
false
,
4
)
.
getForces
();
c2
=
s2
.
getForces
();
ASSERT_EQUAL_VEC
(
f
[
0
],
c
[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
f
[
0
],
c
[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
f
[
1
],
c
[
1
],
1e-5
);
ASSERT_EQUAL_VEC
(
f
[
1
],
c
[
1
],
1e-5
);
ASSERT_EQUAL_VEC
(
f1
[
0
],
c1
[
0
],
1e-5
);
ASSERT_EQUAL_VEC
(
f1
[
0
],
c1
[
0
],
1e-5
);
...
...
tests/TestLangevinIntegrator.h
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/Context.h"
#include "openmm/Context.h"
#include "openmm/CustomExternalForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/System.h"
#include "openmm/System.h"
...
@@ -286,6 +287,31 @@ void testInitialTemperature() {
...
@@ -286,6 +287,31 @@ void testInitialTemperature() {
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
}
}
void
testForceGroups
()
{
System
system
;
system
.
addParticle
(
1.0
);
LangevinIntegrator
integrator
(
0.0
,
1.0
,
0.01
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
CustomExternalForce
*
f1
=
new
CustomExternalForce
(
"x"
);
f1
->
addParticle
(
0
);
f1
->
setForceGroup
(
1
);
CustomExternalForce
*
f2
=
new
CustomExternalForce
(
"y"
);
f2
->
addParticle
(
0
);
f2
->
setForceGroup
(
2
);
system
.
addForce
(
f1
);
system
.
addForce
(
f2
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
vector
<
Vec3
>
(
1
));
// Take one step and verify that the position was updated based only on f1.
integrator
.
step
(
1
);
Vec3
pos
=
context
.
getState
(
State
::
Positions
).
getPositions
()[
0
];
ASSERT
(
pos
[
0
]
<
0
);
ASSERT
(
pos
[
1
]
==
0
);
ASSERT
(
pos
[
2
]
==
0
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -297,6 +323,7 @@ int main(int argc, char* argv[]) {
...
@@ -297,6 +323,7 @@ int main(int argc, char* argv[]) {
testConstrainedMasslessParticles
();
testConstrainedMasslessParticles
();
testRandomSeed
();
testRandomSeed
();
testInitialTemperature
();
testInitialTemperature
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestLangevinMiddleIntegrator.h
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-20
19
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/Context.h"
#include "openmm/Context.h"
#include "openmm/CustomExternalForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/System.h"
#include "openmm/System.h"
...
@@ -289,6 +290,31 @@ void testInitialTemperature() {
...
@@ -289,6 +290,31 @@ void testInitialTemperature() {
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
}
}
void
testForceGroups
()
{
System
system
;
system
.
addParticle
(
1.0
);
LangevinMiddleIntegrator
integrator
(
0.0
,
1.0
,
0.01
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
CustomExternalForce
*
f1
=
new
CustomExternalForce
(
"x"
);
f1
->
addParticle
(
0
);
f1
->
setForceGroup
(
1
);
CustomExternalForce
*
f2
=
new
CustomExternalForce
(
"y"
);
f2
->
addParticle
(
0
);
f2
->
setForceGroup
(
2
);
system
.
addForce
(
f1
);
system
.
addForce
(
f2
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
vector
<
Vec3
>
(
1
));
// Take one step and verify that the position was updated based only on f1.
integrator
.
step
(
1
);
Vec3
pos
=
context
.
getState
(
State
::
Positions
).
getPositions
()[
0
];
ASSERT
(
pos
[
0
]
<
0
);
ASSERT
(
pos
[
1
]
==
0
);
ASSERT
(
pos
[
2
]
==
0
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -300,6 +326,7 @@ int main(int argc, char* argv[]) {
...
@@ -300,6 +326,7 @@ int main(int argc, char* argv[]) {
testConstrainedMasslessParticles
();
testConstrainedMasslessParticles
();
testRandomSeed
();
testRandomSeed
();
testInitialTemperature
();
testInitialTemperature
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestLocalEnergyMinimizer.h
View file @
5270f858
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2010-20
18
Stanford University and the Authors. *
* Portions copyright (c) 2010-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -231,6 +231,34 @@ void testLargeForces() {
...
@@ -231,6 +231,34 @@ void testLargeForces() {
ASSERT
(
maxdist
<
10.0
);
ASSERT
(
maxdist
<
10.0
);
}
}
void
testForceGroups
()
{
// Create a system with two forces, only one of which is in the standard
// integration force groups.
System
system
;
system
.
addParticle
(
1.0
);
system
.
addParticle
(
1.0
);
HarmonicBondForce
*
bonds1
=
new
HarmonicBondForce
();
HarmonicBondForce
*
bonds2
=
new
HarmonicBondForce
();
system
.
addForce
(
bonds1
);
system
.
addForce
(
bonds2
);
bonds1
->
addBond
(
0
,
1
,
2.0
,
1
);
bonds2
->
addBond
(
0
,
1
,
4.0
,
1
);
bonds1
->
setForceGroup
(
1
);
bonds2
->
setForceGroup
(
2
);
// Minimize it and check that the bond has the correct length.
VerletIntegrator
integrator
(
0.01
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
({
Vec3
(
0
,
0
,
0
),
Vec3
(
5
,
0
,
0
)});
LocalEnergyMinimizer
::
minimize
(
context
,
1e-5
);
State
state
=
context
.
getState
(
State
::
Positions
);
Vec3
delta
=
state
.
getPositions
()[
0
]
-
state
.
getPositions
()[
1
];
ASSERT_EQUAL_TOL
(
2.0
,
sqrt
(
delta
.
dot
(
delta
)),
1e-4
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -240,6 +268,7 @@ int main(int argc, char* argv[]) {
...
@@ -240,6 +268,7 @@ int main(int argc, char* argv[]) {
testLargeSystem
();
testLargeSystem
();
testVirtualSites
();
testVirtualSites
();
testLargeForces
();
testLargeForces
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestNoseHooverIntegrator.h
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2019 Stanford University and the Authors.
*
* Portions copyright (c) 2019
-2020
Stanford University and the Authors. *
* Authors: Andreas Krämer and Andrew C. Simmonett *
* Authors: Andreas Krämer and Andrew C. Simmonett *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -510,6 +510,31 @@ void testAPIChangeNumParticles() {
...
@@ -510,6 +510,31 @@ void testAPIChangeNumParticles() {
}
}
void
testForceGroups
()
{
System
system
;
system
.
addParticle
(
1.0
);
NoseHooverIntegrator
integrator
(
1
,
1.0
,
0.001
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
CustomExternalForce
*
f1
=
new
CustomExternalForce
(
"x"
);
f1
->
addParticle
(
0
);
f1
->
setForceGroup
(
1
);
CustomExternalForce
*
f2
=
new
CustomExternalForce
(
"y"
);
f2
->
addParticle
(
0
);
f2
->
setForceGroup
(
2
);
system
.
addForce
(
f1
);
system
.
addForce
(
f2
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
vector
<
Vec3
>
(
1
));
// Take one step and verify that the position was updated based only on f1.
integrator
.
step
(
1
);
Vec3
pos
=
context
.
getState
(
State
::
Positions
).
getPositions
()[
0
];
ASSERT
(
pos
[
0
]
<
0
);
ASSERT
(
pos
[
1
]
==
0
);
ASSERT
(
pos
[
2
]
==
0
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -528,6 +553,7 @@ int main(int argc, char* argv[]) {
...
@@ -528,6 +553,7 @@ int main(int argc, char* argv[]) {
constrain
=
false
;
testDimerBox
(
constrain
);
constrain
=
false
;
testDimerBox
(
constrain
);
constrain
=
true
;
testDimerBox
(
constrain
);
constrain
=
true
;
testDimerBox
(
constrain
);
testCheckpoints
();
testCheckpoints
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestVariableLangevinIntegrator.h
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/Context.h"
#include "openmm/Context.h"
#include "openmm/CustomExternalForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/System.h"
#include "openmm/System.h"
...
@@ -358,6 +359,31 @@ void testInitialTemperature() {
...
@@ -358,6 +359,31 @@ void testInitialTemperature() {
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
}
}
void
testForceGroups
()
{
System
system
;
system
.
addParticle
(
1.0
);
VariableLangevinIntegrator
integrator
(
0.0
,
1.0
,
1e-5
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
CustomExternalForce
*
f1
=
new
CustomExternalForce
(
"x"
);
f1
->
addParticle
(
0
);
f1
->
setForceGroup
(
1
);
CustomExternalForce
*
f2
=
new
CustomExternalForce
(
"y"
);
f2
->
addParticle
(
0
);
f2
->
setForceGroup
(
2
);
system
.
addForce
(
f1
);
system
.
addForce
(
f2
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
vector
<
Vec3
>
(
1
));
// Take one step and verify that the position was updated based only on f1.
integrator
.
step
(
1
);
Vec3
pos
=
context
.
getState
(
State
::
Positions
).
getPositions
()[
0
];
ASSERT
(
pos
[
0
]
<
0
);
ASSERT
(
pos
[
1
]
==
0
);
ASSERT
(
pos
[
2
]
==
0
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -370,6 +396,7 @@ int main(int argc, char* argv[]) {
...
@@ -370,6 +396,7 @@ int main(int argc, char* argv[]) {
testRandomSeed
();
testRandomSeed
();
testArgonBox
();
testArgonBox
();
testInitialTemperature
();
testInitialTemperature
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestVariableVerletIntegrator.h
View file @
5270f858
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-20
15
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
20
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/Context.h"
#include "openmm/Context.h"
#include "openmm/CustomExternalForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/HarmonicBondForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/NonbondedForce.h"
#include "openmm/System.h"
#include "openmm/System.h"
...
@@ -337,6 +338,31 @@ void testInitialTemperature() {
...
@@ -337,6 +338,31 @@ void testInitialTemperature() {
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
ASSERT_USUALLY_EQUAL_TOL
(
targetTemperature
,
temperature
,
0.01
);
}
}
void
testForceGroups
()
{
System
system
;
system
.
addParticle
(
1.0
);
VariableVerletIntegrator
integrator
(
0.001
);
integrator
.
setIntegrationForceGroups
(
1
<<
1
);
CustomExternalForce
*
f1
=
new
CustomExternalForce
(
"x"
);
f1
->
addParticle
(
0
);
f1
->
setForceGroup
(
1
);
CustomExternalForce
*
f2
=
new
CustomExternalForce
(
"y"
);
f2
->
addParticle
(
0
);
f2
->
setForceGroup
(
2
);
system
.
addForce
(
f1
);
system
.
addForce
(
f2
);
Context
context
(
system
,
integrator
,
platform
);
context
.
setPositions
(
vector
<
Vec3
>
(
1
));
// Take one step and verify that the position was updated based only on f1.
integrator
.
step
(
1
);
Vec3
pos
=
context
.
getState
(
State
::
Positions
).
getPositions
()[
0
];
ASSERT
(
pos
[
0
]
<
0
);
ASSERT
(
pos
[
1
]
==
0
);
ASSERT
(
pos
[
2
]
==
0
);
}
void
runPlatformTests
();
void
runPlatformTests
();
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
@@ -348,6 +374,7 @@ int main(int argc, char* argv[]) {
...
@@ -348,6 +374,7 @@ int main(int argc, char* argv[]) {
testConstrainedMasslessParticles
();
testConstrainedMasslessParticles
();
testArgonBox
();
testArgonBox
();
testInitialTemperature
();
testInitialTemperature
();
testForceGroups
();
runPlatformTests
();
runPlatformTests
();
}
}
catch
(
const
exception
&
e
)
{
catch
(
const
exception
&
e
)
{
...
...
tests/TestVectorize
8
.cpp
→
tests/TestVectorize
Avx
.cpp
View file @
5270f858
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
*/
*/
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/internal/vectorize
8
.h"
#include "openmm/internal/vectorize
Avx
.h"
#include <iostream>
#include <iostream>
#include "TestVectorizeGeneric.h"
#include "TestVectorizeGeneric.h"
...
...
tests/TestVectorizeAvx2.cpp
0 → 100644
View file @
5270f858
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2014-2015 Stanford University and the Authors. *
* Authors: Daniel Towner *
* Contributors: *
* *
* 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. *
* -------------------------------------------------------------------------- */
/**
* This tests vectorized operations.
*/
#include "openmm/internal/AssertionUtilities.h"
#include <iostream>
#ifndef __AVX2__
int
main
()
{
std
::
cout
<<
"AVX2 CPU is not supported. Exiting."
<<
std
::
endl
;
return
0
;
}
#else
#include "openmm/internal/vectorizeAvx2.h"
#include "TestVectorizeGeneric.h"
using
namespace
OpenMM
;
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
if
(
!
isAvx2Supported
())
{
std
::
cout
<<
"CPU is not supported. Exiting."
<<
std
::
endl
;
return
0
;
}
TestFvec
<
fvecAvx2
>::
testAll
();
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
return
1
;
}
std
::
cout
<<
"Done"
<<
std
::
endl
;
return
0
;
}
#endif
\ No newline at end of file
tests/TestVectorizeGeneric.h
View file @
5270f858
...
@@ -338,12 +338,10 @@ void TestFvec<FVEC>::testBinaryOps() const {
...
@@ -338,12 +338,10 @@ void TestFvec<FVEC>::testBinaryOps() const {
ASSERT_VEC_ALMOST_EQUAL
(
f
/
v0
,
applyBinaryFn
(
fdup
,
v0
,
std
::
divides
<
float
>
()));
ASSERT_VEC_ALMOST_EQUAL
(
f
/
v0
,
applyBinaryFn
(
fdup
,
v0
,
std
::
divides
<
float
>
()));
// Binary functions.
// Binary functions.
using
std
::
min
;
using
std
::
max
;
ASSERT_VEC_EQUAL
(
min
(
v0
,
v1
),
ASSERT_VEC_EQUAL
(
min
(
v0
,
v1
),
applyBinaryFn
(
v0
,
v1
,
[](
float
x
,
float
y
)
{
return
min
(
x
,
y
);
}));
applyBinaryFn
(
v0
,
v1
,
[](
float
x
,
float
y
)
{
return
std
::
min
<
float
>
(
x
,
y
);
}));
ASSERT_VEC_EQUAL
(
max
(
v0
,
v1
),
ASSERT_VEC_EQUAL
(
max
(
v0
,
v1
),
applyBinaryFn
(
v0
,
v1
,
[](
float
x
,
float
y
)
{
return
max
(
x
,
y
);
}));
applyBinaryFn
(
v0
,
v1
,
[](
float
x
,
float
y
)
{
return
std
::
max
<
float
>
(
x
,
y
);
}));
}
}
template
<
typename
FVEC
>
template
<
typename
FVEC
>
...
...
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