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
8369f91d
Commit
8369f91d
authored
Mar 03, 2014
by
peastman
Browse files
Merge pull request #352 from swails/master
Fix long-range vdW correction for large(ish) systems
parents
4fdf49d5
c7549a4b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
openmmapi/src/CustomNonbondedForceImpl.cpp
openmmapi/src/CustomNonbondedForceImpl.cpp
+5
-4
openmmapi/src/NonbondedForceImpl.cpp
openmmapi/src/NonbondedForceImpl.cpp
+6
-4
No files found.
openmmapi/src/CustomNonbondedForceImpl.cpp
View file @
8369f91d
...
...
@@ -203,11 +203,11 @@ double CustomNonbondedForceImpl::calcLongRangeCorrection(const CustomNonbondedFo
// Count the total number of particle pairs for each pair of classes.
map
<
pair
<
int
,
int
>
,
int
>
interactionCount
;
map
<
pair
<
int
,
int
>
,
long
long
int
>
interactionCount
;
if
(
force
.
getNumInteractionGroups
()
==
0
)
{
// Count the particles of each class.
vector
<
int
>
classCounts
(
numClasses
,
0
);
vector
<
long
long
int
>
classCounts
(
numClasses
,
0
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
classCounts
[
atomClass
[
i
]]
++
;
for
(
int
i
=
0
;
i
<
numClasses
;
i
++
)
{
...
...
@@ -246,9 +246,10 @@ double CustomNonbondedForceImpl::calcLongRangeCorrection(const CustomNonbondedFo
for
(
int
i
=
0
;
i
<
numClasses
;
i
++
)
for
(
int
j
=
i
;
j
<
numClasses
;
j
++
)
sum
+=
interactionCount
[
make_pair
(
i
,
j
)]
*
integrateInteraction
(
expression
,
classes
[
i
],
classes
[
j
],
force
,
context
);
int
numInteractions
=
(
numParticles
*
(
numParticles
+
1
))
/
2
;
double
nPart
=
(
double
)
numParticles
;
double
numInteractions
=
(
nPart
*
(
nPart
+
1
))
/
2
;
sum
/=
numInteractions
;
return
2
*
M_PI
*
n
um
Part
icles
*
numParticles
*
sum
;
return
2
*
M_PI
*
nPart
*
nPart
*
sum
;
}
double
CustomNonbondedForceImpl
::
integrateInteraction
(
Lepton
::
CompiledExpression
&
expression
,
const
vector
<
double
>&
params1
,
const
vector
<
double
>&
params2
,
...
...
openmmapi/src/NonbondedForceImpl.cpp
View file @
8369f91d
...
...
@@ -239,7 +239,8 @@ double NonbondedForceImpl::calcDispersionCorrection(const System& system, const
for
(
map
<
pair
<
double
,
double
>
,
int
>::
const_iterator
entry
=
classCounts
.
begin
();
entry
!=
classCounts
.
end
();
++
entry
)
{
double
sigma
=
entry
->
first
.
first
;
double
epsilon
=
entry
->
first
.
second
;
int
count
=
(
entry
->
second
*
(
entry
->
second
+
1
))
/
2
;
double
count
=
(
double
)
entry
->
second
;
count
*=
(
count
+
1
)
/
2
;
double
sigma2
=
sigma
*
sigma
;
double
sigma6
=
sigma2
*
sigma2
*
sigma2
;
sum1
+=
count
*
epsilon
*
sigma6
*
sigma6
;
...
...
@@ -251,7 +252,8 @@ double NonbondedForceImpl::calcDispersionCorrection(const System& system, const
for
(
map
<
pair
<
double
,
double
>
,
int
>::
const_iterator
class2
=
classCounts
.
begin
();
class2
!=
class1
;
++
class2
)
{
double
sigma
=
0.5
*
(
class1
->
first
.
first
+
class2
->
first
.
first
);
double
epsilon
=
sqrt
(
class1
->
first
.
second
*
class2
->
first
.
second
);
int
count
=
class1
->
second
*
class2
->
second
;
double
count
=
(
double
)
class1
->
second
;
count
*=
(
double
)
class2
->
second
;
double
sigma2
=
sigma
*
sigma
;
double
sigma6
=
sigma2
*
sigma2
*
sigma2
;
sum1
+=
count
*
epsilon
*
sigma6
*
sigma6
;
...
...
@@ -259,8 +261,8 @@ double NonbondedForceImpl::calcDispersionCorrection(const System& system, const
if
(
useSwitch
)
sum3
+=
count
*
epsilon
*
(
evalIntegral
(
cutoff
,
switchDist
,
cutoff
,
sigma
)
-
evalIntegral
(
switchDist
,
switchDist
,
cutoff
,
sigma
));
}
int
numParticles
=
system
.
getNumParticles
();
int
numInteractions
=
(
numParticles
*
(
numParticles
+
1
))
/
2
;
double
numParticles
=
(
double
)
system
.
getNumParticles
();
double
numInteractions
=
(
numParticles
*
(
numParticles
+
1
))
/
2
;
sum1
/=
numInteractions
;
sum2
/=
numInteractions
;
sum3
/=
numInteractions
;
...
...
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