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
fd64ac97
Commit
fd64ac97
authored
Sep 21, 2009
by
Rossen Apostolov
Browse files
Ewald method potential is now compared to the exact value of the Madelung energy.
parent
68ef42c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
platforms/reference/tests/TestReferenceEwald.cpp
platforms/reference/tests/TestReferenceEwald.cpp
+15
-2
No files found.
platforms/reference/tests/TestReferenceEwald.cpp
View file @
fd64ac97
...
@@ -84,8 +84,21 @@ void testEwaldExact() {
...
@@ -84,8 +84,21 @@ void testEwaldExact() {
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
();
// Compare against Gromacs result for now
// The potential energy of an ion in a crystal is
ASSERT_EQUAL_TOL
(
-
430494.0
,
state
.
getPotentialEnergy
(),
10
*
TOL
);
// E = - (M*e/ 4*pi*epsilon0*a0),
// where
// M : Madelung constant (dimensionless, for FCC cells such as NaCl it is 1.7476)
// e : 1.6022 × 10−19 C
// 4*pi*epsilon0 : 1.112 × 10−10 C²/(J m)
// a0 : 0.282 x 10-9 m (perfect cell)
// Therefore
double
exactEnergy
=
-
8.9290
;
// eV
exactEnergy
=
-
4.4645
;
// eV per 1 ion
exactEnergy
=
-
7.15292069e-19
;
// J per ion
exactEnergy
=
-
430.820
;
// kJ/mol per ion
ASSERT_EQUAL_TOL
(
exactEnergy
*
numParticles
,
state
.
getPotentialEnergy
(),
100
*
TOL
);
// Gromacs result
// ASSERT_EQUAL_TOL(-430494.0, state.getPotentialEnergy(), 10*TOL);
}
}
...
...
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