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
"libraries/vscode:/vscode.git/clone" did not exist on "55081e216abf4bfccaa7764c999bac1a33c88bd1"
Commit
38c2015e
authored
Nov 11, 2011
by
Mark Friedrichs
Browse files
Update to nonbonded and implicit solvent tests
parent
7b5344db
Changes
3
Hide 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,13 +256,33 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
...
@@ -252,13 +256,33 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
gpu
->
psPosq4
->
Download
();
gpu
->
psPosq4
->
Download
();
gpu
->
psSigEps2
->
Download
();
gpu
->
psSigEps2
->
Download
();
(
void
)
fprintf
(
log
,
"kPrintGBVI Cuda comp bR bF prm sigeps2
\n
"
);
int
printOnlyOnNan
=
1
;
(
void
)
fprintf
(
stderr
,
"kCalculateGBVIBornSum: bOutputBufferPerWarp=%u blks=%u th/blk=%u wu=%u %u shrd=%u
\n
"
,
gpu
->
bOutputBufferPerWarp
,
int
foundNan
=
0
;
gpu
->
sim
.
nonbond_blocks
,
gpu
->
sim
.
nonbond_threads_per_block
,
gpu
->
sim
.
workUnits
,
gpu
->
psWorkUnit
->
_pSysStream
[
0
][
0
],
if
(
printOnlyOnNan
){
sizeof
(
Atom
)
*
gpu
->
sim
.
nonbond_threads_per_block
);
for
(
int
ii
=
0
;
ii
<
gpu
->
sim
.
paddedNumberOfAtoms
&&
foundNan
==
0
;
ii
++
){
(
void
)
fprintf
(
stderr
,
"bR bF swd r scR ...
\n
"
);
foundNan
+=
isNanOrInfinity
(
gpu
->
psBornRadii
->
_pSysData
[
ii
]
);
for
(
int
ii
=
0
;
ii
<
gpu
->
sim
.
paddedNumberOfAtoms
;
ii
++
){
foundNan
+=
isNanOrInfinity
(
gpu
->
psBornForce
->
_pSysData
[
ii
]
);
(
void
)
fprintf
(
log
,
"%6d %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e
\n
"
,
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
(
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
],
sizeof
(
Atom
)
*
gpu
->
sim
.
nonbond_threads_per_block
);
(
void
)
fprintf
(
stderr
,
"bR bF swd r scR ...
\n
"
);
for
(
int
ii
=
0
;
ii
<
gpu
->
sim
.
paddedNumberOfAtoms
;
ii
++
){
(
void
)
fprintf
(
log
,
"%6d %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e %15.7e
\n
"
,
ii
,
gpu
->
psBornRadii
->
_pSysData
[
ii
],
gpu
->
psBornRadii
->
_pSysData
[
ii
],
gpu
->
psBornForce
->
_pSysData
[
ii
],
gpu
->
psBornForce
->
_pSysData
[
ii
],
gpu
->
psGBVISwitchDerivative
->
_pSysData
[
ii
],
gpu
->
psGBVISwitchDerivative
->
_pSysData
[
ii
],
...
@@ -270,6 +294,10 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
...
@@ -270,6 +294,10 @@ void kPrintGBVI( gpuContext gpu, std::string callId, int call, FILE* log)
gpu
->
psSigEps2
->
_pSysData
[
ii
].
x
,
gpu
->
psSigEps2
->
_pSysData
[
ii
].
x
,
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
);
...
@@ -1803,7 +1803,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1803,7 +1803,7 @@ static Force* copyForce( const Force& force, FILE* log ){
Force
*
forceCopy
=
NULL
;
Force
*
forceCopy
=
NULL
;
try
{
try
{
const
CMAPTorsionForce
&
castForce
=
dynamic_cast
<
const
CMAPTorsionForce
&>
(
force
);
const
CMAPTorsionForce
&
castForce
=
dynamic_cast
<
const
CMAPTorsionForce
&>
(
force
);
forceCopy
=
new
CMAPTorsionForce
(
castForce
);
forceCopy
=
new
CMAPTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
...
@@ -1811,7 +1811,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1811,7 +1811,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
CustomAngleForce
&
castForce
=
dynamic_cast
<
const
CustomAngleForce
&>
(
force
);
const
CustomAngleForce
&
castForce
=
dynamic_cast
<
const
CustomAngleForce
&>
(
force
);
forceCopy
=
new
CustomAngleForce
(
castForce
);
forceCopy
=
new
CustomAngleForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1820,7 +1820,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1820,7 +1820,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
CustomBondForce
&
castForce
=
dynamic_cast
<
const
CustomBondForce
&>
(
force
);
const
CustomBondForce
&
castForce
=
dynamic_cast
<
const
CustomBondForce
&>
(
force
);
forceCopy
=
new
CustomBondForce
(
castForce
);
forceCopy
=
new
CustomBondForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1829,7 +1829,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1829,7 +1829,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
CustomExternalForce
&
castForce
=
dynamic_cast
<
const
CustomExternalForce
&>
(
force
);
const
CustomExternalForce
&
castForce
=
dynamic_cast
<
const
CustomExternalForce
&>
(
force
);
forceCopy
=
new
CustomExternalForce
(
castForce
);
forceCopy
=
new
CustomExternalForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1838,7 +1838,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1838,7 +1838,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
CustomGBForce
&
castForce
=
dynamic_cast
<
const
CustomGBForce
&>
(
force
);
const
CustomGBForce
&
castForce
=
dynamic_cast
<
const
CustomGBForce
&>
(
force
);
forceCopy
=
new
CustomGBForce
(
castForce
);
forceCopy
=
new
CustomGBForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1847,7 +1847,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1847,7 +1847,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
CustomHbondForce
&
castForce
=
dynamic_cast
<
const
CustomHbondForce
&>
(
force
);
const
CustomHbondForce
&
castForce
=
dynamic_cast
<
const
CustomHbondForce
&>
(
force
);
forceCopy
=
new
CustomHbondForce
(
castForce
);
forceCopy
=
new
CustomHbondForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1856,7 +1856,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1856,7 +1856,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
CustomNonbondedForce
&
castForce
=
dynamic_cast
<
const
CustomNonbondedForce
&>
(
force
);
const
CustomNonbondedForce
&
castForce
=
dynamic_cast
<
const
CustomNonbondedForce
&>
(
force
);
forceCopy
=
new
CustomNonbondedForce
(
castForce
);
forceCopy
=
new
CustomNonbondedForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1866,7 +1866,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1866,7 +1866,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
CustomTorsionForce
&
castForce
=
dynamic_cast
<
const
CustomTorsionForce
&>
(
force
);
const
CustomTorsionForce
&
castForce
=
dynamic_cast
<
const
CustomTorsionForce
&>
(
force
);
forceCopy
=
new
CustomTorsionForce
(
castForce
);
forceCopy
=
new
CustomTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1876,7 +1876,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1876,7 +1876,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
GBSAOBCForce
&
castForce
=
dynamic_cast
<
const
GBSAOBCForce
&>
(
force
);
const
GBSAOBCForce
&
castForce
=
dynamic_cast
<
const
GBSAOBCForce
&>
(
force
);
forceCopy
=
new
GBSAOBCForce
(
castForce
);
forceCopy
=
new
GBSAOBCForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1885,7 +1885,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1885,7 +1885,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
GBVIForce
&
castForce
=
dynamic_cast
<
const
GBVIForce
&>
(
force
);
const
GBVIForce
&
castForce
=
dynamic_cast
<
const
GBVIForce
&>
(
force
);
forceCopy
=
new
GBVIForce
(
castForce
);
forceCopy
=
new
GBVIForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1894,7 +1894,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1894,7 +1894,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
HarmonicAngleForce
&
castForce
=
dynamic_cast
<
const
HarmonicAngleForce
&>
(
force
);
const
HarmonicAngleForce
&
castForce
=
dynamic_cast
<
const
HarmonicAngleForce
&>
(
force
);
forceCopy
=
new
HarmonicAngleForce
(
castForce
);
forceCopy
=
new
HarmonicAngleForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1902,7 +1902,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1902,7 +1902,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
HarmonicBondForce
&
castForce
=
dynamic_cast
<
const
HarmonicBondForce
&>
(
force
);
const
HarmonicBondForce
&
castForce
=
dynamic_cast
<
const
HarmonicBondForce
&>
(
force
);
forceCopy
=
new
HarmonicBondForce
(
castForce
);
forceCopy
=
new
HarmonicBondForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1910,7 +1910,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1910,7 +1910,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
NonbondedForce
&
castForce
=
dynamic_cast
<
const
NonbondedForce
&>
(
force
);
const
NonbondedForce
&
castForce
=
dynamic_cast
<
const
NonbondedForce
&>
(
force
);
forceCopy
=
new
NonbondedForce
(
castForce
);
forceCopy
=
new
NonbondedForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1919,7 +1919,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1919,7 +1919,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
PeriodicTorsionForce
&
castForce
=
dynamic_cast
<
const
PeriodicTorsionForce
&>
(
force
);
const
PeriodicTorsionForce
&
castForce
=
dynamic_cast
<
const
PeriodicTorsionForce
&>
(
force
);
forceCopy
=
new
PeriodicTorsionForce
(
castForce
);
forceCopy
=
new
PeriodicTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1928,7 +1928,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1928,7 +1928,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
RBTorsionForce
&
castForce
=
dynamic_cast
<
const
RBTorsionForce
&>
(
force
);
const
RBTorsionForce
&
castForce
=
dynamic_cast
<
const
RBTorsionForce
&>
(
force
);
forceCopy
=
new
RBTorsionForce
(
castForce
);
forceCopy
=
new
RBTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1937,7 +1937,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1937,7 +1937,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
MonteCarloBarostat
&
castForce
=
dynamic_cast
<
const
MonteCarloBarostat
&>
(
force
);
const
MonteCarloBarostat
&
castForce
=
dynamic_cast
<
const
MonteCarloBarostat
&>
(
force
);
forceCopy
=
new
MonteCarloBarostat
(
castForce
);
forceCopy
=
new
MonteCarloBarostat
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1946,7 +1946,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1946,7 +1946,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AndersenThermostat
&
castForce
=
dynamic_cast
<
const
AndersenThermostat
&>
(
force
);
const
AndersenThermostat
&
castForce
=
dynamic_cast
<
const
AndersenThermostat
&>
(
force
);
forceCopy
=
new
AndersenThermostat
(
castForce
);
forceCopy
=
new
AndersenThermostat
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1956,7 +1956,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1956,7 +1956,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
GBSAOBCSoftcoreForce
&
castForce
=
dynamic_cast
<
const
GBSAOBCSoftcoreForce
&>
(
force
);
const
GBSAOBCSoftcoreForce
&
castForce
=
dynamic_cast
<
const
GBSAOBCSoftcoreForce
&>
(
force
);
forceCopy
=
new
GBSAOBCSoftcoreForce
(
castForce
);
forceCopy
=
new
GBSAOBCSoftcoreForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1964,7 +1964,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1964,7 +1964,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
GBVISoftcoreForce
&
castForce
=
dynamic_cast
<
const
GBVISoftcoreForce
&>
(
force
);
const
GBVISoftcoreForce
&
castForce
=
dynamic_cast
<
const
GBVISoftcoreForce
&>
(
force
);
forceCopy
=
new
GBVISoftcoreForce
(
castForce
);
forceCopy
=
new
GBVISoftcoreForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1972,7 +1972,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1972,7 +1972,7 @@ static Force* copyForce( const Force& force, FILE* log ){
if
(
forceCopy
==
NULL
){
if
(
forceCopy
==
NULL
){
try
{
try
{
const
NonbondedSoftcoreForce
&
castForce
=
dynamic_cast
<
const
NonbondedSoftcoreForce
&>
(
force
);
const
NonbondedSoftcoreForce
&
castForce
=
dynamic_cast
<
const
NonbondedSoftcoreForce
&>
(
force
);
forceCopy
=
new
NonbondedSoftcoreForce
(
castForce
);
forceCopy
=
new
NonbondedSoftcoreForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1984,7 +1984,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1984,7 +1984,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaHarmonicBondForce
&
castForce
=
dynamic_cast
<
const
AmoebaHarmonicBondForce
&>
(
force
);
const
AmoebaHarmonicBondForce
&
castForce
=
dynamic_cast
<
const
AmoebaHarmonicBondForce
&>
(
force
);
forceCopy
=
new
AmoebaHarmonicBondForce
(
castForce
);
forceCopy
=
new
AmoebaHarmonicBondForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -1993,7 +1993,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -1993,7 +1993,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaHarmonicAngleForce
&
castForce
=
dynamic_cast
<
const
AmoebaHarmonicAngleForce
&>
(
force
);
const
AmoebaHarmonicAngleForce
&
castForce
=
dynamic_cast
<
const
AmoebaHarmonicAngleForce
&>
(
force
);
forceCopy
=
new
AmoebaHarmonicAngleForce
(
castForce
);
forceCopy
=
new
AmoebaHarmonicAngleForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2002,7 +2002,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2002,7 +2002,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaHarmonicInPlaneAngleForce
&
castForce
=
dynamic_cast
<
const
AmoebaHarmonicInPlaneAngleForce
&>
(
force
);
const
AmoebaHarmonicInPlaneAngleForce
&
castForce
=
dynamic_cast
<
const
AmoebaHarmonicInPlaneAngleForce
&>
(
force
);
forceCopy
=
new
AmoebaHarmonicInPlaneAngleForce
(
castForce
);
forceCopy
=
new
AmoebaHarmonicInPlaneAngleForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2011,7 +2011,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2011,7 +2011,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaMultipoleForce
&
castForce
=
dynamic_cast
<
const
AmoebaMultipoleForce
&>
(
force
);
const
AmoebaMultipoleForce
&
castForce
=
dynamic_cast
<
const
AmoebaMultipoleForce
&>
(
force
);
forceCopy
=
new
AmoebaMultipoleForce
(
castForce
);
forceCopy
=
new
AmoebaMultipoleForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2020,7 +2020,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2020,7 +2020,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaOutOfPlaneBendForce
&
castForce
=
dynamic_cast
<
const
AmoebaOutOfPlaneBendForce
&>
(
force
);
const
AmoebaOutOfPlaneBendForce
&
castForce
=
dynamic_cast
<
const
AmoebaOutOfPlaneBendForce
&>
(
force
);
forceCopy
=
new
AmoebaOutOfPlaneBendForce
(
castForce
);
forceCopy
=
new
AmoebaOutOfPlaneBendForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2029,7 +2029,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2029,7 +2029,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaPiTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaPiTorsionForce
&>
(
force
);
const
AmoebaPiTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaPiTorsionForce
&>
(
force
);
forceCopy
=
new
AmoebaPiTorsionForce
(
castForce
);
forceCopy
=
new
AmoebaPiTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2038,7 +2038,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2038,7 +2038,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaStretchBendForce
&
castForce
=
dynamic_cast
<
const
AmoebaStretchBendForce
&>
(
force
);
const
AmoebaStretchBendForce
&
castForce
=
dynamic_cast
<
const
AmoebaStretchBendForce
&>
(
force
);
forceCopy
=
new
AmoebaStretchBendForce
(
castForce
);
forceCopy
=
new
AmoebaStretchBendForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2047,7 +2047,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2047,7 +2047,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaTorsionForce
&>
(
force
);
const
AmoebaTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaTorsionForce
&>
(
force
);
forceCopy
=
new
AmoebaTorsionForce
(
castForce
);
forceCopy
=
new
AmoebaTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2056,7 +2056,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2056,7 +2056,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaTorsionTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaTorsionTorsionForce
&>
(
force
);
const
AmoebaTorsionTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaTorsionTorsionForce
&>
(
force
);
forceCopy
=
new
AmoebaTorsionTorsionForce
(
castForce
);
forceCopy
=
new
AmoebaTorsionTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2065,7 +2065,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2065,7 +2065,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaUreyBradleyForce
&
castForce
=
dynamic_cast
<
const
AmoebaUreyBradleyForce
&>
(
force
);
const
AmoebaUreyBradleyForce
&
castForce
=
dynamic_cast
<
const
AmoebaUreyBradleyForce
&>
(
force
);
forceCopy
=
new
AmoebaUreyBradleyForce
(
castForce
);
forceCopy
=
new
AmoebaUreyBradleyForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2074,7 +2074,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2074,7 +2074,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaVdwForce
&
castForce
=
dynamic_cast
<
const
AmoebaVdwForce
&>
(
force
);
const
AmoebaVdwForce
&
castForce
=
dynamic_cast
<
const
AmoebaVdwForce
&>
(
force
);
forceCopy
=
new
AmoebaVdwForce
(
castForce
);
forceCopy
=
new
AmoebaVdwForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2083,7 +2083,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2083,7 +2083,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaWcaDispersionForce
&
castForce
=
dynamic_cast
<
const
AmoebaWcaDispersionForce
&>
(
force
);
const
AmoebaWcaDispersionForce
&
castForce
=
dynamic_cast
<
const
AmoebaWcaDispersionForce
&>
(
force
);
forceCopy
=
new
AmoebaWcaDispersionForce
(
castForce
);
forceCopy
=
new
AmoebaWcaDispersionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2092,7 +2092,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2092,7 +2092,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaGeneralizedKirkwoodForce
&
castForce
=
dynamic_cast
<
const
AmoebaGeneralizedKirkwoodForce
&>
(
force
);
const
AmoebaGeneralizedKirkwoodForce
&
castForce
=
dynamic_cast
<
const
AmoebaGeneralizedKirkwoodForce
&>
(
force
);
forceCopy
=
new
AmoebaGeneralizedKirkwoodForce
(
castForce
);
forceCopy
=
new
AmoebaGeneralizedKirkwoodForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -2101,7 +2101,7 @@ static Force* copyForce( const Force& force, FILE* log ){
...
@@ -2101,7 +2101,7 @@ static Force* copyForce( const Force& force, FILE* log ){
try
{
try
{
const
AmoebaTorsionTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaTorsionTorsionForce
&>
(
force
);
const
AmoebaTorsionTorsionForce
&
castForce
=
dynamic_cast
<
const
AmoebaTorsionTorsionForce
&>
(
force
);
forceCopy
=
new
AmoebaTorsionTorsionForce
(
castForce
);
forceCopy
=
new
AmoebaTorsionTorsionForce
(
castForce
);
}
catch
(
std
::
bad_cast
){
}
catch
(
std
::
bad_cast
){
}
}
}
}
...
@@ -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