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
dd741b6d
Commit
dd741b6d
authored
Dec 18, 2008
by
Mark Friedrichs
Browse files
Mods
parent
b31196d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
platforms/brook/tests/TestBrookStream.cpp
platforms/brook/tests/TestBrookStream.cpp
+21
-16
No files found.
platforms/brook/tests/TestBrookStream.cpp
View file @
dd741b6d
...
@@ -972,6 +972,7 @@ void testBrookBondedHarmonicBond( void ){
...
@@ -972,6 +972,7 @@ void testBrookBondedHarmonicBond( void ){
std
::
vector
<
std
::
vector
<
int
>
>
lj14Indices
;
std
::
vector
<
std
::
vector
<
int
>
>
lj14Indices
;
std
::
vector
<
std
::
vector
<
double
>
>
lj14Parameters
;
std
::
vector
<
std
::
vector
<
double
>
>
lj14Parameters
;
/*
(void) fprintf( log, "testBrookBondedHarmonicBond: Calling brookBonded.setup\n" );
(void) fprintf( log, "testBrookBondedHarmonicBond: Calling brookBonded.setup\n" );
brookBonded.setup( numberOfParticles,
brookBonded.setup( numberOfParticles,
harmonicBondsIndices, harmonicBondsParameters,
harmonicBondsIndices, harmonicBondsParameters,
...
@@ -997,6 +998,7 @@ void testBrookBondedHarmonicBond( void ){
...
@@ -997,6 +998,7 @@ void testBrookBondedHarmonicBond( void ){
contents = brookRandomNumberGenerator.getContentsString( );
contents = brookRandomNumberGenerator.getContentsString( );
(void) fprintf( log, "testBrookBondedHarmonicBond: brookRandomNumberGenerator::contents\n%s", contents.c_str() );
(void) fprintf( log, "testBrookBondedHarmonicBond: brookRandomNumberGenerator::contents\n%s", contents.c_str() );
*/
}
}
...
@@ -1043,14 +1045,14 @@ void testBrookNonBonded( void ){
...
@@ -1043,14 +1045,14 @@ void testBrookNonBonded( void ){
exclusions
.
push_back
(
exclusion
);
exclusions
.
push_back
(
exclusion
);
}
}
(
void
)
fprintf
(
log
,
"testBrookBonded
HarmonicBond
: Calling brookNonBonded::setup
\n
"
);
(
void
)
fprintf
(
log
,
"testBrook
Non
Bonded: Calling brookNonBonded::setup
\n
"
);
(
void
)
fflush
(
log
);
(
void
)
fflush
(
log
);
brookNonBonded
.
setup
(
numberOfParticles
,
nonbondedParameters
,
exclusions
,
brookPlatform
);
brookNonBonded
.
setup
(
numberOfParticles
,
nonbondedParameters
,
exclusions
,
brookPlatform
);
std
::
string
contents
=
brookNonBonded
.
getContentsString
(
);
std
::
string
contents
=
brookNonBonded
.
getContentsString
(
);
(
void
)
fprintf
(
log
,
"testBrookBonded
HarmonicBond
: Called brookNonBonded.getContentsString
\n
"
);
(
void
)
fprintf
(
log
,
"testBrook
Non
Bonded: Called brookNonBonded.getContentsString
\n
"
);
(
void
)
fflush
(
log
);
(
void
)
fflush
(
log
);
(
void
)
fprintf
(
log
,
"testBrookBonded
HarmonicBond
: brookNonBonded::contents
\n
%s"
,
contents
.
c_str
()
);
(
void
)
fprintf
(
log
,
"testBrook
Non
Bonded: brookNonBonded::contents
\n
%s"
,
contents
.
c_str
()
);
(
void
)
fprintf
(
log
,
"testBrookBonded
HarmonicBond
: exiting
\n
"
);
(
void
)
fprintf
(
log
,
"testBrook
Non
Bonded: exiting
\n
"
);
(
void
)
fflush
(
log
);
(
void
)
fflush
(
log
);
}
}
...
@@ -1062,7 +1064,7 @@ void testBrookBonds( void ){
...
@@ -1062,7 +1064,7 @@ void testBrookBonds( void ){
static
const
int
debug
=
1
;
static
const
int
debug
=
1
;
FILE
*
log
=
stdout
;
FILE
*
log
=
stdout
;
int
numberOfParticles
=
3
;
int
numberOfParticles
=
3
;
RealOpenMM
mass
=
2.0
;
RealOpenMM
mass
=
2.0
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -1111,9 +1113,10 @@ void testBrookBonds( void ){
...
@@ -1111,9 +1113,10 @@ void testBrookBonds( void ){
ASSERT_EQUAL_VEC
(
Vec3
(
0.7
*
0.2
,
0
,
0
),
forces
[
2
],
TOL
);
ASSERT_EQUAL_VEC
(
Vec3
(
0.7
*
0.2
,
0
,
0
),
forces
[
2
],
TOL
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
forces
[
0
][
0
]
-
forces
[
2
][
0
],
-
forces
[
0
][
1
]
-
forces
[
2
][
1
],
-
forces
[
0
][
2
]
-
forces
[
2
][
2
]),
forces
[
1
],
TOL
);
ASSERT_EQUAL_VEC
(
Vec3
(
-
forces
[
0
][
0
]
-
forces
[
2
][
0
],
-
forces
[
0
][
1
]
-
forces
[
2
][
1
],
-
forces
[
0
][
2
]
-
forces
[
2
][
2
]),
forces
[
1
],
TOL
);
(
void
)
fprintf
(
log
,
"Harmonic bond forces ok -- checking energy
\n
"
);
ASSERT_EQUAL_TOL
(
0.5
*
0.8
*
0.5
*
0.5
+
0.5
*
0.7
*
0.2
*
0.2
,
state
.
getPotentialEnergy
(),
TOL
);
ASSERT_EQUAL_TOL
(
0.5
*
0.8
*
0.5
*
0.5
+
0.5
*
0.7
*
0.2
*
0.2
,
state
.
getPotentialEnergy
(),
TOL
);
(
void
)
fprintf
(
log
,
"Harmonic bond
forces
ok
\n
"
);
(
void
)
fprintf
(
log
,
"Harmonic bond
energy
ok
\n
"
);
}
}
...
@@ -1194,7 +1197,7 @@ void testBrookPeriodicTorsions( void ){
...
@@ -1194,7 +1197,7 @@ void testBrookPeriodicTorsions( void ){
static
const
int
debug
=
1
;
static
const
int
debug
=
1
;
FILE
*
log
=
stdout
;
FILE
*
log
=
stdout
;
int
numberOfParticles
=
4
;
int
numberOfParticles
=
4
;
RealOpenMM
mass
=
2.0
;
RealOpenMM
mass
=
2.0
;
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -1214,9 +1217,6 @@ void testBrookPeriodicTorsions( void ){
...
@@ -1214,9 +1217,6 @@ void testBrookPeriodicTorsions( void ){
forceField
->
setTorsionParameters
(
0
,
0
,
1
,
2
,
3
,
2
,
PI_M
/
3
,
1.1
);
forceField
->
setTorsionParameters
(
0
,
0
,
1
,
2
,
3
,
2
,
PI_M
/
3
,
1.1
);
system
.
addForce
(
forceField
);
system
.
addForce
(
forceField
);
//(void) fprintf( log, "%s: Calling context\n", methodName.c_str() );
//(void) fflush( log );
OpenMMContext
context
(
system
,
integrator
,
platform
);
OpenMMContext
context
(
system
,
integrator
,
platform
);
vector
<
Vec3
>
positions
(
numberOfParticles
);
vector
<
Vec3
>
positions
(
numberOfParticles
);
...
@@ -1227,9 +1227,6 @@ void testBrookPeriodicTorsions( void ){
...
@@ -1227,9 +1227,6 @@ void testBrookPeriodicTorsions( void ){
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
//(void) fprintf( log, "%s :Calling getState\n", methodName.c_str() );
//(void) fflush( log );
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
...
@@ -1379,7 +1376,7 @@ void testBrookCoulomb( void ){
...
@@ -1379,7 +1376,7 @@ void testBrookCoulomb( void ){
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
(
void
)
fprintf
(
log
,
"Coulomb forces
\n
"
);
(
void
)
fprintf
(
log
,
"
\n
Coulomb forces
\n
"
);
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
numberOfParticles
;
ii
++
){
(
void
)
fprintf
(
log
,
"%d [%.5e %.5e %.5e]
\n
"
,
ii
,
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
(
void
)
fprintf
(
log
,
"%d [%.5e %.5e %.5e]
\n
"
,
ii
,
forces
[
ii
][
0
],
forces
[
ii
][
1
],
forces
[
ii
][
2
]
);
}
}
...
@@ -1518,8 +1515,13 @@ void testBrookExclusionsAnd14( void ){
...
@@ -1518,8 +1515,13 @@ void testBrookExclusionsAnd14( void ){
nonbonded
->
setNonbonded14Parameters
(
1
,
1
,
4
,
0
,
1.5
,
0.0
);
nonbonded
->
setNonbonded14Parameters
(
1
,
1
,
4
,
0
,
1.5
,
0.0
);
positions
[
ii
]
=
Vec3
(
r
,
0
,
0
);
positions
[
ii
]
=
Vec3
(
r
,
0
,
0
);
(
void
)
fprintf
(
log
,
"%s: Calling reinitialize
\n
"
,
methodName
.
c_str
()
);
(
void
)
fflush
(
log
);
context
.
reinitialize
();
context
.
reinitialize
();
context
.
setPositions
(
positions
);
context
.
setPositions
(
positions
);
(
void
)
fprintf
(
log
,
"%s: Calling getState
\n
"
,
methodName
.
c_str
()
);
(
void
)
fflush
(
log
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
State
state
=
context
.
getState
(
State
::
Forces
|
State
::
Energy
);
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
const
vector
<
Vec3
>&
forces
=
state
.
getForces
();
double
x
=
1.5
/
r
;
double
x
=
1.5
/
r
;
...
@@ -2745,10 +2747,13 @@ int main( ){
...
@@ -2745,10 +2747,13 @@ int main( ){
*/
*/
testBrookBonds
();
testBrookBonds
();
/*
testBrookAngles
();
testBrookAngles
();
testBrookRBTorsions();
testBrookPeriodicTorsions
();
testBrookPeriodicTorsions
();
testBrookRBTorsions
();
// working on this
// testLangevinSingleBond();
/*
testBrookCoulomb();
testBrookCoulomb();
testBrookLJ();
testBrookLJ();
testBrookExclusionsAnd14();
testBrookExclusionsAnd14();
...
...
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