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
38c2015e
Commit
38c2015e
authored
Nov 11, 2011
by
Mark Friedrichs
Browse files
Update to nonbonded and implicit solvent tests
parent
7b5344db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
143 additions
and
240 deletions
+143
-240
platforms/cuda/src/kernels/kCalculateGBVIBornSum.cu
platforms/cuda/src/kernels/kCalculateGBVIBornSum.cu
+35
-7
platforms/cuda/tests/CMakeLists.txt
platforms/cuda/tests/CMakeLists.txt
+20
-21
platforms/cuda/tests/TestCudaGBVIForce2.cpp
platforms/cuda/tests/TestCudaGBVIForce2.cpp
+88
-212
No files found.
platforms/cuda/src/kernels/kCalculateGBVIBornSum.cu
View file @
38c2015e
...
@@ -242,6 +242,10 @@ void kReduceGBVIBornSum(gpuContext gpu)
...
@@ -242,6 +242,10 @@ void kReduceGBVIBornSum(gpuContext gpu)
LAUNCHERROR
(
"kReduceGBVIBornSum"
);
LAUNCHERROR
(
"kReduceGBVIBornSum"
);
}
}
static
int
isNanOrInfinity
(
float
number
){
return
(
number
!=
number
||
number
==
std
::
numeric_limits
<
float
>::
infinity
()
||
number
==
-
std
::
numeric_limits
<
float
>::
infinity
())
?
1
:
0
;
}
void
kPrintGBVI
(
gpuContext
gpu
,
std
::
string
callId
,
int
call
,
FILE
*
log
)
void
kPrintGBVI
(
gpuContext
gpu
,
std
::
string
callId
,
int
call
,
FILE
*
log
)
{
{
...
@@ -252,6 +256,26 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
...
@@ -252,6 +256,26 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
gpu
->
psPosq4
->
Download
();
gpu
->
psPosq4
->
Download
();
gpu
->
psSigEps2
->
Download
();
gpu
->
psSigEps2
->
Download
();
int
printOnlyOnNan
=
1
;
int
foundNan
=
0
;
if
(
printOnlyOnNan
){
for
(
int
ii
=
0
;
ii
<
gpu
->
sim
.
paddedNumberOfAtoms
&&
foundNan
==
0
;
ii
++
){
foundNan
+=
isNanOrInfinity
(
gpu
->
psBornRadii
->
_pSysData
[
ii
]
);
foundNan
+=
isNanOrInfinity
(
gpu
->
psBornForce
->
_pSysData
[
ii
]
);
foundNan
+=
isNanOrInfinity
(
gpu
->
psGBVISwitchDerivative
->
_pSysData
[
ii
]
);
}
if
(
foundNan
){
log
=
stderr
;
(
void
)
fprintf
(
log
,
"kPrintGBVI found nan
\n
"
,
gpu
->
sim
.
paddedNumberOfAtoms
);
for
(
int
ii
=
0
;
ii
<
gpu
->
sim
.
paddedNumberOfAtoms
;
ii
++
){
(
void
)
fprintf
(
log
,
"%6d %15.7e %15.7e %15.7e
\n
"
,
ii
,
gpu
->
psPosq4
->
_pSysData
[
ii
].
x
,
gpu
->
psPosq4
->
_pSysData
[
ii
].
y
,
gpu
->
psPosq4
->
_pSysData
[
ii
].
z
);
}
}
}
if
(
!
printOnlyOnNan
||
foundNan
){
(
void
)
fprintf
(
log
,
"kPrintGBVI Cuda comp bR bF prm sigeps2
\n
"
);
(
void
)
fprintf
(
log
,
"kPrintGBVI Cuda comp bR bF prm sigeps2
\n
"
);
(
void
)
fprintf
(
stderr
,
"kCalculateGBVIBornSum: bOutputBufferPerWarp=%u blks=%u th/blk=%u wu=%u %u shrd=%u
\n
"
,
gpu
->
bOutputBufferPerWarp
,
(
void
)
fprintf
(
stderr
,
"kCalculateGBVIBornSum: bOutputBufferPerWarp=%u blks=%u th/blk=%u wu=%u %u shrd=%u
\n
"
,
gpu
->
bOutputBufferPerWarp
,
gpu
->
sim
.
nonbond_blocks
,
gpu
->
sim
.
nonbond_threads_per_block
,
gpu
->
sim
.
workUnits
,
gpu
->
psWorkUnit
->
_pSysStream
[
0
][
0
],
gpu
->
sim
.
nonbond_blocks
,
gpu
->
sim
.
nonbond_threads_per_block
,
gpu
->
sim
.
workUnits
,
gpu
->
psWorkUnit
->
_pSysStream
[
0
][
0
],
...
@@ -271,6 +295,10 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
...
@@ -271,6 +295,10 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
gpu
->
psSigEps2
->
_pSysData
[
ii
].
y
);
gpu
->
psSigEps2
->
_pSysData
[
ii
].
y
);
}
}
if
(
foundNan
){
exit
(
0
);
}
}
}
}
...
...
platforms/cuda/tests/CMakeLists.txt
View file @
38c2015e
...
@@ -15,7 +15,6 @@ IF( INCLUDE_SERIALIZATION )
...
@@ -15,7 +15,6 @@ IF( INCLUDE_SERIALIZATION )
SET
(
SHARED_OPENMM_SERIALIZATION OpenMMSerialization
)
SET
(
SHARED_OPENMM_SERIALIZATION OpenMMSerialization
)
ENDIF
(
INCLUDE_SERIALIZATION
)
ENDIF
(
INCLUDE_SERIALIZATION
)
# Automatically create tests using files named "Test*.cpp"
# Automatically create tests using files named "Test*.cpp"
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
FILE
(
GLOB TEST_PROGS
"*Test*.cpp"
)
# TestCudaRandom has never worked on windows, so let's stop polluting the dashboard with it.
# TestCudaRandom has never worked on windows, so let's stop polluting the dashboard with it.
...
@@ -28,9 +27,17 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -28,9 +27,17 @@ FOREACH(TEST_PROG ${TEST_PROGS})
GET_FILENAME_COMPONENT
(
TEST_ROOT
${
TEST_PROG
}
NAME_WE
)
GET_FILENAME_COMPONENT
(
TEST_ROOT
${
TEST_PROG
}
NAME_WE
)
# Link with shared library
# Link with shared library
CUDA_ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
CUDA_ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
)
# Three tests are created from the file TestCudaGBVIForce2.cpp by
# setting preprocessor definitions
# TestCudaNonbondForce2
# TestCudaGBSAOBCForce2
# TestCudaGBVIForce2
IF
(
${
TEST_ROOT
}
STREQUAL
"TestCudaGBVIForce2"
)
IF
(
${
TEST_ROOT
}
STREQUAL
"TestCudaGBVIForce2"
)
# serialize
# serialize
...
@@ -38,9 +45,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -38,9 +45,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
SET
(
DEFINE_STRING
"-DTEST_PLATFORM=0 "
)
SET
(
DEFINE_STRING
"-DTEST_PLATFORM=0 "
)
IF
(
INCLUDE_SERIALIZATION
)
IF
(
INCLUDE_SERIALIZATION
)
SET
(
DEFINE_STRING
"
${
DEFINE_STRING
}
-DOPENMM_SERIALIZE "
)
SET
(
DEFINE_STRING
"
${
DEFINE_STRING
}
-DOPENMM_SERIALIZE "
)
SET
(
TARGET_LINK_LIBRARIES_STRING
"
${
SHARED_TARGET
}
${
SHARED_OPENMM_SERIALIZATION
}
"
)
ELSE
(
INCLUDE_SERIALIZATION
)
SET
(
TARGET_LINK_LIBRARIES_STRING
"
${
SHARED_TARGET
}
"
)
ENDIF
(
INCLUDE_SERIALIZATION
)
ENDIF
(
INCLUDE_SERIALIZATION
)
# obc
# obc
...
@@ -48,12 +52,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -48,12 +52,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
SET
(
OBC_DEFINE_STRING
"
${
DEFINE_STRING
}
-DIMPLICIT_SOLVENT=1"
)
SET
(
OBC_DEFINE_STRING
"
${
DEFINE_STRING
}
-DIMPLICIT_SOLVENT=1"
)
SET
(
OBC_TEST
"TestCudaGBSAOBCForce2"
)
SET
(
OBC_TEST
"TestCudaGBSAOBCForce2"
)
CUDA_ADD_EXECUTABLE
(
${
OBC_TEST
}
${
TEST_PROG
}
)
CUDA_ADD_EXECUTABLE
(
${
OBC_TEST
}
${
TEST_PROG
}
)
IF
(
INCLUDE_SERIALIZATION
)
TARGET_LINK_LIBRARIES
(
${
OBC_TEST
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_SERIALIZATION
}
)
ELSE
(
INCLUDE_SERIALIZATION
)
TARGET_LINK_LIBRARIES
(
${
OBC_TEST
}
${
SHARED_TARGET
}
)
ENDIF
(
INCLUDE_SERIALIZATION
)
SET_TARGET_PROPERTIES
(
${
OBC_TEST
}
PROPERTIES COMPILE_FLAGS
${
OBC_DEFINE_STRING
}
)
SET_TARGET_PROPERTIES
(
${
OBC_TEST
}
PROPERTIES COMPILE_FLAGS
${
OBC_DEFINE_STRING
}
)
ADD_TEST
(
${
OBC_TEST
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
OBC_TEST
}
)
ADD_TEST
(
${
OBC_TEST
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
OBC_TEST
}
)
...
@@ -62,12 +60,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -62,12 +60,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
SET
(
NONBOND_DEFINE_STRING
"
${
DEFINE_STRING
}
-DIMPLICIT_SOLVENT=0"
)
SET
(
NONBOND_DEFINE_STRING
"
${
DEFINE_STRING
}
-DIMPLICIT_SOLVENT=0"
)
SET
(
NONBOND_TEST
"TestCudaNonbondForce2"
)
SET
(
NONBOND_TEST
"TestCudaNonbondForce2"
)
CUDA_ADD_EXECUTABLE
(
${
NONBOND_TEST
}
${
TEST_PROG
}
)
CUDA_ADD_EXECUTABLE
(
${
NONBOND_TEST
}
${
TEST_PROG
}
)
IF
(
INCLUDE_SERIALIZATION
)
TARGET_LINK_LIBRARIES
(
${
NONBOND_TEST
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_SERIALIZATION
}
)
ELSE
(
INCLUDE_SERIALIZATION
)
TARGET_LINK_LIBRARIES
(
${
NONBOND_TEST
}
${
SHARED_TARGET
}
)
ENDIF
(
INCLUDE_SERIALIZATION
)
SET_TARGET_PROPERTIES
(
${
NONBOND_TEST
}
PROPERTIES COMPILE_FLAGS
${
NONBOND_DEFINE_STRING
}
)
SET_TARGET_PROPERTIES
(
${
NONBOND_TEST
}
PROPERTIES COMPILE_FLAGS
${
NONBOND_DEFINE_STRING
}
)
ADD_TEST
(
${
NONBOND_TEST
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
NONBOND_TEST
}
)
ADD_TEST
(
${
NONBOND_TEST
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
NONBOND_TEST
}
)
...
@@ -76,6 +68,18 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -76,6 +68,18 @@ FOREACH(TEST_PROG ${TEST_PROGS})
SET
(
DEFINE_STRING
"
${
DEFINE_STRING
}
-DIMPLICIT_SOLVENT=2"
)
SET
(
DEFINE_STRING
"
${
DEFINE_STRING
}
-DIMPLICIT_SOLVENT=2"
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES COMPILE_FLAGS
${
DEFINE_STRING
}
)
SET_TARGET_PROPERTIES
(
${
TEST_ROOT
}
PROPERTIES COMPILE_FLAGS
${
DEFINE_STRING
}
)
# libs
IF
(
INCLUDE_SERIALIZATION
)
TARGET_LINK_LIBRARIES
(
${
OBC_TEST
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_SERIALIZATION
}
)
TARGET_LINK_LIBRARIES
(
${
NONBOND_TEST
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_SERIALIZATION
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_SERIALIZATION
}
)
ELSE
(
INCLUDE_SERIALIZATION
)
TARGET_LINK_LIBRARIES
(
${
OBC_TEST
}
${
SHARED_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
NONBOND_TEST
}
${
SHARED_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
)
ENDIF
(
INCLUDE_SERIALIZATION
)
ENDIF
(
${
TEST_ROOT
}
STREQUAL
"TestCudaGBVIForce2"
)
ENDIF
(
${
TEST_ROOT
}
STREQUAL
"TestCudaGBVIForce2"
)
#MESSAGE( "vcm ${TEST_ROOT} ${DEFINE_STRING}" )
#MESSAGE( "vcm ${TEST_ROOT} ${DEFINE_STRING}" )
...
@@ -94,11 +98,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
...
@@ -94,11 +98,6 @@ FOREACH(TEST_PROG ${TEST_PROGS})
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
ENDFOREACH
(
TEST_PROG
${
TEST_PROGS
}
)
SET
(
TEST_PROG TstCudaUsingParameterFile.cpp
)
SET
(
TEST_STATIC
${
TEST_ROOT
}
Static
)
SET
(
INCLUDE_CUDA_STATIC 1
)
#ENDIF(INCLUDE_CUDA_STATIC)
install
(
TARGETS TestCudaHarmonicBondForce
install
(
TARGETS TestCudaHarmonicBondForce
RUNTIME DESTINATION bin
)
RUNTIME DESTINATION bin
)
platforms/cuda/tests/TestCudaGBVIForce2.cpp
View file @
38c2015e
...
@@ -824,7 +824,7 @@ void PositionGenerator::getSortedDistances( int periodicBoundaryConditions, int
...
@@ -824,7 +824,7 @@ void PositionGenerator::getSortedDistances( int periodicBoundaryConditions, int
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
if
(
ii
==
positionIndex
)
continue
;
if
(
ii
==
positionIndex
)
continue
;
double
distance
=
periodicBoundaryConditions
?
getPeriodicDistance
(
positionIndex
,
ii
,
positions
)
:
getDistance
(
positionIndex
,
ii
,
positions
);
double
distance
=
periodicBoundaryConditions
?
getPeriodicDistance
(
positionIndex
,
ii
,
positions
)
:
getDistance
(
positionIndex
,
ii
,
positions
);
sortVector
.
push_back
(
IntDoublePair
(
ii
,
sqrt
(
distance
)
)
);
sortVector
.
push_back
(
IntDoublePair
(
ii
,
distance
)
);
}
}
std
::
sort
(
sortVector
.
begin
(),
sortVector
.
end
(),
TestIntDoublePair
);
std
::
sort
(
sortVector
.
begin
(),
sortVector
.
end
(),
TestIntDoublePair
);
...
@@ -2115,158 +2115,6 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2115,158 +2115,6 @@ static Force* copyForce( const Force& force, FILE* log ){
return
forceCopy
;
return
forceCopy
;
}
}
/**---------------------------------------------------------------------------------------
*
* Copy NonbondedSoftcoreForce
*
* @param nonbondedSoftcoreForce NonbondedSoftcoreForce to copy
*
* @return copy of nonbondedSoftcoreForce
*
--------------------------------------------------------------------------------------- */
#ifdef USE_SOFTCORE
static
NonbondedSoftcoreForce
*
copyNonbondedSoftcoreForce
(
const
NonbondedSoftcoreForce
&
nonbondedSoftcoreForce
){
NonbondedSoftcoreForce
*
copyNonbondedSoftcoreForce
=
new
NonbondedSoftcoreForce
(
nonbondedSoftcoreForce
);
/*
copyNonbondedSoftcoreForce->setNonbondedMethod( nonbondedSoftcoreForce.getNonbondedMethod() );
copyNonbondedSoftcoreForce->setCutoffDistance( nonbondedSoftcoreForce.getCutoffDistance() );
copyNonbondedSoftcoreForce->setReactionFieldDielectric( nonbondedSoftcoreForce.getReactionFieldDielectric() );
// particle parameters
for( unsigned int ii = 0; ii < nonbondedSoftcoreForce.getNumParticles(); ii++ ){
double charge;
double sigma;
double epsilon;
double softcoreLJLambda;
nonbondedSoftcoreForce.getParticleParameters(ii, charge, sigma, epsilon, softcoreLJLambda);
copyNonbondedSoftcoreForce->addParticle( charge, sigma, epsilon, softcoreLJLambda);
}
// exceptions
for( unsigned int ii = 0; ii < nonbondedSoftcoreForce.getNumExceptions(); ii++ ){
int particle1, particle2;
double chargeProd;
double sigma;
double epsilon;
double softcoreLJLambda;
nonbondedSoftcoreForce.getExceptionParameters( ii, particle1, particle2, chargeProd, sigma, epsilon, softcoreLJLambda );
copyNonbondedSoftcoreForce->addException( particle1, particle2, chargeProd, sigma, epsilon, softcoreLJLambda );
}
*/
return
copyNonbondedSoftcoreForce
;
}
static
GBVISoftcoreForce
*
copyGbviSoftcoreForce
(
const
GBVISoftcoreForce
&
gbviSoftcoreForce
){
GBVISoftcoreForce
*
copyGbviSoftcoreForce
=
new
GBVISoftcoreForce
(
gbviSoftcoreForce
);
/*
GBVISoftcoreForce* copyGbviSoftcoreForce = new GBVISoftcoreForce();
copyGbviSoftcoreForce->setNonbondedMethod( gbviSoftcoreForce.getNonbondedMethod() );
copyGbviSoftcoreForce->setCutoffDistance( gbviSoftcoreForce.getCutoffDistance() );
copyGbviSoftcoreForce->setSolventDielectric( gbviSoftcoreForce.getSolventDielectric() );
copyGbviSoftcoreForce->setSoluteDielectric( gbviSoftcoreForce.getSoluteDielectric() );
copyGbviSoftcoreForce->setBornRadiusScalingMethod( gbviSoftcoreForce.getBornRadiusScalingMethod() );
copyGbviSoftcoreForce->setQuinticLowerLimitFactor( gbviSoftcoreForce.getQuinticLowerLimitFactor() );
copyGbviSoftcoreForce->setQuinticUpperBornRadiusLimit( gbviSoftcoreForce.getQuinticUpperBornRadiusLimit() );
// particle parameters
for( unsigned int ii = 0; ii < gbviSoftcoreForce.getNumParticles(); ii++ ){
double charge;
double sigma;
double gamma;
double softcoreLJLambda;
gbviSoftcoreForce.getParticleParameters(ii, charge, sigma, gamma, softcoreLJLambda);
copyGbviSoftcoreForce->addParticle( charge, sigma, gamma, softcoreLJLambda);
}
// bonds
for( unsigned int ii = 0; ii < gbviSoftcoreForce.getNumBonds(); ii++ ){
int particle1, particle2;
double distance;
gbviSoftcoreForce.getBondParameters( ii, particle1, particle2, distance);
copyGbviSoftcoreForce->addBond( particle1, particle2, distance );
}
*/
return
copyGbviSoftcoreForce
;
}
static
GBSAOBCSoftcoreForce
*
copyGBSAOBCSoftcoreForce
(
const
GBSAOBCSoftcoreForce
&
gbviSoftcoreForce
){
return
new
GBSAOBCSoftcoreForce
(
gbviSoftcoreForce
);
}
#endif
/**---------------------------------------------------------------------------------------
*
* Copy NonbondedForce
*
* @param nonbondedForce NonbondedForce to copy
*
* @return copy of nonbondedForce
*
--------------------------------------------------------------------------------------- */
static
NonbondedForce
*
copyNonbondedForce
(
const
NonbondedForce
&
nonbondedForce
){
NonbondedForce
*
copyNonbondedForce
=
new
NonbondedForce
(
nonbondedForce
);
/*
copyNonbondedForce->setNonbondedMethod( nonbondedForce.getNonbondedMethod() );
copyNonbondedForce->setCutoffDistance( nonbondedForce.getCutoffDistance() );
copyNonbondedForce->setReactionFieldDielectric( nonbondedForce.getReactionFieldDielectric() );
// particle parameters
for( unsigned int ii = 0; ii < nonbondedForce.getNumParticles(); ii++ ){
double charge;
double sigma;
double epsilon;
double softcoreLJLambda;
nonbondedForce.getParticleParameters(ii, charge, sigma, epsilon, softcoreLJLambda);
copyNonbondedForce->addParticle( charge, sigma, epsilon, softcoreLJLambda);
}
// exceptions
for( unsigned int ii = 0; ii < nonbondedForce.getNumExceptions(); ii++ ){
int particle1, particle2;
double chargeProd;
double sigma;
double epsilon;
double softcoreLJLambda;
nonbondedForce.getExceptionParameters( ii, particle1, particle2, chargeProd, sigma, epsilon, softcoreLJLambda );
copyNonbondedForce->addException( particle1, particle2, chargeProd, sigma, epsilon, softcoreLJLambda );
}
*/
return
copyNonbondedForce
;
}
static
GBVIForce
*
copyGbviForce
(
const
GBVIForce
&
gbviForce
){
return
new
GBVIForce
(
gbviForce
);
}
static
GBSAOBCForce
*
copyGbsaObcForce
(
const
GBSAOBCForce
&
gbviForce
){
return
new
GBSAOBCForce
(
gbviForce
);
}
/**
/**
* Return copy of system (but not forces)
* Return copy of system (but not forces)
*
*
...
@@ -2891,6 +2739,25 @@ static void getPlatformName( int platformId, std::string& platformName ){
...
@@ -2891,6 +2739,25 @@ static void getPlatformName( int platformId, std::string& platformName ){
return
;
return
;
}
}
/**
* Get lib name
*
* @param libPrefix lib prefix (lib or "")
* @param libSuffix lib suffix (.so, .dylib, .dll)
* @param baseName base name
*
* @return libname
*
*/
static
std
::
string
getLibName
(
const
std
::
string
&
libPrefix
,
const
std
::
string
&
libSuffix
,
const
std
::
string
&
baseName
){
std
::
string
fullName
=
libPrefix
;
fullName
.
append
(
baseName
);
fullName
.
append
(
libSuffix
);
return
fullName
;
}
/**
/**
* Get nonbonded method name
* Get nonbonded method name
*
*
...
@@ -3044,9 +2911,9 @@ void runSystemComparisonTest( System& system1, System& system2,
...
@@ -3044,9 +2911,9 @@ void runSystemComparisonTest( System& system1, System& system2,
Platform
&
platform2
=
Platform
::
getPlatformByName
(
platformName2
);
Platform
&
platform2
=
Platform
::
getPlatformByName
(
platformName2
);
if
(
deviceId2
){
if
(
deviceId2
){
setDeviceIdUsingEnvVariable
(
platform2
,
log
);
setDeviceId
(
platform2
,
deviceId2
,
log
);
setDeviceId
(
platform2
,
deviceId2
,
log
);
}
}
setDeviceIdUsingEnvVariable
(
platform2
,
log
);
Context
context2
(
system2
,
integrator2
,
platform2
);
Context
context2
(
system2
,
integrator2
,
platform2
);
context2
.
setPositions
(
positions
);
context2
.
setPositions
(
positions
);
...
@@ -3298,22 +3165,21 @@ void runTests( MapStringToDouble& inputArgumentMap, FILE* log ){
...
@@ -3298,22 +3165,21 @@ void runTests( MapStringToDouble& inputArgumentMap, FILE* log ){
double
distanceTolerance
=
1.0e-04
;
double
distanceTolerance
=
1.0e-04
;
IntVector
positionIndexVector
;
IntVector
positionIndexVector
;
positionIndexVector
.
push_back
(
0
);
positionIndexVector
.
push_back
(
0
);
positionIndexVector
.
push_back
(
2266
);
positionIndexVector
.
push_back
(
5713
);
positionIndexVector
.
push_back
(
2656
);
positionIndexVector
.
push_back
(
6291
);
positionIndexVector
.
push_back
(
3191
);
positionIndexVector
.
push_back
(
3769
);
positionIndexVector
.
push_back
(
static_cast
<
int
>
(
positions
.
size
())
-
1
);
positionIndexVector
.
push_back
(
static_cast
<
int
>
(
positions
.
size
())
-
1
);
//
positionGenerator.showMinMaxDistances( positions, periodicBoundaryConditions, showIndex, positionIndexVector);
positionGenerator
.
showMinMaxDistances
(
positions
,
periodicBoundaryConditions
,
showIndex
,
positionIndexVector
);
positionGenerator
.
showMinMaxDistances
(
positions
,
periodicBoundaryConditions
,
showIndex
);
positionGenerator
.
showMinMaxDistances
(
positions
,
periodicBoundaryConditions
,
showIndex
);
positionGenerator
.
showParticlesWithinDistance
(
positions
,
periodicBoundaryConditions
,
2266
,
cutoffDistance
,
distanceTolerance
);
positionGenerator
.
showParticlesWithinDistance
(
positions
,
periodicBoundaryConditions
,
5713
,
cutoffDistance
,
distanceTolerance
);
positionGenerator
.
showParticlesWithinDistance
(
positions
,
periodicBoundaryConditions
,
6291
,
cutoffDistance
,
distanceTolerance
);
IntIntPairVector
pairs
;
IntIntPairVector
pairs
;
pairs
.
push_back
(
IntIntPair
(
2266
,
2656
)
);
pairs
.
push_back
(
IntIntPair
(
5713
,
6291
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
2264
)
);
pairs
.
push_back
(
IntIntPair
(
5713
,
3191
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
2292
)
);
pairs
.
push_back
(
IntIntPair
(
5713
,
3769
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
1872
)
);
pairs
.
push_back
(
IntIntPair
(
6291
,
3191
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
1847
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
2658
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
2294
)
);
pairs
.
push_back
(
IntIntPair
(
2266
,
2236
)
);
positionGenerator
.
showDistances
(
pairs
,
positions
);
positionGenerator
.
showDistances
(
pairs
,
positions
);
}
}
...
@@ -3431,18 +3297,18 @@ void runTests( MapStringToDouble& inputArgumentMap, FILE* log ){
...
@@ -3431,18 +3297,18 @@ void runTests( MapStringToDouble& inputArgumentMap, FILE* log ){
System
systemCopy
;
System
systemCopy
;
copySystem
(
standardSystem
,
systemCopy
,
log
);
copySystem
(
standardSystem
,
systemCopy
,
log
);
// perform comparison
std
::
stringstream
idString
;
idString
<<
"Nb "
<<
nonbondedMethod
<<
" l2 "
<<
std
::
fixed
<<
setprecision
(
2
)
<<
lambda2
;
runSystemComparisonTest
(
standardSystem
,
systemCopy
,
positions
,
inputArgumentMap
,
idString
.
str
(),
log
);
// serialize
// serialize
baseFileName
<<
"_N"
<<
positions
.
size
();
baseFileName
<<
"_N"
<<
positions
.
size
();
baseFileName
<<
"_Nb"
<<
nonbondedMethod
;
baseFileName
<<
"_Nb"
<<
nonbondedMethod
;
serializeSystemAndPositions
(
standardSystem
,
positions
,
baseFileName
.
str
(),
log
);
serializeSystemAndPositions
(
standardSystem
,
positions
,
baseFileName
.
str
(),
log
);
// perform comparison
std
::
stringstream
idString
;
idString
<<
"Nb "
<<
nonbondedMethod
<<
" l2 "
<<
std
::
fixed
<<
setprecision
(
2
)
<<
lambda2
;
runSystemComparisonTest
(
standardSystem
,
systemCopy
,
positions
,
inputArgumentMap
,
idString
.
str
(),
log
);
}
}
int
main
()
{
int
main
()
{
...
@@ -3505,9 +3371,9 @@ int main() {
...
@@ -3505,9 +3371,9 @@ int main() {
}
}
DoubleVector
nonbondedMethod
;
DoubleVector
nonbondedMethod
;
//
nonbondedMethod.push_back( NoCutoff_OpenMMTest );
nonbondedMethod
.
push_back
(
NoCutoff_OpenMMTest
);
nonbondedMethod
.
push_back
(
CutoffNonPeriodic_OpenMMTest
);
nonbondedMethod
.
push_back
(
CutoffNonPeriodic_OpenMMTest
);
//
nonbondedMethod.push_back( CutoffPeriodic_OpenMMTest );
nonbondedMethod
.
push_back
(
CutoffPeriodic_OpenMMTest
);
#if IMPLICIT_SOLVENT == TEST_NONBONDED
#if IMPLICIT_SOLVENT == TEST_NONBONDED
nonbondedMethod
.
push_back
(
Ewald_OpenMMTest
);
nonbondedMethod
.
push_back
(
Ewald_OpenMMTest
);
nonbondedMethod
.
push_back
(
PME_OpenMMTest
);
nonbondedMethod
.
push_back
(
PME_OpenMMTest
);
...
@@ -3529,16 +3395,26 @@ int main() {
...
@@ -3529,16 +3395,26 @@ int main() {
// check that required libs are available for platform to be tested
// check that required libs are available for platform to be tested
// if unavailable, skip tests
// if unavailable, skip tests
std
::
string
libPrefix
=
"lib"
;
std
::
string
libSuffix
=
".so"
;
#ifdef _MSC_VER
libPrefix
=
""
;
libSuffix
=
".dll"
;
#endif
#ifdef __APPLE__
libSuffix
=
".dylib"
;
#endif
StringVector
requiredLibs
;
StringVector
requiredLibs
;
for
(
unsigned
int
kk
=
0
;
kk
<
platformId2s
.
size
();
kk
++
){
for
(
unsigned
int
kk
=
0
;
kk
<
platformId2s
.
size
();
kk
++
){
if
(
platformId2s
[
kk
]
==
OpenCL_OpenMMTest
){
if
(
platformId2s
[
kk
]
==
OpenCL_OpenMMTest
){
requiredLibs
.
push_back
(
"lib
OpenMMOpenCL
.so"
);
requiredLibs
.
push_back
(
getLibName
(
libPrefix
,
libSuffix
,
"
OpenMMOpenCL
"
)
);
}
}
if
(
platformId2s
[
kk
]
==
Cuda_OpenMMTest
){
if
(
platformId2s
[
kk
]
==
Cuda_OpenMMTest
){
requiredLibs
.
push_back
(
"lib
OpenMMCuda
.so
"
);
requiredLibs
.
push_back
(
getLibName
(
libPrefix
,
libSuffix
,
"
OpenMMCuda"
)
);
#ifdef USE_SOFTCORE
#ifdef USE_SOFTCORE
requiredLibs
.
push_back
(
"lib
OpenMMFreeEnergy
.so"
);
requiredLibs
.
push_back
(
getLibName
(
libPrefix
,
libSuffix
,
"
OpenMMFreeEnergy
"
)
);
requiredLibs
.
push_back
(
"lib
OpenMMFreeEnergyCuda
.so"
);
requiredLibs
.
push_back
(
getLibName
(
libPrefix
,
libSuffix
,
"
OpenMMFreeEnergyCuda
"
)
);
#endif
#endif
}
}
}
}
...
...
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