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
ce6b5496
Commit
ce6b5496
authored
Feb 28, 2011
by
Mark Friedrichs
Browse files
Mods for gcc 4.4.x
parent
626a504d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
93 additions
and
26 deletions
+93
-26
plugins/amoeba/platforms/reference/tests/CMakeLists.txt
plugins/amoeba/platforms/reference/tests/CMakeLists.txt
+1
-1
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaHarmonicAngleForce.cpp
...reference/tests/TestReferenceAmoebaHarmonicAngleForce.cpp
+12
-2
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaHarmonicBondForce.cpp
.../reference/tests/TestReferenceAmoebaHarmonicBondForce.cpp
+6
-3
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaHarmonicInPlaneAngleForce.cpp
...ce/tests/TestReferenceAmoebaHarmonicInPlaneAngleForce.cpp
+12
-4
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaOutOfPlaneBendForce.cpp
...eference/tests/TestReferenceAmoebaOutOfPlaneBendForce.cpp
+25
-9
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaPiTorsionForce.cpp
...rms/reference/tests/TestReferenceAmoebaPiTorsionForce.cpp
+8
-3
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaStretchBendForce.cpp
...s/reference/tests/TestReferenceAmoebaStretchBendForce.cpp
+10
-3
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaTorsionForce.cpp
...forms/reference/tests/TestReferenceAmoebaTorsionForce.cpp
+9
-0
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaUreyBradleyForce.cpp
...s/reference/tests/TestReferenceAmoebaUreyBradleyForce.cpp
+6
-0
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaVdwForce.cpp
...platforms/reference/tests/TestReferenceAmoebaVdwForce.cpp
+4
-1
No files found.
plugins/amoeba/platforms/reference/tests/CMakeLists.txt
View file @
ce6b5496
...
...
@@ -42,7 +42,7 @@ FOREACH(TEST_PROG ${TEST_PROGS})
ADD_EXECUTABLE
(
${
TEST_ROOT
}
${
TEST_PROG
}
)
#TARGET_LINK_LIBRARIES(${TEST_ROOT} ${SHARED_TARGET} ${SHARED_OPENMM_TARGET} ${SHARED_CUDA_TARGET} ${SHARED_AMOEBA_TINKER_PARAMETER_FILE_TARGET})
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_TARGET
}
${
SHARED_
CUD
A_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
TEST_ROOT
}
${
SHARED_TARGET
}
${
SHARED_OPENMM_TARGET
}
${
SHARED_
OPENMM__AMOEB
A_TARGET
}
)
ADD_TEST
(
${
TEST_ROOT
}
${
EXECUTABLE_OUTPUT_PATH
}
/
${
TEST_ROOT
}
)
# Link with static library
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaHarmonicAngleForce.cpp
View file @
ce6b5496
...
...
@@ -85,11 +85,12 @@ static void getPrefactorsGivenAngleCosine( double cosine, double idealAngle, dou
}
else
{
angle
=
RADIAN
*
acos
(
cosine
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"getPrefactorsGivenAngleCosine: cosine=%10.3e angle=%10.3e ideal=%10.3e
\n
"
,
cosine
,
angle
,
idealAngle
);
(
void
)
fflush
(
log
);
}
#endif
double
deltaIdeal
=
angle
-
idealAngle
;
double
deltaIdeal2
=
deltaIdeal
*
deltaIdeal
;
...
...
@@ -128,12 +129,13 @@ static void computeAmoebaHarmonicAngleForce(int bondIndex, std::vector<Vec3>& p
double
quarticK
=
amoebaHarmonicAngleForce
.
getAmoebaGlobalHarmonicAngleQuartic
();
double
penticK
=
amoebaHarmonicAngleForce
.
getAmoebaGlobalHarmonicAnglePentic
();
double
sexticK
=
amoebaHarmonicAngleForce
.
getAmoebaGlobalHarmonicAngleSextic
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicAngleForce: bond %d [%d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
idealAngle
,
quadraticK
,
cubicK
,
quarticK
,
penticK
,
sexticK
);
(
void
)
fflush
(
log
);
}
#endif
double
deltaR
[
2
][
3
];
double
r2_0
=
0.0
;
...
...
@@ -157,10 +159,12 @@ static void computeAmoebaHarmonicAngleForce(int bondIndex, std::vector<Vec3>& p
double
dot
=
deltaR
[
0
][
0
]
*
deltaR
[
1
][
0
]
+
deltaR
[
0
][
1
]
*
deltaR
[
1
][
1
]
+
deltaR
[
0
][
2
]
*
deltaR
[
1
][
2
];
double
cosine
=
dot
/
sqrt
(
r2_0
*
r2_1
);
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"dot=%10.3e r2_0=%10.3e r2_1=%10.3e
\n
"
,
dot
,
r2_0
,
r2_1
);
(
void
)
fflush
(
log
);
}
#endif
double
dEdR
;
double
energyTerm
;
...
...
@@ -214,6 +218,7 @@ static void computeAmoebaHarmonicAngleForces( Context& context, AmoebaHarmonicAn
computeAmoebaHarmonicAngleForce
(
ii
,
positions
,
amoebaHarmonicAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -221,6 +226,7 @@ static void computeAmoebaHarmonicAngleForces( Context& context, AmoebaHarmonicAn
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -235,6 +241,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaHarmonicAngleFor
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -243,6 +250,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaHarmonicAngleFor
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -299,8 +307,10 @@ int main( int numberOfArguments, char* argv[] ) {
//FILE* log = stderr;
testOneAngle
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaHarmonicBondForce.cpp
View file @
ce6b5496
...
...
@@ -100,7 +100,7 @@ static void computeAmoebaHarmonicBondForces( Context& context, AmoebaHarmonicBon
for
(
int
ii
=
0
;
ii
<
amoebaHarmonicBondForce
.
getNumBonds
();
ii
++
){
computeAmoebaHarmonicBondForce
(
ii
,
positions
,
amoebaHarmonicBondForce
,
expectedForces
,
expectedEnergy
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicBondForces: expected energy=%15.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -108,6 +108,7 @@ static void computeAmoebaHarmonicBondForces( Context& context, AmoebaHarmonicBon
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -120,7 +121,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaHarmonicBondForc
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicBondForces: expected energy=%15.7e %15.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -129,6 +130,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaHarmonicBondForc
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -209,9 +211,10 @@ int main( int numberOfArguments, char* argv[] ) {
//testOneBond( log );
testTwoBond
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaHarmonicInPlaneAngleForce.cpp
View file @
ce6b5496
...
...
@@ -87,11 +87,12 @@ static void getPrefactorsGivenInPlaneAngleCosine( double cosine, double idealInP
}
else
{
angle
=
RADIAN
*
acos
(
cosine
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"getPrefactorsGivenInPlaneAngleCosine: cosine=%10.3e angle=%10.3e ideal=%10.3e
\n
"
,
cosine
,
angle
,
idealInPlaneAngle
);
(
void
)
fflush
(
log
);
}
#endif
double
deltaIdeal
=
angle
-
idealInPlaneAngle
;
double
deltaIdeal2
=
deltaIdeal
*
deltaIdeal
;
...
...
@@ -130,12 +131,13 @@ static void computeAmoebaHarmonicInPlaneAngleForce(int bondIndex, std::vector<V
double
quarticK
=
amoebaHarmonicInPlaneAngleForce
.
getAmoebaGlobalHarmonicInPlaneAngleQuartic
();
double
penticK
=
amoebaHarmonicInPlaneAngleForce
.
getAmoebaGlobalHarmonicInPlaneAnglePentic
();
double
sexticK
=
amoebaHarmonicInPlaneAngleForce
.
getAmoebaGlobalHarmonicInPlaneAngleSextic
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicInPlaneAngleForce: bond %d [%d %d %d %d] ang=%10.3f k=%10.3f [%10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
idealInPlaneAngle
,
quadraticK
,
cubicK
,
quarticK
,
penticK
,
sexticK
);
(
void
)
fflush
(
log
);
}
#endif
// T = AD x CD
// P = B + T*delta
...
...
@@ -176,10 +178,12 @@ static void computeAmoebaHarmonicInPlaneAngleForce(int bondIndex, std::vector<V
double
rAp2
=
dotVector3
(
deltaR
[
AP
],
deltaR
[
AP
]
);
double
rCp2
=
dotVector3
(
deltaR
[
CP
],
deltaR
[
CP
]
);
if
(
rAp2
<=
0.0
&&
rCp2
<=
0.0
){
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicInPlaneAngleForce: rAp2 or rCp2 <= 0.0
\n
"
);
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -290,7 +294,7 @@ static void computeAmoebaHarmonicInPlaneAngleForces( Context& context, AmoebaHar
for
(
int
ii
=
0
;
ii
<
amoebaHarmonicInPlaneAngleForce
.
getNumAngles
();
ii
++
){
computeAmoebaHarmonicInPlaneAngleForce
(
ii
,
positions
,
amoebaHarmonicInPlaneAngleForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicInPlaneAngleForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -298,6 +302,7 @@ static void computeAmoebaHarmonicInPlaneAngleForces( Context& context, AmoebaHar
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -311,7 +316,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaHarmonicInPlaneA
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaHarmonicInPlaneAngleForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -320,6 +325,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaHarmonicInPlaneA
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -377,8 +383,10 @@ int main( int numberOfArguments, char* argv[] ) {
//FILE* log = fopen( "AmoebaHarmonicInPlaneAngleForce.log", "w" );;
testOneAngle
(
NULL
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaOutOfPlaneBendForce.cpp
View file @
ce6b5496
...
...
@@ -88,12 +88,14 @@ static void computeAmoebaOutOfPlaneBendForce(int bondIndex, std::vector<Vec3>&
int
particle1
,
particle2
,
particle3
,
particle4
;
double
kAngleQuadratic
;
amoebaOutOfPlaneBendForce
.
getOutOfPlaneBendParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
kAngleQuadratic
);
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaOutOfPlaneBendForce: bond %d [%d %d %d %d] k=[%10.3e %10.3e %10.3e %10.3e %10.3e]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
kAngleQuadratic
,
kAngleCubic
,
kAngleQuartic
,
kAnglePentic
,
kAngleSextic
);
(
void
)
fflush
(
log
);
}
#endif
enum
{
A
,
B
,
C
,
D
,
LastAtomIndex
};
enum
{
AB
,
CB
,
DB
,
AD
,
CD
,
LastDeltaIndex
};
...
...
@@ -135,12 +137,13 @@ static void computeAmoebaOutOfPlaneBendForce(int bondIndex, std::vector<Vec3>&
}
else
{
angle
=
RADIAN
*
acos
(
cosine
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaOutOfPlaneBendForce: bkk2=%14.7e rDB2=%14.7e cos=%14.7e dt=%14.7e]
\n
"
,
bkk2
,
rDB2
,
cosine
,
angle
);
(
void
)
fflush
(
log
);
}
#endif
// chain rule
...
...
@@ -256,6 +259,7 @@ static void computeAmoebaOutOfPlaneBendForces( Context& context, AmoebaOutOfPlan
computeAmoebaOutOfPlaneBendForce
(
ii
,
positions
,
amoebaOutOfPlaneBendForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaOutOfPlaneBendForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -263,6 +267,7 @@ static void computeAmoebaOutOfPlaneBendForces( Context& context, AmoebaOutOfPlan
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -276,7 +281,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaOutOfPlaneBendFo
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaOutOfPlaneBendForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -285,6 +290,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaOutOfPlaneBendFo
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -412,16 +418,20 @@ void testOneOutOfPlaneBend2( FILE* log, int setId ) {
particleIndices
.
push_back
(
442
);
kOutOfPlaneBend
=
0.214755281E-01
;
}
else
{
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"Set id %d not recognized.
\n
"
,
setId
);
}
char
buffer
[
1024
];
(
void
)
sprintf
(
buffer
,
"Set id %d not recognized."
,
setId
);
throw
OpenMMException
(
buffer
);
#endif
std
::
stringstream
buffer
;
buffer
<<
"Set id "
<<
setId
<<
" not recognized."
;
throw
OpenMMException
(
buffer
.
str
()
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"Set id %d.
\n
"
,
setId
);
}
#endif
amoebaOutOfPlaneBendForce
->
addOutOfPlaneBend
(
0
,
1
,
2
,
3
,
kOutOfPlaneBend
);
...
...
@@ -431,12 +441,14 @@ void testOneOutOfPlaneBend2( FILE* log, int setId ) {
for
(
unsigned
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
){
if
(
coordinates
.
find
(
particleIndices
[
ii
]
)
==
coordinates
.
end
()
){
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"Coordinates %d not loaded."
,
particleIndices
[
ii
]
);
}
char
buffer
[
1024
];
(
void
)
sprintf
(
buffer
,
"Coordinates %d not loaded."
,
particleIndices
[
ii
]
);
throw
OpenMMException
(
buffer
);
#endif
std
::
stringstream
buffer
;
buffer
<<
"Coordinates "
<<
particleIndices
[
ii
]
<<
" not loaded."
;
throw
OpenMMException
(
buffer
.
str
()
);
}
positions
[
ii
]
=
coordinates
[
particleIndices
[
ii
]];
}
...
...
@@ -475,6 +487,7 @@ void testOneOutOfPlaneBend2( FILE* log, int setId ) {
}
if
(
iter
==
6
){
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaOutOfPlaneBendForces: energy=%14.7e
\n
"
,
totalEnergy
);
for
(
std
::
map
<
int
,
Vec3
>::
iterator
ii
=
totalForces
.
begin
();
ii
!=
totalForces
.
end
();
ii
++
){
...
...
@@ -485,6 +498,7 @@ void testOneOutOfPlaneBend2( FILE* log, int setId ) {
}
(
void
)
fflush
(
log
);
}
#endif
}
}
...
...
@@ -504,8 +518,10 @@ int main( int numberOfArguments, char* argv[] ) {
//for( int ii = 1; ii <= 6; ii++ ){
// testOneOutOfPlaneBend2( log, ii );
//}
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaPiTorsionForce.cpp
View file @
ce6b5496
...
...
@@ -82,12 +82,13 @@ static void computeAmoebaPiTorsionForce(int bondIndex, std::vector<Vec3>& posit
double
kTorsion
;
amoebaPiTorsionForce
.
getPiTorsionParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
kTorsion
);
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaPiTorsionForce: bond %d [%d %d %d %d %d %d] k=%10.3e
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
kTorsion
);
(
void
)
fflush
(
log
);
}
#endif
enum
{
AD
,
BD
,
EC
,
FC
,
P
,
Q
,
CP
,
DC
,
QD
,
T
,
U
,
TU
,
DP
,
QC
,
dT
,
dU
,
dP
,
dQ
,
dC1
,
dC2
,
dD1
,
dD2
,
LastDeltaIndex
};
double
deltaR
[
LastDeltaIndex
][
3
];
...
...
@@ -227,7 +228,7 @@ static void computeAmoebaPiTorsionForces( Context& context, AmoebaPiTorsionForce
for
(
int
ii
=
0
;
ii
<
amoebaPiTorsionForce
.
getNumPiTorsions
();
ii
++
){
computeAmoebaPiTorsionForce
(
ii
,
positions
,
amoebaPiTorsionForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaPiTorsionForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -235,6 +236,7 @@ static void computeAmoebaPiTorsionForces( Context& context, AmoebaPiTorsionForce
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -248,7 +250,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaPiTorsionForce&
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaPiTorsionForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -257,6 +259,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaPiTorsionForce&
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -307,8 +310,10 @@ int main( int numberOfArguments, char* argv[] ) {
//FILE* log = fopen( "AmoebaPiTorsionForce1.log", "w" );;
testOnePiTorsion
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaStretchBendForce.cpp
View file @
ce6b5496
...
...
@@ -85,11 +85,13 @@ static void computeAmoebaStretchBendForce(int bondIndex, std::vector<Vec3>& pos
amoebaStretchBendForce
.
getStretchBendParameters
(
bondIndex
,
particle1
,
particle2
,
particle3
,
abBondLength
,
cbBondLength
,
angleStretchBend
,
kStretchBend
);
angleStretchBend
*=
RADIAN
;
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaStretchBendForce: bond %d [%d %d %d] ab=%10.3e cb=%10.3e angle=%10.3e k=%10.3e
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
abBondLength
,
cbBondLength
,
angleStretchBend
,
kStretchBend
);
(
void
)
fflush
(
log
);
}
#endif
enum
{
A
,
B
,
C
,
LastAtomIndex
};
enum
{
AB
,
CB
,
CBxAB
,
ABxP
,
CBxP
,
LastDeltaIndex
};
...
...
@@ -182,11 +184,12 @@ static void computeAmoebaStretchBendForce(int bondIndex, std::vector<Vec3>& pos
forces
[
particle3
][
2
]
-=
subForce
[
2
][
2
];
*
energy
+=
term
*
dt
*
dr
;
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaStretchBendForce: angle=%10.3e dt=%10.3e dr=%10.3e
\n
"
,
angle
,
dt
,
dr
);
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -210,7 +213,7 @@ static void computeAmoebaStretchBendForces( Context& context, AmoebaStretchBendF
for
(
int
ii
=
0
;
ii
<
amoebaStretchBendForce
.
getNumStretchBends
();
ii
++
){
computeAmoebaStretchBendForce
(
ii
,
positions
,
amoebaStretchBendForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaStretchBendForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -218,6 +221,7 @@ static void computeAmoebaStretchBendForces( Context& context, AmoebaStretchBendF
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -231,7 +235,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaStretchBendForce
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaStretchBendForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -240,6 +244,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaStretchBendForce
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -291,8 +296,10 @@ int main( int numberOfArguments, char* argv[] ) {
//FILE* log = stderr;
//FILE* log = fopen( "AmoebaStretchBendForce1.log", "w" );;
testOneStretchBend
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaTorsionForce.cpp
View file @
ce6b5496
...
...
@@ -95,6 +95,7 @@ static void computeAmoebaTorsionForce(int bondIndex, std::vector<Vec3>& positio
torsions
.
push_back
(
torsion2
);
torsions
.
push_back
(
torsion3
);
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaTorsionForce: bond %d [%d %d %d %d]
\n
"
,
bondIndex
,
particle1
,
particle2
,
particle3
,
particle4
);
...
...
@@ -103,6 +104,7 @@ static void computeAmoebaTorsionForce(int bondIndex, std::vector<Vec3>& positio
}
(
void
)
fflush
(
log
);
}
#endif
enum
{
BA
,
CB
,
DC
,
CA
,
DB
,
LastDeltaIndex
};
double
deltaR
[
LastDeltaIndex
][
3
];
...
...
@@ -251,6 +253,7 @@ static void computeAmoebaTorsionForces( Context& context, AmoebaTorsionForce& am
computeAmoebaTorsionForce
(
ii
,
positions
,
amoebaTorsionForce
,
expectedForces
,
expectedEnergy
,
log
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaTorsionForces: expected energy=%14.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -258,6 +261,8 @@ static void computeAmoebaTorsionForces( Context& context, AmoebaTorsionForce& am
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -272,6 +277,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaTorsionForce& am
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaTorsionForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -280,6 +286,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaTorsionForce& am
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -336,8 +343,10 @@ int main( int numberOfArguments, char* argv[] ) {
FILE
*
log
=
NULL
;
//FILE* log = fopen( "AmoebaTorsionForce.log", "w" );;
testOneTorsion
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaUreyBradleyForce.cpp
View file @
ce6b5496
...
...
@@ -102,6 +102,7 @@ static void computeAmoebaUreyBradleyForces( Context& context, AmoebaUreyBradleyF
computeAmoebaUreyBradleyForce
(
ii
,
positions
,
amoebaUreyBradleyForce
,
expectedForces
,
expectedEnergy
);
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaUreyBradleyForces: expected energy=%15.7e
\n
"
,
*
expectedEnergy
);
for
(
unsigned
int
ii
=
0
;
ii
<
positions
.
size
();
ii
++
){
...
...
@@ -109,6 +110,7 @@ static void computeAmoebaUreyBradleyForces( Context& context, AmoebaUreyBradleyF
}
(
void
)
fflush
(
log
);
}
#endif
return
;
}
...
...
@@ -122,6 +124,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaUreyBradleyForce
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
std
::
vector
<
Vec3
>
forces
=
state
.
getForces
();
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaUreyBradleyForces: expected energy=%15.7e %15.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -130,6 +133,7 @@ void compareWithExpectedForceAndEnergy( Context& context, AmoebaUreyBradleyForce
}
(
void
)
fflush
(
log
);
}
#endif
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
ASSERT_EQUAL_VEC
(
expectedForces
[
ii
],
forces
[
ii
],
tolerance
);
...
...
@@ -211,8 +215,10 @@ int main( int numberOfArguments, char* argv[] ) {
//testOneBond( log );
testTwoBond
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
plugins/amoeba/platforms/reference/tests/TestReferenceAmoebaVdwForce.cpp
View file @
ce6b5496
...
...
@@ -133,7 +133,7 @@ void testVdw( FILE* log ) {
forces
[
ii
][
1
]
*=
conversion
;
forces
[
ii
][
2
]
*=
conversion
;
}
#ifdef AMOEBA_DEBUG
if
(
log
){
(
void
)
fprintf
(
log
,
"computeAmoebaVdwForces: expected energy=%14.7e %14.7e
\n
"
,
expectedEnergy
,
state
.
getPotentialEnergy
()
);
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -142,6 +142,7 @@ void testVdw( FILE* log ) {
}
(
void
)
fflush
(
log
);
}
#endif
double
tolerance
=
1.0e-03
;
for
(
unsigned
int
ii
=
0
;
ii
<
forces
.
size
();
ii
++
){
...
...
@@ -161,8 +162,10 @@ int main( int numberOfArguments, char* argv[] ) {
//FILE* log = stderr;
//FILE* log = fopen( "AmoebaVdwForce1.log", "w" );;
testVdw
(
log
);
#ifdef AMOEBA_DEBUG
if
(
log
&&
log
!=
stderr
)
(
void
)
fclose
(
log
);
#endif
}
catch
(
const
std
::
exception
&
e
)
{
...
...
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